/home/travis/build/MoarVM/MoarVM/src/gc/collect.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* How big is the nursery area? Note that since it's semi-space copying, we |
2 | | * actually have double this amount allocated. Also it is per thread. (In |
3 | | * the future, we'll make this adaptive rather than a constant.) */ |
4 | 588 | #define MVM_NURSERY_SIZE 4194304 |
5 | | |
6 | | /* How many bytes should have been promoted into gen2 before we decide to |
7 | | * do a full GC run? This defaults to a percentage of the resident set, with |
8 | | * a minimum to avoid small processes doing a load of gen2 collections. */ |
9 | 0 | #define MVM_GC_GEN2_THRESHOLD_PERCENT 20 |
10 | 146 | #define MVM_GC_GEN2_THRESHOLD_MINIMUM (20 * 1024 * 1024) |
11 | | |
12 | | /* What things should be processed in this GC run? */ |
13 | | typedef enum { |
14 | | /* Everything, including the instance-wide roots. If we have many |
15 | | * active threads, only one thread will be set to do this. */ |
16 | | MVMGCWhatToDo_All = 0, |
17 | | |
18 | | /* Everything except the instance-wide roots. */ |
19 | | MVMGCWhatToDo_NoInstance = 1, |
20 | | |
21 | | /* Only process the in-tray of work given by other threads. */ |
22 | | MVMGCWhatToDo_InTray = 2, |
23 | | |
24 | | /* Only process the finalizing list. */ |
25 | | MVMGCWhatToDo_Finalizing = 4 |
26 | | } MVMGCWhatToDo; |
27 | | |
28 | | /* What generation(s) to collect? */ |
29 | | typedef enum { |
30 | | /* Only the nursery. */ |
31 | | MVMGCGenerations_Nursery = 0, |
32 | | |
33 | | /* Both the nursery and generation 2. */ |
34 | | MVMGCGenerations_Both = 1 |
35 | | } MVMGCGenerations; |
36 | | |
37 | | /* The number of items we must reach in a bucket of work before passing it |
38 | | * off to the next thread. (Power of 2, minus 2, is a decent choice.) */ |
39 | 0 | #define MVM_GC_PASS_WORK_SIZE 62 |
40 | | |
41 | | /* Represents a piece of work (some addresses to visit) that have been passed |
42 | | * from one thread doing GC to another thread doing GC. */ |
43 | | struct MVMGCPassedWork { |
44 | | MVMCollectable **items[MVM_GC_PASS_WORK_SIZE]; |
45 | | MVMGCPassedWork *next; |
46 | | MVMint32 num_items; |
47 | | }; |
48 | | |
49 | | /* Functions. */ |
50 | | void MVM_gc_collect(MVMThreadContext *tc, MVMuint8 what_to_do, MVMuint8 gen); |
51 | | void MVM_gc_collect_free_nursery_uncopied(MVMThreadContext *tc, void *limit); |
52 | | void MVM_gc_collect_free_gen2_unmarked(MVMThreadContext *tc, MVMint32 global_destruction); |
53 | | void MVM_gc_mark_collectable(MVMThreadContext *tc, MVMGCWorklist *worklist, MVMCollectable *item); |
54 | | void MVM_gc_collect_free_stables(MVMThreadContext *tc); |