Put debugIsOn in Util, rather than rely on it being CPPed in
[ghc-hetmet.git] / includes / StgLdvProf.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The University of Glasgow, 2004
4  *
5  * Lag/Drag/Void profiling.
6  *
7  * ---------------------------------------------------------------------------*/
8
9 #ifndef STGLDVPROF_H
10 #define STGLDVPROF_H
11
12 #ifdef PROFILING
13
14 /* retrieves the LDV word from closure c */
15 #define LDVW(c)                 (((StgClosure *)(c))->header.prof.hp.ldvw)
16
17 /*
18  * Stores the creation time for closure c. 
19  * This macro is called at the very moment of closure creation.
20  *
21  * NOTE: this initializes LDVW(c) to zero, which ensures that there
22  * is no conflict between retainer profiling and LDV profiling,
23  * because retainer profiling also expects LDVW(c) to be initialised
24  * to zero.
25  */
26 #ifndef CMINUSMINUS
27 #define LDV_RECORD_CREATE(c)   \
28   LDVW((c)) = ((StgWord)RTS_DEREF(era) << LDV_SHIFT) | LDV_STATE_CREATE
29 #endif
30
31 #ifdef CMINUSMINUS
32 #define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c) \
33   foreign "C" LDV_recordDead_FILL_SLOP_DYNAMIC(c "ptr")
34 #else
35 #define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c) \
36   LDV_recordDead_FILL_SLOP_DYNAMIC(c)
37 #endif
38
39 #else  /* !PROFILING */
40
41 #define LDV_RECORD_CREATE(c)   /* nothing */
42 #define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c)  /* nothing */
43
44 #endif /* PROFILING */
45 #endif /* STGLDVPROF_H */