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