profiling build fixes
[ghc-hetmet.git] / rts / RetainerProfile.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The GHC Team, 2001
4  * Author: Sungwoo Park
5  *
6  * Retainer profiling interface.
7  *
8  * ---------------------------------------------------------------------------*/
9
10 #ifndef RETAINERPROFILE_H
11 #define RETAINERPROFILE_H
12
13 #ifdef PROFILING
14
15 #include "RetainerSet.h"
16
17 extern void  initRetainerProfiling ( void );
18 extern void  endRetainerProfiling  ( void );
19 extern void  retainerProfile       ( void );
20 extern void resetStaticObjectForRetainerProfiling( StgClosure *static_objects );
21
22 extern StgWord flip;
23
24 // extract the retainer set field from c
25 #define RSET(c)   ((c)->header.prof.hp.rs)
26
27 #define isRetainerSetFieldValid(c) \
28   ((((StgWord)(c)->header.prof.hp.rs & 1) ^ flip) == 0)
29
30 static inline RetainerSet *
31 retainerSetOf( StgClosure *c )
32 {
33     ASSERT( isRetainerSetFieldValid(c) );
34     // StgWord has the same size as pointers, so the following type
35     // casting is okay.
36     return (RetainerSet *)((StgWord)RSET(c) ^ flip);
37 }
38
39 // Used by Storage.c:memInventory()
40 #ifdef DEBUG
41 extern lnat retainerStackBlocks ( void );
42 #endif
43
44 #endif /* PROFILING */
45
46 #endif /* RETAINERPROFILE_H */