RTS tidyup sweep, first phase
[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 #ifdef THREADED_RTS
45 extern SpinLock gc_alloc_block_sync;
46 #endif
47
48 #if defined(PROF_SPIN) && defined(THREADED_RTS)
49 extern StgWord64 whitehole_spin;
50 #endif
51
52 void gcWorkerThread (Capability *cap);
53 void initGcThreads (void);
54 void freeGcThreads (void);
55
56 #if defined(THREADED_RTS)
57 void waitForGcThreads (Capability *cap);
58 void releaseGCThreads (Capability *cap);
59 #endif
60
61 #define WORK_UNIT_WORDS 128
62
63 #endif /* SM_GC_H */