X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FLdvProfile.h;h=d85b95cd6ade6dbeefef61a7876855f3683ceace;hb=beb5737b7ee42c4e9373a505e7d957206d69a30e;hp=b722fbc8ae6aef498e4133b4506a3d9fa2c368b2;hpb=db61851c5472bf565cd1da900b33d6e033fd743d;p=ghc-hetmet.git diff --git a/ghc/rts/LdvProfile.h b/ghc/rts/LdvProfile.h index b722fbc..d85b95c 100644 --- a/ghc/rts/LdvProfile.h +++ b/ghc/rts/LdvProfile.h @@ -1,5 +1,4 @@ /* ----------------------------------------------------------------------------- - * $Id: LdvProfile.h,v 1.1 2001/11/22 14:25:12 simonmar Exp $ * * (c) The GHC Team, 2001 * Author: Sungwoo Park @@ -15,49 +14,29 @@ #include "ProfHeap.h" -void LDV_recordDead_FILL_SLOP_DYNAMIC( StgClosure *p ); - -// Precesses a closure 'c' being destroyed whose size is 'size'. -// Make sure that LDV_recordDead() is not invoked on 'inherently used' closures -// such as TSO; they should not be involved in computing dragNew or voidNew. -// -// Note: ldvTime is 0 if LDV profiling is turned off. -// ldvTime is > 0 if LDV profiling is turned on. -// size does not include StgProfHeader. -// -// Even though ldvTime is checked in both LdvCensusForDead() and -// LdvCensusKillAll(), we still need to make sure that ldvTime is > 0 because -// LDV_recordDead() may be called from elsewhere in the runtime system. E.g., -// when a thunk is replaced by an indirection object. - -static inline void -LDV_recordDead( StgClosure *c, nat size ) -{ - if (ldvTime > 0 && closureSatisfiesConstraints(c)) { - nat t; - size -= sizeofW(StgProfHeader); - if ((LDVW((c)) & LDV_STATE_MASK) == LDV_STATE_CREATE) { - t = (LDVW((c)) & LDV_CREATE_MASK) >> LDV_SHIFT; - if (t < ldvTime) { - gi[t].voidNew += (int)size; - gi[ldvTime].voidNew -= (int)size; - } - } else { - t = LDVW((c)) & LDV_LAST_MASK; - if (t + 1 < ldvTime) { - gi[t + 1].dragNew += size; - gi[ldvTime].dragNew -= size; - } - } - } -} - -extern void initLdvProfiling ( void ); -extern void endLdvProfiling ( void ); -extern void LdvCensus ( void ); +extern void LDV_recordDead_FILL_SLOP_DYNAMIC( StgClosure *p ); extern void LdvCensusForDead ( nat ); extern void LdvCensusKillAll ( void ); +// Creates a 0-filled slop of size 'howManyBackwards' backwards from the +// address 'from'. +// +// Invoked when: +// 1) Hp is incremented and exceeds HpLim (in Updates.hc). +// 2) copypart() is called (in GC.c). +#define LDV_FILL_SLOP(from, howManyBackwards) \ + if (era > 0) { \ + int i; \ + for (i = 0;i < (howManyBackwards); i++) \ + ((StgWord *)(from))[-i] = 0; \ + } + +// Informs the LDV profiler that closure c has just been evacuated. +// Evacuated objects are no longer needed, so we just store its original size in +// the LDV field. +#define SET_EVACUAEE_FOR_LDV(c, size) \ + LDVW((c)) = (size) + #endif /* PROFILING */ #endif /* LDVPROFILE_H */