: gc-op-string ( op -- string )
{
- { collect-nursery-op [ "Copying from nursery" ] }
- { collect-aging-op [ "Copying from aging" ] }
- { collect-to-tenured-op [ "Copying to tenured" ] }
- { collect-full-op [ "Mark and sweep" ] }
- { collect-compact-op [ "Mark and compact" ] }
- { collect-growing-heap-op [ "Grow heap" ] }
+ { COLLECT-NURSERY-OP [ "Copying from nursery" ] }
+ { COLLECT-AGING-OP [ "Copying from aging" ] }
+ { COLLECT-TO-TENURED-OP [ "Copying to tenured" ] }
+ { COLLECT-FULL-OP [ "Mark and sweep" ] }
+ { COLLECT-COMPACT-OP [ "Mark and compact" ] }
+ { COLLECT-GROWING-DATA-HEAP-OP [ "Grow heap" ] }
} case ;
: (space-occupied) ( data-heap-room code-heap-room -- n )
SINGLETONS: +unoptimized+ +optimized+ +profiling+ +pic+ ;
TUPLE: code-block
-{ owner read-only }
-{ parameters read-only }
-{ relocation read-only }
-{ type read-only }
-{ size read-only }
-{ entry-point read-only } ;
+ { owner read-only }
+ { parameters read-only }
+ { relocation read-only }
+ { type read-only }
+ { size read-only }
+ { entry-point read-only } ;
TUPLE: code-blocks { blocks groups } { cache hashtable } ;
{ retainstack-size cell_t }
{ callstack-size cell_t } ;
-CONSTANT: collect-nursery-op 0
-CONSTANT: collect-aging-op 1
-CONSTANT: collect-to-tenured-op 2
-CONSTANT: collect-full-op 3
-CONSTANT: collect-compact-op 4
-CONSTANT: collect-growing-heap-op 5
+CONSTANT: COLLECT-NURSERY-OP 0
+CONSTANT: COLLECT-AGING-OP 1
+CONSTANT: COLLECT-TO-TENURED-OP 2
+CONSTANT: COLLECT-FULL-OP 3
+CONSTANT: COLLECT-COMPACT-OP 4
+CONSTANT: COLLECT-GROWING-DATA-HEAP-OP 5
STRUCT: copying-sizes
{ size cell_t }
// 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;
+ current_gc->op = COLLECT_TO_TENURED_OP;
slot_visitor<from_tenured_refs_copier>
visitor(this, from_tenured_refs_copier(data->tenured, &mark_stack));
}
{
// If collection fails here, do a to_tenured collection.
- current_gc->op = collect_aging_op;
+ current_gc->op = COLLECT_AGING_OP;
std::swap(data->aging, data->aging_semispace);
data->reset_aging();
// If it still won't fit, grow the heap
if (!data->tenured->can_allot_p(required_free)) {
- gc(collect_growing_data_heap_op, size);
+ gc(COLLECT_GROWING_DATA_HEAP_OP, size);
}
}
object* obj = data->tenured->allot(size);
const code_block* code_finger = (code_block*)code->allocator->start;
{
- compaction_fixup fixup(data_forwarding_map, code_forwarding_map, &data_finger,
- &code_finger);
+ compaction_fixup fixup(data_forwarding_map, code_forwarding_map,
+ &data_finger, &code_finger);
slot_visitor<compaction_fixup> forwarder(this, fixup);
forwarder.visit_uninitialized_code_blocks();
collect_mark_impl();
collect_compact_impl();
+ // Compaction did not free up enough memory. Grow the data heap.
if (data->high_fragmentation_p()) {
- // Compaction did not free up enough memory. Grow the heap.
- set_current_gc_op(collect_growing_data_heap_op);
+ set_current_gc_op(COLLECT_GROWING_DATA_HEAP_OP);
collect_growing_data_heap(0);
}
if (data->low_memory_p()) {
// Full GC did not free up enough memory. Grow the heap.
- set_current_gc_op(collect_growing_data_heap_op);
+ set_current_gc_op(COLLECT_GROWING_DATA_HEAP_OP);
collect_growing_data_heap(0);
} else if (data->high_fragmentation_p()) {
// Enough free memory, but it is not contiguous. Perform a
// compaction.
- set_current_gc_op(collect_compact_op);
+ set_current_gc_op(COLLECT_COMPACT_OP);
collect_compact_impl();
}
}
void factor_vm::start_gc_again() {
- if (current_gc->op == collect_nursery_op) {
+ if (current_gc->op == COLLECT_NURSERY_OP) {
// Nursery collection can fail if aging does not have enough
// free space to fit all live objects from nursery.
- current_gc->op = collect_aging_op;
- } else if (current_gc->op == collect_aging_op) {
+ current_gc->op = COLLECT_AGING_OP;
+ } else if (current_gc->op == COLLECT_AGING_OP) {
// Aging collection can fail if the aging semispace cannot fit
// all the live objects from the other aging semispace and the
// nursery.
- current_gc->op = collect_to_tenured_op;
+ current_gc->op = COLLECT_TO_TENURED_OP;
} else {
// Nothing else should fail mid-collection due to insufficient
// space in the target generation.
current_gc->event->op = current_gc->op;
switch (current_gc->op) {
- case collect_nursery_op:
+ case COLLECT_NURSERY_OP:
collect_nursery();
break;
- case collect_aging_op:
+ case COLLECT_AGING_OP:
// We end up here if the above fails.
collect_aging();
if (data->high_fragmentation_p()) {
// Change GC op so that if we fail again, we crash.
- set_current_gc_op(collect_full_op);
+ set_current_gc_op(COLLECT_FULL_OP);
collect_full();
}
break;
- case collect_to_tenured_op:
+ case COLLECT_TO_TENURED_OP:
// We end up here if the above fails.
collect_to_tenured();
if (data->high_fragmentation_p()) {
// Change GC op so that if we fail again, we crash.
- set_current_gc_op(collect_full_op);
+ set_current_gc_op(COLLECT_FULL_OP);
collect_full();
}
break;
- case collect_full_op:
+ case COLLECT_FULL_OP:
collect_full();
break;
- case collect_compact_op:
+ case COLLECT_COMPACT_OP:
collect_compact();
break;
- case collect_growing_data_heap_op:
+ case COLLECT_GROWING_DATA_HEAP_OP:
collect_growing_data_heap(requested_size);
break;
default:
}
void factor_vm::primitive_minor_gc() {
- gc(collect_nursery_op, 0);
+ gc(COLLECT_NURSERY_OP, 0);
}
void factor_vm::primitive_full_gc() {
- gc(collect_full_op, 0);
+ gc(COLLECT_FULL_OP, 0);
}
void factor_vm::primitive_compact_gc() {
- gc(collect_compact_op, 0);
+ gc(COLLECT_COMPACT_OP, 0);
}
void factor_vm::primitive_enable_gc_events() {
};
enum gc_op {
- collect_nursery_op,
- collect_aging_op,
- collect_to_tenured_op,
- collect_full_op,
- collect_compact_op,
- collect_growing_data_heap_op
+ COLLECT_NURSERY_OP,
+ COLLECT_AGING_OP,
+ COLLECT_TO_TENURED_OP,
+ COLLECT_FULL_OP,
+ COLLECT_COMPACT_OP,
+ COLLECT_GROWING_DATA_HEAP_OP
};
struct gc_event {