X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FLdvProfile.c;h=e46f4d7c661b2e2305127457fd593d97b37202dd;hb=4d3ce7360892fec57a9ae42d77d3a7ed344e023a;hp=c0f0411226e12c27266161a3626fbe903a5b16e6;hpb=dbef766ce79e37a74468a07a93b15ba1f06fe8f8;p=ghc-hetmet.git diff --git a/ghc/rts/LdvProfile.c b/ghc/rts/LdvProfile.c index c0f0411..e46f4d7 100644 --- a/ghc/rts/LdvProfile.c +++ b/ghc/rts/LdvProfile.c @@ -1,5 +1,4 @@ /* ----------------------------------------------------------------------------- - * $Id: LdvProfile.c,v 1.2 2001/11/26 16:54:21 simonmar Exp $ * * (c) The GHC Team, 2001 * Author: Sungwoo Park @@ -10,22 +9,15 @@ #ifdef PROFILING -#include "Stg.h" #include "Rts.h" #include "LdvProfile.h" #include "RtsFlags.h" -#include "Itimer.h" -#include "Proftimer.h" #include "Profiling.h" #include "Stats.h" #include "Storage.h" #include "RtsUtils.h" #include "Schedule.h" -// ldvTimeSave is set in LdvCensusKillAll(), and stores the final number of -// times that LDV profiling was proformed. -static nat ldvTimeSave; - /* -------------------------------------------------------------------------- * Fills in the slop when a *dynamic* closure changes its type. * First calls LDV_recordDead() to declare the closure is dead, and then @@ -44,10 +36,16 @@ static nat ldvTimeSave; void LDV_recordDead_FILL_SLOP_DYNAMIC( StgClosure *p ) { + StgInfoTable *info; + nat nw, i; + +#if defined(__GNUC__) && __GNUC__ < 3 && defined(DEBUG) +#error Please use gcc 3.0+ to compile this file with DEBUG; gcc < 3.0 miscompiles it +#endif + if (era > 0) { - StgInfoTable *inf = get_itbl((p)); - nat nw, i; - switch (inf->type) { + info = get_itbl((p)); + switch (info->type) { case THUNK_1_0: case THUNK_0_1: case THUNK_2_0: @@ -57,21 +55,25 @@ LDV_recordDead_FILL_SLOP_DYNAMIC( StgClosure *p ) nw = MIN_UPD_SIZE; break; case THUNK: - nw = inf->layout.payload.ptrs + inf->layout.payload.nptrs; + nw = info->layout.payload.ptrs + info->layout.payload.nptrs; if (nw < MIN_UPD_SIZE) nw = MIN_UPD_SIZE; break; - case AP_UPD: + case AP: nw = sizeofW(StgPAP) - sizeofW(StgHeader) + ((StgPAP *)p)->n_args; break; + case AP_STACK: + nw = sizeofW(StgAP_STACK) - sizeofW(StgHeader) + + ((StgAP_STACK *)p)->size; + break; case CAF_BLACKHOLE: case BLACKHOLE: case SE_BLACKHOLE: case SE_CAF_BLACKHOLE: - nw = inf->layout.payload.ptrs + inf->layout.payload.nptrs; + nw = info->layout.payload.ptrs + info->layout.payload.nptrs; break; default: - barf("Unexpected closure type %u in LDV_recordDead_FILL_SLOP_DYNAMIC()", inf->type); + barf("Unexpected closure type %u in LDV_recordDead_FILL_SLOP_DYNAMIC()", info->type); break; } LDV_recordDead((StgClosure *)(p), nw + sizeofW(StgHeader)); @@ -90,7 +92,7 @@ LDV_recordDead_FILL_SLOP_DYNAMIC( StgClosure *p ) * closure. Returns the size of the closure, including the profiling * header portion, so that the caller can find the next closure. * ----------------------------------------------------------------------- */ -static inline nat +STATIC_INLINE nat processHeapClosureForDead( StgClosure *c ) { nat size; @@ -132,7 +134,6 @@ processHeapClosureForDead( StgClosure *c ) case WEAK: case MUT_VAR: - case MUT_CONS: case FOREIGN: case BCO: case STABLE_NAME: @@ -156,11 +157,15 @@ processHeapClosureForDead( StgClosure *c ) size = sizeofW(StgHeader) + MIN_UPD_SIZE; break; - case AP_UPD: + case AP: case PAP: size = pap_sizeW((StgPAP *)c); break; + case AP_STACK: + size = ap_stack_sizeW((StgAP_STACK *)c); + break; + case CONSTR: case CONSTR_1_0: case CONSTR_0_1: @@ -184,11 +189,8 @@ processHeapClosureForDead( StgClosure *c ) break; case IND_PERM: - size = sizeofW(StgInd); - break; - case IND_OLDGEN_PERM: - size = sizeofW(StgIndOldGen); + size = sizeofW(StgInd); break; /* @@ -201,11 +203,8 @@ processHeapClosureForDead( StgClosure *c ) // because they will perish before the next census at any // rate. case IND: - size = sizeofW(StgInd); - return size; - case IND_OLDGEN: - size = sizeofW(StgIndOldGen); + size = sizeofW(StgInd); return size; case EVACUATED: @@ -229,7 +228,6 @@ processHeapClosureForDead( StgClosure *c ) case UPDATE_FRAME: case CATCH_FRAME: case STOP_FRAME: - case SEQ_FRAME: case RET_DYN: case RET_BCO: case RET_SMALL: