blob: c5d5f6ac81fd177595e6bc6aaaf3cbc09ee21631 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/* -----------------------------------------------------------------------------
*
* (c) The GHC Team 1998-2008
*
* Generational garbage collector
*
* Documentation on the architecture of the Garbage Collector can be
* found in the online commentary:
*
* https://gitlab.haskell.org/ghc/ghc/wikis/commentary/rts/storage/gc
*
* ---------------------------------------------------------------------------*/
#pragma once
#include "BeginPrivate.h"
#include "HeapAlloc.h"
void GarbageCollect (uint32_t collect_gen,
bool do_heap_census,
bool deadlock_detect,
uint32_t gc_type,
Capability *cap,
bool idle_cap[]);
typedef void (*evac_fn)(void *user, StgClosure **root);
StgClosure * isAlive ( StgClosure *p );
void markCAFs ( evac_fn evac, void *user );
bool doIdleGCWork(Capability *cap, bool all);
extern uint32_t N;
extern bool major_gc;
/* See Note [Deadlock detection under nonmoving collector]. */
extern bool deadlock_detect_gc;
extern bdescr *mark_stack_bd;
extern bdescr *mark_stack_top_bd;
extern StgPtr mark_sp;
extern bool work_stealing;
#if defined(PROF_SPIN) && defined(THREADED_RTS)
extern volatile StgWord64 whitehole_gc_spin;
extern volatile StgWord64 waitForGcThreads_spin;
extern volatile StgWord64 waitForGcThreads_yield;
#endif
// mutable list scavenging statistics
#if defined(DEBUG)
typedef struct {
StgWord n_MUTVAR;
StgWord n_MUTARR;
StgWord n_MVAR;
StgWord n_TVAR;
StgWord n_TREC_CHUNK;
StgWord n_TVAR_WATCH_QUEUE;
StgWord n_TREC_HEADER;
StgWord n_OTHERS;
} MutListScavStats;
extern MutListScavStats mutlist_scav_stats;
void zeroMutListScavStats(MutListScavStats *src);
void addMutListScavStats(const MutListScavStats *src,
MutListScavStats *dest);
#endif /* DEBUG */
void gcWorkerThread (Capability *cap);
void initGcThreads (uint32_t from, uint32_t to);
void freeGcThreads (void);
void resizeGenerations (void);
#if defined(THREADED_RTS)
void waitForGcThreads (Capability *cap, bool idle_cap[]);
void releaseGCThreads (Capability *cap, bool idle_cap[]);
#endif
#define WORK_UNIT_WORDS 128
#include "EndPrivate.h"
|