Mark/compact: use a dynamically-sized mark stack, and don't do linear scan
[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_bd;
30 extern bdescr *mark_stack_top_bd;
31 extern StgPtr mark_sp;
32 extern StgPtr mark_splim;
33
34 extern long copied;
35
36 extern rtsBool work_stealing;
37
38 #ifdef DEBUG
39 extern nat mutlist_MUTVARS, mutlist_MUTARRS, mutlist_MVARS, mutlist_OTHERS;
40 #endif
41
42 #if defined(PROF_SPIN) && defined(THREADED_RTS)
43 extern StgWord64 whitehole_spin;
44 #endif
45
46 void gcWorkerThread (Capability *cap);
47 void initGcThreads (void);
48 void freeGcThreads (void);
49
50 #if defined(THREADED_RTS)
51 void waitForGcThreads (Capability *cap);
52 void releaseGCThreads (Capability *cap);
53 #endif
54
55 #define WORK_UNIT_WORDS 128
56
57 END_RTS_PRIVATE
58
59 #endif /* SM_GC_H */