e746f092e503b32f7b2d66de98ec4464b38b279e
[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 void GarbageCollect(rtsBool force_major_gc, nat gc_type, Capability *cap);
18
19 typedef void (*evac_fn)(void *user, StgClosure **root);
20
21 StgClosure * isAlive      ( StgClosure *p );
22 void         markCAFs     ( evac_fn evac, void *user );
23
24 extern nat N;
25 extern rtsBool major_gc;
26
27 extern bdescr *mark_stack_bdescr;
28 extern StgPtr *mark_stack;
29 extern StgPtr *mark_sp;
30 extern StgPtr *mark_splim;
31
32 extern rtsBool mark_stack_overflowed;
33 extern bdescr *oldgen_scan_bd;
34 extern StgPtr  oldgen_scan;
35
36 extern long copied;
37
38 extern rtsBool work_stealing;
39
40 #ifdef DEBUG
41 extern nat mutlist_MUTVARS, mutlist_MUTARRS, mutlist_MVARS, mutlist_OTHERS;
42 #endif
43
44 #if defined(PROF_SPIN) && defined(THREADED_RTS)
45 extern StgWord64 whitehole_spin;
46 #endif
47
48 void gcWorkerThread (Capability *cap);
49 void initGcThreads (void);
50 void freeGcThreads (void);
51
52 #if defined(THREADED_RTS)
53 void waitForGcThreads (Capability *cap);
54 void releaseGCThreads (Capability *cap);
55 #endif
56
57 #define WORK_UNIT_WORDS 128
58
59 #endif /* SM_GC_H */