/home/travis/build/MoarVM/MoarVM/src/gc/collect.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* The maximum size of the nursery area. Note that since it's semi-space |
2 | | * copying, we could actually have double this amount allocated per thread. */ |
3 | 1.69k | #define MVM_NURSERY_SIZE 4194304 |
4 | | |
5 | | /* The nursery size threads other than the main thread start out with. If |
6 | | * they fill it and trigger a GC run, then it is doubled. If they are |
7 | | * pulled into a GC run without having themselves filled the nursery, it |
8 | | * does not grow. If MVM_NURSERY_SIZE is smaller than this value (as is |
9 | | * often done for GC stress testing) then this value will be ignored. */ |
10 | 346 | #define MVM_NURSERY_THREAD_START 131072 |
11 | | |
12 | | /* How many bytes should have been promoted into gen2 before we decide to |
13 | | * do a full GC run? This defaults to a percentage of the resident set, with |
14 | | * a minimum to avoid small processes doing a load of gen2 collections. */ |
15 | 0 | #define MVM_GC_GEN2_THRESHOLD_PERCENT 20 |
16 | 338 | #define MVM_GC_GEN2_THRESHOLD_MINIMUM (20 * 1024 * 1024) |
17 | | |
18 | | /* What things should be processed in this GC run? */ |
19 | | typedef enum { |
20 | | /* Everything, including the instance-wide roots. If we have many |
21 | | * active threads, only one thread will be set to do this. */ |
22 | | MVMGCWhatToDo_All = 0, |
23 | | |
24 | | /* Everything except the instance-wide roots. */ |
25 | | MVMGCWhatToDo_NoInstance = 1, |
26 | | |
27 | | /* Only process the in-tray of work given by other threads. */ |
28 | | MVMGCWhatToDo_InTray = 2, |
29 | | |
30 | | /* Only process the finalizing list. */ |
31 | | MVMGCWhatToDo_Finalizing = 4 |
32 | | } MVMGCWhatToDo; |
33 | | |
34 | | /* What generation(s) to collect? */ |
35 | | typedef enum { |
36 | | /* Only the nursery. */ |
37 | | MVMGCGenerations_Nursery = 0, |
38 | | |
39 | | /* Both the nursery and generation 2. */ |
40 | | MVMGCGenerations_Both = 1 |
41 | | } MVMGCGenerations; |
42 | | |
43 | | /* The number of items we must reach in a bucket of work before passing it |
44 | | * off to the next thread. (Power of 2, minus 2, is a decent choice.) */ |
45 | 12.1k | #define MVM_GC_PASS_WORK_SIZE 62 |
46 | | |
47 | | /* Represents a piece of work (some addresses to visit) that have been passed |
48 | | * from one thread doing GC to another thread doing GC. */ |
49 | | struct MVMGCPassedWork { |
50 | | MVMCollectable **items[MVM_GC_PASS_WORK_SIZE]; |
51 | | MVMGCPassedWork *next; |
52 | | MVMint32 num_items; |
53 | | }; |
54 | | |
55 | | /* Functions. */ |
56 | | MVMuint32 MVM_gc_new_thread_nursery_size(MVMInstance *i); |
57 | | void MVM_gc_collect(MVMThreadContext *tc, MVMuint8 what_to_do, MVMuint8 gen); |
58 | | void MVM_gc_collect_free_nursery_uncopied(MVMThreadContext *tc, void *limit); |
59 | | void MVM_gc_collect_free_gen2_unmarked(MVMThreadContext *tc, MVMint32 global_destruction); |
60 | | void MVM_gc_mark_collectable(MVMThreadContext *tc, MVMGCWorklist *worklist, MVMCollectable *item); |
61 | | void MVM_gc_collect_free_stables(MVMThreadContext *tc); |