VM: uppercasing gc_op

char-rename
Björn Lindqvist 2016-10-19 09:05:15 +02:00
parent df171b0485
commit f147bd4404
8 changed files with 48 additions and 48 deletions

View File

@ -108,12 +108,12 @@ PRIVATE>
: gc-op-string ( op -- string ) : gc-op-string ( op -- string )
{ {
{ collect-nursery-op [ "Copying from nursery" ] } { COLLECT-NURSERY-OP [ "Copying from nursery" ] }
{ collect-aging-op [ "Copying from aging" ] } { COLLECT-AGING-OP [ "Copying from aging" ] }
{ collect-to-tenured-op [ "Copying to tenured" ] } { COLLECT-TO-TENURED-OP [ "Copying to tenured" ] }
{ collect-full-op [ "Mark and sweep" ] } { COLLECT-FULL-OP [ "Mark and sweep" ] }
{ collect-compact-op [ "Mark and compact" ] } { COLLECT-COMPACT-OP [ "Mark and compact" ] }
{ collect-growing-heap-op [ "Grow heap" ] } { COLLECT-GROWING-DATA-HEAP-OP [ "Grow heap" ] }
} case ; } case ;
: (space-occupied) ( data-heap-room code-heap-room -- n ) : (space-occupied) ( data-heap-room code-heap-room -- n )

View File

@ -54,12 +54,12 @@ STRUCT: vm
{ retainstack-size cell_t } { retainstack-size cell_t }
{ callstack-size cell_t } ; { callstack-size cell_t } ;
CONSTANT: collect-nursery-op 0 CONSTANT: COLLECT-NURSERY-OP 0
CONSTANT: collect-aging-op 1 CONSTANT: COLLECT-AGING-OP 1
CONSTANT: collect-to-tenured-op 2 CONSTANT: COLLECT-TO-TENURED-OP 2
CONSTANT: collect-full-op 3 CONSTANT: COLLECT-FULL-OP 3
CONSTANT: collect-compact-op 4 CONSTANT: COLLECT-COMPACT-OP 4
CONSTANT: collect-growing-heap-op 5 CONSTANT: COLLECT-GROWING-DATA-HEAP-OP 5
STRUCT: copying-sizes STRUCT: copying-sizes
{ size cell_t } { size cell_t }

View File

@ -41,7 +41,7 @@ void factor_vm::collect_aging() {
// everything else to the aging semi-space, and reset the nursery pointer. // 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. // 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> slot_visitor<from_tenured_refs_copier>
visitor(this, from_tenured_refs_copier(data->tenured, &mark_stack)); visitor(this, from_tenured_refs_copier(data->tenured, &mark_stack));
@ -64,7 +64,7 @@ void factor_vm::collect_aging() {
} }
{ {
// If collection fails here, do a to_tenured collection. // 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); std::swap(data->aging, data->aging_semispace);
data->reset_aging(); data->reset_aging();

View File

@ -46,7 +46,7 @@ inline object* factor_vm::allot_large_object(cell type, cell size) {
// If it still won't fit, grow the heap // If it still won't fit, grow the heap
if (!data->tenured->can_allot_p(required_free)) { 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); object* obj = data->tenured->allot(size);

View File

@ -97,8 +97,8 @@ void factor_vm::collect_compact_impl() {
const code_block* code_finger = (code_block*)code->allocator->start; const code_block* code_finger = (code_block*)code->allocator->start;
{ {
compaction_fixup fixup(data_forwarding_map, code_forwarding_map, &data_finger, compaction_fixup fixup(data_forwarding_map, code_forwarding_map,
&code_finger); &data_finger, &code_finger);
slot_visitor<compaction_fixup> forwarder(this, fixup); slot_visitor<compaction_fixup> forwarder(this, fixup);
forwarder.visit_uninitialized_code_blocks(); forwarder.visit_uninitialized_code_blocks();
@ -150,9 +150,9 @@ void factor_vm::collect_compact() {
collect_mark_impl(); collect_mark_impl();
collect_compact_impl(); collect_compact_impl();
// Compaction did not free up enough memory. Grow the data heap.
if (data->high_fragmentation_p()) { 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); collect_growing_data_heap(0);
} }

View File

@ -111,12 +111,12 @@ void factor_vm::collect_full() {
if (data->low_memory_p()) { if (data->low_memory_p()) {
// Full GC did not free up enough memory. Grow the heap. // 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); collect_growing_data_heap(0);
} else if (data->high_fragmentation_p()) { } else if (data->high_fragmentation_p()) {
// Enough free memory, but it is not contiguous. Perform a // Enough free memory, but it is not contiguous. Perform a
// compaction. // compaction.
set_current_gc_op(collect_compact_op); set_current_gc_op(COLLECT_COMPACT_OP);
collect_compact_impl(); collect_compact_impl();
} }

View File

@ -65,15 +65,15 @@ gc_state::~gc_state() {
} }
void factor_vm::start_gc_again() { 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 // Nursery collection can fail if aging does not have enough
// free space to fit all live objects from nursery. // free space to fit all live objects from nursery.
current_gc->op = collect_aging_op; current_gc->op = COLLECT_AGING_OP;
} else if (current_gc->op == collect_aging_op) { } else if (current_gc->op == COLLECT_AGING_OP) {
// Aging collection can fail if the aging semispace cannot fit // Aging collection can fail if the aging semispace cannot fit
// all the live objects from the other aging semispace and the // all the live objects from the other aging semispace and the
// nursery. // nursery.
current_gc->op = collect_to_tenured_op; current_gc->op = COLLECT_TO_TENURED_OP;
} else { } else {
// Nothing else should fail mid-collection due to insufficient // Nothing else should fail mid-collection due to insufficient
// space in the target generation. // space in the target generation.
@ -110,34 +110,34 @@ void factor_vm::gc(gc_op op, cell requested_size) {
current_gc->event->op = current_gc->op; current_gc->event->op = current_gc->op;
switch (current_gc->op) { switch (current_gc->op) {
case collect_nursery_op: case COLLECT_NURSERY_OP:
collect_nursery(); collect_nursery();
break; break;
case collect_aging_op: case COLLECT_AGING_OP:
// We end up here if the above fails. // We end up here if the above fails.
collect_aging(); collect_aging();
if (data->high_fragmentation_p()) { if (data->high_fragmentation_p()) {
// Change GC op so that if we fail again, we crash. // 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(); collect_full();
} }
break; break;
case collect_to_tenured_op: case COLLECT_TO_TENURED_OP:
// We end up here if the above fails. // We end up here if the above fails.
collect_to_tenured(); collect_to_tenured();
if (data->high_fragmentation_p()) { if (data->high_fragmentation_p()) {
// Change GC op so that if we fail again, we crash. // 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(); collect_full();
} }
break; break;
case collect_full_op: case COLLECT_FULL_OP:
collect_full(); collect_full();
break; break;
case collect_compact_op: case COLLECT_COMPACT_OP:
collect_compact(); collect_compact();
break; break;
case collect_growing_data_heap_op: case COLLECT_GROWING_DATA_HEAP_OP:
collect_growing_data_heap(requested_size); collect_growing_data_heap(requested_size);
break; break;
default: default:
@ -169,15 +169,15 @@ void factor_vm::gc(gc_op op, cell requested_size) {
} }
void factor_vm::primitive_minor_gc() { void factor_vm::primitive_minor_gc() {
gc(collect_nursery_op, 0); gc(COLLECT_NURSERY_OP, 0);
} }
void factor_vm::primitive_full_gc() { void factor_vm::primitive_full_gc() {
gc(collect_full_op, 0); gc(COLLECT_FULL_OP, 0);
} }
void factor_vm::primitive_compact_gc() { void factor_vm::primitive_compact_gc() {
gc(collect_compact_op, 0); gc(COLLECT_COMPACT_OP, 0);
} }
void factor_vm::primitive_enable_gc_events() { void factor_vm::primitive_enable_gc_events() {

View File

@ -4,12 +4,12 @@ struct must_start_gc_again {
}; };
enum gc_op { enum gc_op {
collect_nursery_op, COLLECT_NURSERY_OP,
collect_aging_op, COLLECT_AGING_OP,
collect_to_tenured_op, COLLECT_TO_TENURED_OP,
collect_full_op, COLLECT_FULL_OP,
collect_compact_op, COLLECT_COMPACT_OP,
collect_growing_data_heap_op COLLECT_GROWING_DATA_HEAP_OP
}; };
struct gc_event { struct gc_event {