]> gitweb.factorcode.org Git - factor.git/blob - vm/gc.hpp
vm: make compaction its own gc_op
[factor.git] / vm / gc.hpp
1 namespace factor
2 {
3
4 enum gc_op {
5         collect_nursery_op,
6         collect_aging_op,
7         collect_to_tenured_op,
8         collect_full_op,
9         collect_compact_op,
10         collect_growing_heap_op
11 };
12
13 /* statistics */
14 struct generation_statistics {
15         cell collections;
16         u64 gc_time;
17         u64 max_gc_time;
18         cell object_count;
19         u64 bytes_copied;
20 };
21
22 struct gc_statistics {
23         generation_statistics nursery_stats;
24         generation_statistics aging_stats;
25         generation_statistics full_stats;
26         u64 cards_scanned;
27         u64 decks_scanned;
28         u64 card_scan_time;
29         u64 code_blocks_scanned;
30 };
31
32 struct gc_state {
33         gc_op op;
34         u64 start_time;
35         jmp_buf gc_unwind;
36
37         explicit gc_state(gc_op op_);
38         ~gc_state();
39 };
40
41 VM_C_API void inline_gc(cell *gc_roots_base, cell gc_roots_size, factor_vm *parent);
42
43 }