]> gitweb.factorcode.org Git - factor.git/blob - vm/aging_collector.cpp
vm: remove crummy old GC stats, split off free list code, clean up various other...
[factor.git] / vm / aging_collector.cpp
1 #include "master.hpp"
2
3 namespace factor
4 {
5
6 aging_collector::aging_collector(factor_vm *parent_) :
7         copying_collector<aging_space,aging_policy>(
8                 parent_,
9                 parent_->data->aging,
10                 aging_policy(parent_)) {}
11
12 void factor_vm::collect_aging()
13 {
14         /* Promote objects referenced from tenured space to tenured space, copy
15         everything else to the aging semi-space, and reset the nursery pointer. */
16         {
17                 /* Change the op so that if we fail here, we proceed to a full
18                 tenured collection. We are collecting to tenured space, and
19                 cards were unmarked, so we can't proceed with a to_tenured
20                 collection. */
21                 current_gc->op = collect_to_tenured_op;
22
23                 to_tenured_collector collector(this);
24                 collector.trace_cards(data->tenured,
25                         card_points_to_aging,
26                         simple_unmarker(card_mark_mask));
27                 collector.tenure_reachable_objects();
28         }
29         {
30                 /* If collection fails here, do a to_tenured collection. */
31                 current_gc->op = collect_aging_op;
32
33                 std::swap(data->aging,data->aging_semispace);
34                 data->reset_generation(data->aging);
35
36                 aging_collector collector(this);
37
38                 collector.trace_roots();
39                 collector.trace_contexts();
40                 collector.trace_code_heap_roots(&code->points_to_aging);
41                 collector.cheneys_algorithm();
42
43                 update_code_heap_for_minor_gc(&code->points_to_aging);
44
45                 data->reset_generation(&nursery);
46                 code->points_to_nursery.clear();
47         }
48 }
49
50 }