diff options
author | Geoffrey Mainland <gmainlan@microsoft.com> | 2013-07-22 17:15:44 +0100 |
---|---|---|
committer | Geoffrey Mainland <gmainlan@microsoft.com> | 2013-07-22 17:15:44 +0100 |
commit | 76d0cbcb72cf098cab684745ad3d8f364192e4b6 (patch) | |
tree | b0a3019c135d71bd0b90af0eed2f20c753975a2c /compiler/codeGen | |
parent | e7de764a76f0b428daf45865b0658faeb60326b2 (diff) | |
download | haskell-76d0cbcb72cf098cab684745ad3d8f364192e4b6.tar.gz |
Add final remaining bits to fix #7978.
Diffstat (limited to 'compiler/codeGen')
-rw-r--r-- | compiler/codeGen/StgCmmBind.hs | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/compiler/codeGen/StgCmmBind.hs b/compiler/codeGen/StgCmmBind.hs index 4996c6f1fa..0344f24992 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 ------------------------------------------------------------------------ |