EventLog: Factor out ensureRoomFor*Event
[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 #include "HeapAlloc.h"
20
21 void GarbageCollect (rtsBool force_major_gc,
22 rtsBool do_heap_census,
23 nat gc_type, Capability *cap);
24
25 typedef void (*evac_fn)(void *user, StgClosure **root);
26
27 StgClosure * isAlive ( StgClosure *p );
28 void markCAFs ( evac_fn evac, void *user );
29
30 extern nat N;
31 extern rtsBool major_gc;
32
33 extern bdescr *mark_stack_bd;
34 extern bdescr *mark_stack_top_bd;
35 extern StgPtr mark_sp;
36
37 extern long copied;
38
39 extern rtsBool work_stealing;
40
41 #ifdef DEBUG
42 extern nat mutlist_MUTVARS, mutlist_MUTARRS, mutlist_MVARS, mutlist_OTHERS,
43 mutlist_TVAR,
44 mutlist_TVAR_WATCH_QUEUE,
45 mutlist_TREC_CHUNK,
46 mutlist_TREC_HEADER,
47 mutlist_ATOMIC_INVARIANT,
48 mutlist_INVARIANT_CHECK_QUEUE;
49 #endif
50
51 #if defined(PROF_SPIN) && defined(THREADED_RTS)
52 extern StgWord64 whitehole_spin;
53 #endif
54
55 void gcWorkerThread (Capability *cap);
56 void initGcThreads (nat from, nat to);
57 void freeGcThreads (void);
58
59 #if defined(THREADED_RTS)
60 void waitForGcThreads (Capability *cap);
61 void releaseGCThreads (Capability *cap);
62 #endif
63
64 #define WORK_UNIT_WORDS 128
65
66 #include "EndPrivate.h"
67
68 #endif /* SM_GC_H */