f54724652d6ee954e9ddc7b6d7ee4f91237ad2e0
[ghc-hetmet.git] / includes / rts / prof / LDV.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The University of Glasgow, 2004
4  *
5  * Lag/Drag/Void profiling.
6  *
7  * ---------------------------------------------------------------------------*/
8
9 #ifndef RTS_PROF_LDV_H
10 #define RTS_PROF_LDV_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
27 #ifdef CMINUSMINUS
28
29 #define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c) \
30   foreign "C" LDV_recordDead_FILL_SLOP_DYNAMIC(c "ptr")
31
32 #else
33
34 #define LDV_RECORD_CREATE(c)   \
35   LDVW((c)) = ((StgWord)RTS_DEREF(era) << LDV_SHIFT) | LDV_STATE_CREATE
36
37 void LDV_recordDead_FILL_SLOP_DYNAMIC( StgClosure *p );
38
39 #define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c) \
40   LDV_recordDead_FILL_SLOP_DYNAMIC(c)
41
42 #endif
43
44 #else  /* !PROFILING */
45
46 #define LDV_RECORD_CREATE(c)   /* nothing */
47 #define LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(c)  /* nothing */
48
49 #endif /* PROFILING */
50
51 #endif /* STGLDVPROF_H */