]> gitweb.factorcode.org Git - factor.git/blob - vm/gc.hpp
VM: big refactoring removing the gc_workhorse
[factor.git] / vm / gc.hpp
1 namespace factor {
2
3 struct must_start_gc_again {
4 };
5
6 enum gc_op {
7   collect_nursery_op,
8   collect_aging_op,
9   collect_to_tenured_op,
10   collect_full_op,
11   collect_compact_op,
12   collect_growing_heap_op
13 };
14
15 struct gc_event {
16   gc_op op;
17   data_heap_room data_heap_before;
18   allocator_room code_heap_before;
19   data_heap_room data_heap_after;
20   allocator_room code_heap_after;
21   cell cards_scanned;
22   cell decks_scanned;
23   cell code_blocks_scanned;
24   uint64_t start_time;
25   cell total_time;
26   cell card_scan_time;
27   cell code_scan_time;
28   cell data_sweep_time;
29   cell code_sweep_time;
30   cell compaction_time;
31   uint64_t temp_time;
32
33   gc_event(gc_op op, factor_vm* parent);
34   void reset_timer();
35   void ended_card_scan(cell cards_scanned_, cell decks_scanned_);
36   void ended_code_scan(cell code_blocks_scanned_);
37   void ended_data_sweep();
38   void ended_code_sweep();
39   void ended_compaction();
40   void ended_gc(factor_vm* parent);
41 };
42
43 struct gc_state {
44   gc_op op;
45   uint64_t start_time;
46   gc_event* event;
47
48   gc_state(gc_op op, factor_vm* parent);
49   ~gc_state();
50   void start_again(gc_op op_, factor_vm* parent);
51 };
52
53 }