Commit 6a19a2b9 authored by simonm's avatar simonm
Browse files

[project @ 1999-04-08 15:43:44 by simonm]

Don't set the cost centre when entering a PAP.  Either:

	-  it's fully applied, in which case we're about to
	   set the CCS in the function anyway, or

	-  we're about to build another PAP in which case the
	   costs get attributed to the current CCS.

This avoids appending CCSs twice in some cases.
parent 9d1775e3
/* -----------------------------------------------------------------------------
* $Id: StgProf.h,v 1.4 1999/03/25 13:14:04 simonm Exp $
* $Id: StgProf.h,v 1.5 1999/04/08 15:43:44 simonm Exp $
*
* (c) The GHC Team, 1998
*
......@@ -270,7 +270,8 @@ extern CostCentreStack *CCS_LIST; /* registered CCS list */
/* These ENTER_CC_PAP things are only used in the RTS */
#define ENTER_CCS_PAP(stack) \
#define ENTER_CCS_PAP(stack) /* nothing */
#if 0 /* old version */
do { \
CostCentreStack *ccs = (CostCentreStack *) (stack); \
if ( ! IS_CAF_OR_SUB_CCS(ccs) ) { \
......@@ -282,6 +283,7 @@ extern CostCentreStack *CCS_LIST; /* registered CCS list */
} \
CCCS_DETAIL_COUNT(CCCS->pap_count); \
} while(0)
#endif
#define ENTER_CCS_PAP_CL(closure) \
ENTER_CCS_PAP((closure)->header.prof.ccs)
......
/* -----------------------------------------------------------------------------
* $Id: Profiling.c,v 1.4 1999/03/25 13:14:06 simonm Exp $
* $Id: Profiling.c,v 1.5 1999/04/08 15:43:45 simonm Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -291,11 +291,12 @@ AppendCCS ( CostCentreStack *ccs1, CostCentreStack *ccs2 )
{
CostCentreStack *ccs;
IF_DEBUG(prof,
fprintf(stderr,"Appending ");
printCCS(ccs1);
fprintf(stderr," to ");
printCCS(ccs2);
fprintf(stderr,"\n"));
if (ccs1 != ccs2) {
fprintf(stderr,"Appending ");
printCCS(ccs1);
fprintf(stderr," to ");
printCCS(ccs2);
fprintf(stderr,"\n");});
return AppendCCS(ccs1,ccs2);
}
#endif
......
/* -----------------------------------------------------------------------------
* $Id: Updates.hc,v 1.13 1999/03/26 10:29:06 simonm Exp $
* $Id: Updates.hc,v 1.14 1999/04/08 15:43:46 simonm Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -200,7 +200,7 @@ EXTFUN(stg_update_PAP)
{
nat Words, PapSize;
#ifdef PROFILING
CostCentreStack *CCS_pap;
CostCentreStack *CCS_pap, *CCS_blame;
#endif
StgPAP* PapClosure;
StgClosure *Fun, *Updatee;
......@@ -228,6 +228,10 @@ EXTFUN(stg_update_PAP)
#if defined(PROFILING)
/* set "CC_pap" to go in the updatee (see Sansom thesis, p 183) */
CCS_pap = Fun->header.prof.ccs;
CCS_blame = Fun->header.prof.ccs;
if (IS_CAF_OR_SUB_CCS(CCS_pap)) {
CCS_blame = CCCS;
}
#endif
if (Words == 0) {
......@@ -264,7 +268,7 @@ EXTFUN(stg_update_PAP)
TICK_ALLOC_UPD_PAP(1/*fun*/ + Words, 0);
#ifdef PROFILING
CCS_ALLOC(CCS_pap, PapSize);
CCS_ALLOC(CCS_blame, PapSize);
#endif
PapClosure = (StgPAP *)(Hp + 1 - PapSize); /* The new PapClosure */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment