4b928e9bfa18819558072132a231d833162bb295
[ghc-hetmet.git] / rts / sm / GC.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The GHC Team 1998-2008
4  *
5  * Generational garbage collector
6  *
7  * Documentation on the architecture of the Garbage Collector can be
8  * found in the online commentary:
9  * 
10  *   http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC
11  *
12  * ---------------------------------------------------------------------------*/
13
14 #ifndef SM_GC_H
15 #define SM_GC_H
16
17 BEGIN_RTS_PRIVATE
18
19 void GarbageCollect(rtsBool force_major_gc, nat gc_type, Capability *cap);
20
21 typedef void (*evac_fn)(void *user, StgClosure **root);
22
23 StgClosure * isAlive      ( StgClosure *p );
24 void         markCAFs     ( evac_fn evac, void *user );
25
26 extern nat N;
27 extern rtsBool major_gc;
28
29 extern bdescr *mark_stack_bdescr;
30 extern StgPtr *mark_stack;
31 extern StgPtr *mark_sp;
32 extern StgPtr *mark_splim;
33
34 extern rtsBool mark_stack_overflowed;
35 extern bdescr *oldgen_scan_bd;
36 extern StgPtr  oldgen_scan;
37
38 extern long copied;
39
40 extern rtsBool work_stealing;
41
42 #ifdef DEBUG
43 extern nat mutlist_MUTVARS, mutlist_MUTARRS, mutlist_MVARS, mutlist_OTHERS;
44 #endif
45
46 #if defined(PROF_SPIN) && defined(THREADED_RTS)
47 extern StgWord64 whitehole_spin;
48 #endif
49
50 void gcWorkerThread (Capability *cap);
51 void initGcThreads (void);
52 void freeGcThreads (void);
53
54 #if defined(THREADED_RTS)
55 void waitForGcThreads (Capability *cap);
56 void releaseGCThreads (Capability *cap);
57 #endif
58
59 #define WORK_UNIT_WORDS 128
60
61 END_RTS_PRIVATE
62
63 #endif /* SM_GC_H */