diff options
author | dias@eecs.tufts.edu <unknown> | 2009-03-23 20:11:40 +0000 |
---|---|---|
committer | dias@eecs.tufts.edu <unknown> | 2009-03-23 20:11:40 +0000 |
commit | 5dd61c6680eb9c2091048cacbfa53ab9e55ddcb6 (patch) | |
tree | 96fe92ba02adc671f2a85efbcb0970911a7520ba /compiler/codeGen | |
parent | 8e9c95ac7ad62c5ce6d39e52ac8da6936f19da4c (diff) | |
download | haskell-5dd61c6680eb9c2091048cacbfa53ab9e55ddcb6.tar.gz |
Code simplifications due to call/return separation; some improvements to how node argument is managed
Diffstat (limited to 'compiler/codeGen')
-rw-r--r-- | compiler/codeGen/StgCmmBind.hs | 29 | ||||
-rw-r--r-- | compiler/codeGen/StgCmmHeap.hs | 15 |
2 files changed, 22 insertions, 22 deletions
diff --git a/compiler/codeGen/StgCmmBind.hs b/compiler/codeGen/StgCmmBind.hs index f098f3f733..5decdebd7e 100644 --- a/compiler/codeGen/StgCmmBind.hs +++ b/compiler/codeGen/StgCmmBind.hs @@ -393,21 +393,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 node 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 } diff --git a/compiler/codeGen/StgCmmHeap.hs b/compiler/codeGen/StgCmmHeap.hs index 0e3501a720..ec6095313e 100644 --- a/compiler/codeGen/StgCmmHeap.hs +++ b/compiler/codeGen/StgCmmHeap.hs @@ -344,15 +344,14 @@ entryHeapCheck fun arity args code = do updfr_sz <- getUpdFrameOff heapCheck True (gc_call updfr_sz) code -- The 'fun' keeps relevant CAFs alive where - fun_expr = CmmReg (CmmLocal fun) - -- JD: ugh... we should only do the following for dynamic closures - args' = fun_expr : map (CmmReg . CmmLocal) args + args' = fun : args + arg_exprs = map (CmmReg . CmmLocal) args' gc_call updfr_sz - | arity == 0 = mkJumpGC (CmmReg (CmmGlobal GCEnter1)) args' updfr_sz - | otherwise = case gc_lbl (fun : args) of - Just lbl -> mkJumpGC (CmmLit (CmmLabel (mkRtsCodeLabel lbl))) - args' updfr_sz - Nothing -> mkCall generic_gc (GC, GC) [] [] updfr_sz + | arity == 0 = mkJumpGC (CmmReg (CmmGlobal GCEnter1)) arg_exprs updfr_sz + | otherwise = case gc_lbl args' of + Just lbl -> mkJumpGC (CmmLit (CmmLabel (mkRtsCodeLabel lbl))) + arg_exprs updfr_sz + Nothing -> mkCall generic_gc (GC, GC) [] [] updfr_sz gc_lbl :: [LocalReg] -> Maybe LitString {- |