[commit: ghc] master: Add final remaining bits to fix #7978. (76d0cbc)
Geoffrey Mainland
gmainlan at ghc.haskell.org
Mon Jul 22 18:17:33 CEST 2013
Repository : http://darcs.haskell.org/ghc.git/
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/76d0cbcb72cf098cab684745ad3d8f364192e4b6
>---------------------------------------------------------------
commit 76d0cbcb72cf098cab684745ad3d8f364192e4b6
Author: Geoffrey Mainland <gmainlan at microsoft.com>
Date: Mon Jul 22 17:15:44 2013 +0100
Add final remaining bits to fix #7978.
>---------------------------------------------------------------
compiler/codeGen/StgCmmBind.hs | 31 +------------------------------
1 file changed, 1 insertion(+), 30 deletions(-)
diff --git a/compiler/codeGen/StgCmmBind.hs b/compiler/codeGen/StgCmmBind.hs
index 4996c6f..0344f24 100644
--- a/compiler/codeGen/StgCmmBind.hs
+++ b/compiler/codeGen/StgCmmBind.hs
@@ -207,40 +207,11 @@ cgRhs id (StgRhsCon cc con args)
= withNewTickyCounterThunk False (idName id) $ -- False for "not static"
buildDynCon id True cc con args
+{- See Note [GC recovery] in compiler/codeGen/StgCmmClosure.hs -}
cgRhs name (StgRhsClosure cc bi fvs upd_flag _srt args body)
- | null fvs -- See Note [Nested constant closures]
- = do { (info, fcode) <- cgTopRhsClosure Recursive name dontCareCCS bi upd_flag args body
- ; return (info, fcode >> return mkNop) }
- | otherwise
= do dflags <- getDynFlags
mkRhsClosure dflags name cc bi (nonVoidIds fvs) upd_flag args body
-{- Note [Nested constant closures]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If we have
- f x = let funny = not True
- in ...
-then 'funny' is a nested closure (compiled with cgRhs) that has no free vars.
-This does not happen often, because let-floating takes them all to top
-level; but it CAN happen. (Reason: let-floating may make a function f smaller
-so it can be inlined, so now (f True) may generate a local no-fv closure.
-This actually happened during bootsrapping GHC itself, with f=mkRdrFunBind
-in TcGenDeriv.)
-
-If we have one of these things, AND they allocate, the heap check will
-refer to the static funny_closure; but there isn't one! (Why does the
-heap check refer to the static closure? Becuase nodeMustPointToIt is
-False, which is fair enough.)
-
-Simple solution: compile the RHS as if it was top level. Then
-everything works. A minor benefit is eliminating the allocation code
-too.
-
-GBM: when we compile the RHS as if it were top level, the cost centre stack in
-the StgRhsClosure is no longer valid. For now we replace the cost centre stack
-with dontCareCCS.
--}
-
------------------------------------------------------------------------
-- Non-constructor right hand sides
------------------------------------------------------------------------
More information about the ghc-commits
mailing list