Allow the number of capabilities to be increased at runtime (#3729)
[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://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 #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 #endif
42
43 #if defined(PROF_SPIN) && defined(THREADED_RTS)
44 extern StgWord64 whitehole_spin;
45 #endif
46
47 void gcWorkerThread (Capability *cap);
48 void initGcThreads (nat from, nat to);
49 void freeGcThreads (void);
50
51 #if defined(THREADED_RTS)
52 void waitForGcThreads (Capability *cap);
53 void releaseGCThreads (Capability *cap);
54 #endif
55
56 #define WORK_UNIT_WORDS 128
57
58 #include "EndPrivate.h"
59
60 #endif /* SM_GC_H */