[project @ 2001-11-23 11:57:59 by simonmar]
authorsimonmar <unknown>
Fri, 23 Nov 2001 11:58:00 +0000 (11:58 +0000)
committersimonmar <unknown>
Fri, 23 Nov 2001 11:58:00 +0000 (11:58 +0000)
commit79abe0acae28895eeb8a762dcf5867b84982a27c
tree21e3847b9739b1d83720e9b4a4fffdb50aae1f01
parent7edf3bea6cc667ea3574cd7dc1b15f3a00c3bc9c
[project @ 2001-11-23 11:57:59 by simonmar]
Fix a long-standing bug in the cost attribution of cost-center stacks.
The problem case is this:

let z = _scc_ "z" f x
in ... z ...

previously we were attributing the cost of allocating the closure 'z'
to the enclosing cost center stack (CCCS), when it should really be
attributed to "z":CCCS.  The effects are particularly visible with
retainer profiling, because the closure retaining 'f' and 'x' would
show up with the wrong CCS attached.

To fix this, we need a new form of CCS representation internally:
'PushCC CostCentre CostCentreStack' which subsumes (and therefore
replaces) SingletonCCS.  SingletonCCS is now represented by 'PushCC cc
NoCCS'.

The CCS argument to SET_HDR may now be an arbitrary expression, such
as PushCostCentre(CCCS,foo_cc), as may be the argument to CCS_ALLOC().
So we combine SET_HDR and CCS_ALLOC into a single macro, SET_HDR_, to
avoid repeated calls to PushCostCentre().
ghc/compiler/absCSyn/AbsCSyn.lhs
ghc/compiler/absCSyn/AbsCUtils.lhs
ghc/compiler/absCSyn/Costs.lhs
ghc/compiler/absCSyn/PprAbsC.lhs
ghc/compiler/codeGen/CgHeapery.lhs
ghc/compiler/nativeGen/AbsCStixGen.lhs
ghc/compiler/profiling/CostCentre.lhs
ghc/includes/StgMacros.h