diff options
author | Peter Wortmann <scpmw@leeds.ac.uk> | 2014-12-06 17:11:42 +0100 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-12-16 15:02:33 -0600 |
commit | 5fecd767309f318e0ec6797667ca6442a54ea451 (patch) | |
tree | d0de9f33ffe98cb01273bb2b552628fa14112d8e /compiler/codeGen/StgCmmHeap.hs | |
parent | 7ceaf96fde63bd45dfc1e08a975cba0ee280eb7b (diff) | |
download | haskell-5fecd767309f318e0ec6797667ca6442a54ea451.tar.gz |
Tick scopes
This patch solves the scoping problem of CmmTick nodes: If we just put
CmmTicks into blocks we have no idea what exactly they are meant to
cover. Here we introduce tick scopes, which allow us to create
sub-scopes and merged scopes easily.
Notes:
* Given that the code often passes Cmm around "head-less", we have to
make sure that its intended scope does not get lost. To keep the amount
of passing-around to a minimum we define a CmmAGraphScoped type synonym
here that just bundles the scope with a portion of Cmm to be assembled
later.
* We introduce new scopes at somewhat random places, aligning with
getCode calls. This works surprisingly well, but we might have to
add new scopes into the mix later on if we find things too be too
coarse-grained.
(From Phabricator D169)
Diffstat (limited to 'compiler/codeGen/StgCmmHeap.hs')
-rw-r--r-- | compiler/codeGen/StgCmmHeap.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/codeGen/StgCmmHeap.hs b/compiler/codeGen/StgCmmHeap.hs index eca118fd25..0e9eb6d658 100644 --- a/compiler/codeGen/StgCmmHeap.hs +++ b/compiler/codeGen/StgCmmHeap.hs @@ -420,7 +420,8 @@ altOrNoEscapeHeapCheck checkYield regs code = do lret <- newLabelC let (off, _, copyin) = copyInOflow dflags NativeReturn (Young lret) regs [] lcont <- newLabelC - emitOutOfLine lret (copyin <*> mkBranch lcont) + tscope <- getTickScope + emitOutOfLine lret (copyin <*> mkBranch lcont, tscope) emitLabel lcont cannedGCReturnsTo checkYield False gc regs lret off code @@ -651,8 +652,9 @@ do_checks mb_stk_hwm checkYield mb_alloc_lit do_gc = do CmmLit (zeroCLit dflags)] emit =<< mkCmmIfGoto yielding gc_id - emitOutOfLine gc_id $ - do_gc -- this is expected to jump back somewhere + tscope <- getTickScope + emitOutOfLine gc_id + (do_gc, tscope) -- this is expected to jump back somewhere -- Test for stack pointer exhaustion, then -- bump heap pointer, and test for heap exhaustion |