+ Set cost centre stack when entering a function. Here we implement
+ the rule
+
+ "if CCSfn is an initial segment of CCCS,
+ then set CCCS to CCSfn,
+ else append CCSfn to CCCS"
+ -------------------------------------------------------------------------- */
+rtsBool entering_PAP;
+
+CostCentreStack *
+EnterFunCCS ( CostCentreStack *cccs, CostCentreStack *ccsfn )
+{
+ /* PAP_entry has already set CCCS for us */
+ if (entering_PAP) {
+ entering_PAP = rtsFalse;
+ return CCCS;
+ }
+
+ if (cccs->root == ccsfn->root) {
+ return ccsfn;
+ } else {
+ return AppendCCS(cccs,ccsfn);
+ }
+}
+
+/* -----------------------------------------------------------------------------