update submodules for GHC.HetMet.GArrow -> Control.GArrow renaming
[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 #include "BeginPrivate.h"
18
19 void initRetainerProfiling ( void );
20 void endRetainerProfiling  ( void );
21 void retainerProfile       ( void );
22 void resetStaticObjectForRetainerProfiling( StgClosure *static_objects );
23
24 extern StgWord flip;
25
26 // extract the retainer set field from c
27 #define RSET(c)   ((c)->header.prof.hp.rs)
28
29 #define isRetainerSetFieldValid(c) \
30   ((((StgWord)(c)->header.prof.hp.rs & 1) ^ flip) == 0)
31
32 static inline RetainerSet *
33 retainerSetOf( StgClosure *c )
34 {
35     ASSERT( isRetainerSetFieldValid(c) );
36     // StgWord has the same size as pointers, so the following type
37     // casting is okay.
38     return (RetainerSet *)((StgWord)RSET(c) ^ flip);
39 }
40
41 // Used by Storage.c:memInventory()
42 #ifdef DEBUG
43 extern lnat retainerStackBlocks ( void );
44 #endif
45
46 #include "EndPrivate.h"
47
48 #endif /* PROFILING */
49
50 #endif /* RETAINERPROFILE_H */