X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FcodeGen%2FStgCmmBind.hs;h=64d3ef1794fa62abe1a59bb4599409c34d37c3c1;hp=f098f3f73360cd2a5803e2ba1854e90f72dfbc87;hb=703ca1542c8e0983cc9d8eebce6e9f3dd3fd71e2;hpb=1357b06a75887e7d39ee8fe052f6b3572a31a966 diff --git a/compiler/codeGen/StgCmmBind.hs b/compiler/codeGen/StgCmmBind.hs index f098f3f..64d3ef1 100644 --- a/compiler/codeGen/StgCmmBind.hs +++ b/compiler/codeGen/StgCmmBind.hs @@ -47,8 +47,6 @@ import Outputable import FastString import Maybes -import Data.List - ------------------------------------------------------------------------ -- Top-level bindings ------------------------------------------------------------------------ @@ -393,21 +391,22 @@ closureCodeBody top_lvl bndr cl_info cc args arity body fv_details -- Emit the main entry code ; emitClosureProcAndInfoTable top_lvl bndr cl_info args $ \(node, arg_regs) -> do - -- Emit the slow-entry code (for entering a closure through a PAP) - { mkSlowEntryCode cl_info arg_regs - - ; let lf_info = closureLFInfo cl_info - node_points = nodeMustPointToIt lf_info - ; tickyEnterFun cl_info - ; whenC node_points (ldvEnterClosure cl_info) - ; granYield arg_regs node_points - - -- Main payload - ; entryHeapCheck node arity arg_regs $ do - { enterCostCentre cl_info cc body + -- Emit the slow-entry code (for entering a closure through a PAP) + { mkSlowEntryCode cl_info arg_regs + + ; let lf_info = closureLFInfo cl_info + node_points = nodeMustPointToIt lf_info + ; tickyEnterFun cl_info + ; whenC node_points (ldvEnterClosure cl_info) + ; granYield arg_regs node_points + + -- Main payload + ; entryHeapCheck (if node_points then Just node else Nothing) arity arg_regs $ do + { enterCostCentre cl_info cc body ; fv_bindings <- mapM bind_fv fv_details - ; load_fvs node lf_info fv_bindings -- Load free vars out of closure *after* - ; cgExpr body }} -- heap check, to reduce live vars over check + -- Load free vars out of closure *after* + ; if node_points then load_fvs node lf_info fv_bindings else return () + ; cgExpr body }} -- heap check, to reduce live vars over check } @@ -458,7 +457,7 @@ thunkCode cl_info fv_details cc node arity body ; granThunk node_points -- Heap overflow check - ; entryHeapCheck node arity [] $ do + ; entryHeapCheck (if node_points then Just node else Nothing) arity [] $ do { -- Overwrite with black hole if necessary -- but *after* the heap-overflow check dflags <- getDynFlags