vm: make the code nice and pretty
parent
98a2f5152c
commit
0a3d08bc52
|
@ -12,6 +12,8 @@ aging_collector::aging_collector(factor_vm *myvm_) :
|
|||
|
||||
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, we proceed to a full
|
||||
tenured collection. We are collecting to tenured space, and
|
||||
|
|
|
@ -11,6 +11,12 @@ void code_heap::write_barrier(code_block *compiled)
|
|||
points_to_aging.insert(compiled);
|
||||
}
|
||||
|
||||
void code_heap::clear_remembered_set()
|
||||
{
|
||||
points_to_nursery.clear();
|
||||
points_to_aging.clear();
|
||||
}
|
||||
|
||||
bool code_heap::needs_fixup_p(code_block *compiled)
|
||||
{
|
||||
return needs_fixup.count(compiled) > 0;
|
||||
|
@ -224,7 +230,7 @@ void factor_vm::fixup_object_xts()
|
|||
|
||||
/* Move all free space to the end of the code heap. This is not very efficient,
|
||||
since it makes several passes over the code and data heaps, but we only ever
|
||||
do this before saving a deployed image and exiting, so performaance is not
|
||||
do this before saving a deployed image and exiting, so performance is not
|
||||
critical here */
|
||||
void factor_vm::compact_code_heap()
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ struct code_heap : heap {
|
|||
|
||||
explicit code_heap(bool secure_gc, cell size);
|
||||
void write_barrier(code_block *compiled);
|
||||
void clear_remembered_set();
|
||||
bool needs_fixup_p(code_block *compiled);
|
||||
void code_heap_free(code_block *compiled);
|
||||
};
|
||||
|
|
|
@ -123,23 +123,6 @@ struct after_full_updater {
|
|||
}
|
||||
};
|
||||
|
||||
void factor_vm::update_code_heap_for_full_gc(bool growing_data_heap)
|
||||
{
|
||||
if(growing_data_heap)
|
||||
{
|
||||
after_growing_heap_updater updater(this);
|
||||
code->free_unmarked(updater);
|
||||
}
|
||||
else
|
||||
{
|
||||
after_full_updater updater(this);
|
||||
code->free_unmarked(updater);
|
||||
}
|
||||
|
||||
code->points_to_nursery.clear();
|
||||
code->points_to_aging.clear();
|
||||
}
|
||||
|
||||
void factor_vm::collect_full_impl(bool trace_contexts_p)
|
||||
{
|
||||
full_collector collector(this);
|
||||
|
@ -159,19 +142,27 @@ void factor_vm::collect_full_impl(bool trace_contexts_p)
|
|||
|
||||
void factor_vm::collect_growing_heap(cell requested_bytes, bool trace_contexts_p)
|
||||
{
|
||||
/* Grow the data heap and copy all live objects to the new heap. */
|
||||
data_heap *old = data;
|
||||
set_data_heap(data->grow(requested_bytes));
|
||||
collect_full_impl(trace_contexts_p);
|
||||
update_code_heap_for_full_gc(true);
|
||||
delete old;
|
||||
|
||||
after_growing_heap_updater updater(this);
|
||||
code->free_unmarked(updater);
|
||||
code->clear_remembered_set();
|
||||
}
|
||||
|
||||
void factor_vm::collect_full(bool trace_contexts_p)
|
||||
{
|
||||
/* Copy all live objects to the tenured semispace. */
|
||||
std::swap(data->tenured,data->tenured_semispace);
|
||||
reset_generation(data->tenured);
|
||||
collect_full_impl(trace_contexts_p);
|
||||
update_code_heap_for_full_gc(false);
|
||||
|
||||
after_full_updater updater(this);
|
||||
code->free_unmarked(updater);
|
||||
code->clear_remembered_set();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ nursery_collector::nursery_collector(factor_vm *myvm_) :
|
|||
|
||||
void factor_vm::collect_nursery()
|
||||
{
|
||||
/* Copy live objects from the nursery (as determined by the root set and
|
||||
marked cards in aging and tenured) to aging space. */
|
||||
nursery_collector collector(this);
|
||||
|
||||
collector.trace_roots();
|
||||
|
|
|
@ -12,6 +12,7 @@ to_tenured_collector::to_tenured_collector(factor_vm *myvm_) :
|
|||
|
||||
void factor_vm::collect_to_tenured()
|
||||
{
|
||||
/* Copy live objects from aging space to tenured space. */
|
||||
to_tenured_collector collector(this);
|
||||
|
||||
collector.trace_roots();
|
||||
|
|
|
@ -15,7 +15,6 @@ struct to_tenured_policy {
|
|||
|
||||
struct to_tenured_collector : copying_collector<tenured_space,to_tenured_policy> {
|
||||
to_tenured_collector(factor_vm *myvm_);
|
||||
void go();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -238,7 +238,6 @@ struct factor_vm
|
|||
void collect_nursery();
|
||||
void collect_aging();
|
||||
void collect_to_tenured();
|
||||
void update_code_heap_for_full_gc(bool growing_data_heap);
|
||||
void collect_full_impl(bool trace_contexts_p);
|
||||
void collect_growing_heap(cell requested_bytes, bool trace_contexts_p);
|
||||
void collect_full(bool trace_contexts_p);
|
||||
|
|
Loading…
Reference in New Issue