]> gitweb.factorcode.org Git - factor.git/blob - vm/gc.hpp
audio.engine.test: cleanup using
[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_DATA_HEAP_OP
13 };
14
15 // These are the phases of the gc cycles we record the times of.
16 enum gc_phase {
17   PHASE_CARD_SCAN,
18   PHASE_CODE_SCAN,
19   PHASE_DATA_SWEEP,
20   PHASE_CODE_SWEEP,
21   PHASE_DATA_COMPACTION,
22   PHASE_MARKING
23 };
24
25 struct gc_event {
26   gc_op op;
27   data_heap_room data_heap_before;
28   allocator_room code_heap_before;
29   data_heap_room data_heap_after;
30   allocator_room code_heap_after;
31   cell cards_scanned;
32   cell decks_scanned;
33   cell code_blocks_scanned;
34   uint64_t start_time;
35   cell total_time;
36   cell times[6];
37   uint64_t temp_time;
38
39   gc_event(gc_op op, factor_vm* parent);
40   void reset_timer();
41   void ended_phase(gc_phase phase);
42   void ended_gc(factor_vm* parent);
43 };
44
45 struct gc_state {
46   gc_op op;
47   uint64_t start_time;
48   gc_event* event;
49
50   gc_state(gc_op op, factor_vm* parent);
51   ~gc_state();
52   void start_again(gc_op op_, factor_vm* parent);
53 };
54
55 }