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
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;
/* 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()
{
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);
};
}
};
-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);
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();
}
}
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();
void factor_vm::collect_to_tenured()
{
+ /* Copy live objects from aging space to tenured space. */
to_tenured_collector collector(this);
collector.trace_roots();
struct to_tenured_collector : copying_collector<tenured_space,to_tenured_policy> {
to_tenured_collector(factor_vm *myvm_);
- void go();
};
}
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);