X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FStgLdvProf.h;h=f5f7ae22d851202063dbc348460646bb91f9fdc0;hb=423d477bfecd490de1449c59325c8776f91d7aac;hp=dceefd7140a90550d5bd8ae6e5094d24a1169f5c;hpb=553e90d9a32ee1b1809430f260c401cc4169c6c7;p=ghc-hetmet.git diff --git a/ghc/includes/StgLdvProf.h b/ghc/includes/StgLdvProf.h index dceefd7..f5f7ae2 100644 --- a/ghc/includes/StgLdvProf.h +++ b/ghc/includes/StgLdvProf.h @@ -1,8 +1,6 @@ /* ----------------------------------------------------------------------------- - * $Id: StgLdvProf.h,v 1.2 2001/11/26 16:54:22 simonmar Exp $ * - * (c) The GHC Team, 2001 - * Author: Sungwoo Park + * (c) The University of Glasgow, 2004 * * Lag/Drag/Void profiling. * @@ -11,63 +9,37 @@ #ifndef STGLDVPROF_H #define STGLDVPROF_H -/* - An LDV word is divided into 3 parts: state bits (LDV_STATE_MASK), creation - time bits (LDV_CREATE_MASK), and last use time bits (LDV_LAST_MASK). - */ -#if SIZEOF_VOID_P == 8 -#define LDV_SHIFT 30 -#define LDV_STATE_MASK 0x1000000000000000 -#define LDV_CREATE_MASK 0x0FFFFFFFC0000000 -#define LDV_LAST_MASK 0x000000003FFFFFFF -#define LDV_STATE_CREATE 0x0000000000000000 -#define LDV_STATE_USE 0x1000000000000000 -#else -#define LDV_SHIFT 15 -#define LDV_STATE_MASK 0x40000000 -#define LDV_CREATE_MASK 0x3FFF8000 -#define LDV_LAST_MASK 0x00007FFF -#define LDV_STATE_CREATE 0x00000000 -#define LDV_STATE_USE 0x40000000 -#endif // SIZEOF_VOID_P - #ifdef PROFILING -extern nat era; - -// retrieves the LDV word from closure c +/* retrieves the LDV word from closure c */ #define LDVW(c) (((StgClosure *)(c))->header.prof.hp.ldvw) -// Stores the creation time for closure c. -// This macro is called at the very moment of closure creation. -// -// NOTE: this initializes LDVW(c) to zero, which ensures that there -// is no conflict between retainer profiling and LDV profiling, -// because retainer profiling also expects LDVW(c) to be initialised -// to zero. -#define LDV_recordCreate(c) \ - LDVW((c)) = (era << LDV_SHIFT) | LDV_STATE_CREATE - -// Stores the last use time for closure c. -// This macro *must* be called whenever a closure is used, that is, it is -// entered. -#define LDV_recordUse(c) \ - { \ - if (era > 0) \ - LDVW((c)) = (LDVW((c)) & LDV_CREATE_MASK) | \ - era | \ - LDV_STATE_USE; \ - } - -// Macros called when a closure is entered. -// The closure is not an 'inherently used' one. -// The closure is not IND or IND_OLDGEN because neither is considered for LDV -// profiling. -#define LDV_ENTER(c) LDV_recordUse((c)) +/* + * Stores the creation time for closure c. + * This macro is called at the very moment of closure creation. + * + * NOTE: this initializes LDVW(c) to zero, which ensures that there + * is no conflict between retainer profiling and LDV profiling, + * because retainer profiling also expects LDVW(c) to be initialised + * to zero. + */ +#ifndef CMINUSMINUS +#define LDV_RECORD_CREATE(c) \ + LDVW((c)) = (RTS_DEREF(era) << LDV_SHIFT) | LDV_STATE_CREATE +#endif + +#ifdef CMINUSMINUS +#define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c) \ + foreign "C" LDV_recordDead_FILL_SLOP_DYNAMIC(c "ptr") +#else +#define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c) \ + LDV_recordDead_FILL_SLOP_DYNAMIC(c) +#endif -#else // !PROFILING +#else /* !PROFILING */ -#define LDV_ENTER(c) +#define LDV_RECORD_CREATE(c) /* nothing */ +#define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c) /* nothing */ -#endif // PROFILING -#endif // STGLDVPROF_H +#endif /* PROFILING */ +#endif /* STGLDVPROF_H */