Fold template-haskell.git into ghc.git (re #8545)
[ghc.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://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC
11 *
12 * ---------------------------------------------------------------------------*/
13
14 #ifndef SM_GC_H
15 #define SM_GC_H
16
17 #include "BeginPrivate.h"
18
19 void GarbageCollect (rtsBool force_major_gc,
20 rtsBool do_heap_census,
21 nat gc_type, Capability *cap);
22
23 typedef void (*evac_fn)(void *user, StgClosure **root);
24
25 StgClosure * isAlive ( StgClosure *p );
26 void markCAFs ( evac_fn evac, void *user );
27
28 extern nat N;
29 extern rtsBool major_gc;
30
31 extern bdescr *mark_stack_bd;
32 extern bdescr *mark_stack_top_bd;
33 extern StgPtr mark_sp;
34
35 extern long copied;
36
37 extern rtsBool work_stealing;
38
39 #ifdef DEBUG
40 extern nat mutlist_MUTVARS, mutlist_MUTARRS, mutlist_MVARS, mutlist_OTHERS,
41 mutlist_TVAR,
42 mutlist_TVAR_WATCH_QUEUE,
43 mutlist_TREC_CHUNK,
44 mutlist_TREC_HEADER,
45 mutlist_ATOMIC_INVARIANT,
46 mutlist_INVARIANT_CHECK_QUEUE;
47 #endif
48
49 #if defined(PROF_SPIN) && defined(THREADED_RTS)
50 extern StgWord64 whitehole_spin;
51 #endif
52
53 void gcWorkerThread (Capability *cap);
54 void initGcThreads (nat from, nat to);
55 void freeGcThreads (void);
56
57 #if defined(THREADED_RTS)
58 void waitForGcThreads (Capability *cap);
59 void releaseGCThreads (Capability *cap);
60 #endif
61
62 #define WORK_UNIT_WORDS 128
63
64 #include "EndPrivate.h"
65
66 #endif /* SM_GC_H */