factor/vm/aging_collector.cpp

51 lines
1.4 KiB
C++
Raw Normal View History

#include "master.hpp"
namespace factor {
void factor_vm::collect_aging() {
/* Promote objects referenced from tenured space to tenured space, copy
everything else to the aging semi-space, and reset the nursery pointer. */
{
/* Change the op so that if we fail here, an assertion will be
raised. */
current_gc->op = collect_to_tenured_op;
to_tenured_collector collector(this);
gc_event* event = current_gc->event;
if (event)
event->started_card_scan();
collector.trace_cards(data->tenured, card_points_to_aging, 0xff);
if (event)
event->ended_card_scan(collector.cards_scanned, collector.decks_scanned);
if (event)
event->started_code_scan();
collector.trace_code_heap_roots(&code->points_to_aging);
if (event)
event->ended_code_scan(collector.code_blocks_scanned);
collector.visitor.visit_mark_stack(&mark_stack);
}
{
/* If collection fails here, do a to_tenured collection. */
current_gc->op = collect_aging_op;
std::swap(data->aging, data->aging_semispace);
data->reset_aging();
copying_collector<aging_space, aging_policy> collector(this,
this->data->aging,
aging_policy(this));
collector.visitor.visit_all_roots();
collector.cheneys_algorithm();
2009-10-21 20:41:54 -04:00
data->reset_nursery();
code->clear_remembered_set();
}
}
}