summaryrefslogtreecommitdiff
path: root/compiler/codeGen/StgCmmBind.hs
diff options
context:
space:
mode:
authorNicolas Frisby <nicolas.frisby@gmail.com>2013-05-01 08:45:52 -0500
committerNicolas Frisby <nicolas.frisby@gmail.com>2013-05-02 10:27:50 -0500
commit11a85cc7ea50d4b7c12ea2cc3c0ce39734dc4217 (patch)
treebf04983c464496e93c4a855c831f6c839c523bbc /compiler/codeGen/StgCmmBind.hs
parentade1ae97ed52c493ec415c1601dace39b64071dd (diff)
downloadhaskell-11a85cc7ea50d4b7c12ea2cc3c0ce39734dc4217.tar.gz
extended ticky to also track "let"s that are not conventional closures
This includes selector, ap, and constructor thunks. They are still guarded by the -ticky-dyn-thk flag. (This is 024df664b600a with a small bug fix.)
Diffstat (limited to 'compiler/codeGen/StgCmmBind.hs')
-rw-r--r--compiler/codeGen/StgCmmBind.hs22
1 files changed, 13 insertions, 9 deletions
diff --git a/compiler/codeGen/StgCmmBind.hs b/compiler/codeGen/StgCmmBind.hs
index c070e80199..8d0a35ff4f 100644
--- a/compiler/codeGen/StgCmmBind.hs
+++ b/compiler/codeGen/StgCmmBind.hs
@@ -204,8 +204,9 @@ cgRhs :: Id
-- (see above)
)
-cgRhs name (StgRhsCon cc con args)
- = buildDynCon name cc con args
+cgRhs id (StgRhsCon cc con args)
+ = withNewTickyCounterThunk False (idName id) $ -- False for "not static"
+ buildDynCon id True cc con args
cgRhs name (StgRhsClosure cc bi fvs upd_flag _srt args body)
= do dflags <- getDynFlags
@@ -363,7 +364,7 @@ mkRhsClosure _ bndr cc _ fvs upd_flag args body
; emit (mkComment $ mkFastString "calling allocDynClosure")
; let toVarArg (NonVoid a, off) = (NonVoid (StgVarArg a), off)
; let info_tbl = mkCmmInfo closure_info
- ; hp_plus_n <- allocDynClosure info_tbl lf_info use_cc blame_cc
+ ; hp_plus_n <- allocDynClosure (Just bndr) info_tbl lf_info use_cc blame_cc
(map toVarArg fv_details)
-- RETURN
@@ -381,8 +382,9 @@ cgRhsStdThunk bndr lf_info payload
; return (id_info, gen_code reg)
}
where
- gen_code reg
- = do -- AHA! A STANDARD-FORM THUNK
+ gen_code reg -- AHA! A STANDARD-FORM THUNK
+ = withNewTickyCounterStdThunk False (idName bndr) $ -- False for "not static"
+ do
{ -- LAY OUT THE OBJECT
mod_name <- getModuleName
; dflags <- getDynFlags
@@ -397,9 +399,11 @@ cgRhsStdThunk bndr lf_info payload
-- ; (use_cc, blame_cc) <- chooseDynCostCentres cc [{- no args-}] body
; let use_cc = curCCS; blame_cc = curCCS
+ ; tickyEnterStdThunk
+
-- BUILD THE OBJECT
; let info_tbl = mkCmmInfo closure_info
- ; hp_plus_n <- allocDynClosure info_tbl lf_info
+ ; hp_plus_n <- allocDynClosure (Just bndr) info_tbl lf_info
use_cc blame_cc payload_w_offsets
-- RETURN
@@ -448,7 +452,7 @@ closureCodeBody :: Bool -- whether this is a top-level binding
closureCodeBody top_lvl bndr cl_info cc _args arity body fv_details
| arity == 0 -- No args i.e. thunk
- = withNewTickyCounterThunk cl_info $
+ = withNewTickyCounterThunk (isStaticClosure cl_info) (closureName cl_info) $
emitClosureProcAndInfoTable top_lvl bndr lf_info info_tbl [] $
\(_, node, _) -> thunkCode cl_info fv_details cc node arity body
where
@@ -552,7 +556,7 @@ thunkCode cl_info fv_details _cc node arity body
-- that cc of enclosing scope will be recorded
-- in update frame CAF/DICT functions will be
-- subsumed by this enclosing cc
- do { tickyEnterThunk cl_info
+ do { tickyEnterThunk
; enterCostCentreThunk (CmmReg nodeReg)
; let lf_info = closureLFInfo cl_info
; fv_bindings <- mapM bind_fv fv_details
@@ -717,7 +721,7 @@ link_caf node _is_upd = do
blame_cc = use_cc
tso = CmmReg (CmmGlobal CurrentTSO)
- ; hp_rel <- allocDynClosureCmm cafBlackHoleInfoTable mkLFBlackHole
+ ; hp_rel <- allocDynClosureCmm Nothing cafBlackHoleInfoTable mkLFBlackHole
use_cc blame_cc [(tso,fixedHdrSize dflags)]
-- small optimisation: we duplicate the hp_rel expression in
-- both the newCAF call and the value returned below.