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 )
{
{ 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 )
@ -203,12 +203,12 @@ SYMBOL: gc-events
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 } ;

View File

@ -54,12 +54,12 @@ STRUCT: vm
{ 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 }

View File

@ -41,7 +41,7 @@ void factor_vm::collect_aging() {
// 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));
@ -64,7 +64,7 @@ void factor_vm::collect_aging() {
}
{
// 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();

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 (!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);

View File

@ -97,8 +97,8 @@ void factor_vm::collect_compact_impl() {
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();
@ -150,9 +150,9 @@ void factor_vm::collect_compact() {
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);
}

View File

@ -111,12 +111,12 @@ void factor_vm::collect_full() {
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();
}

View File

@ -65,15 +65,15 @@ gc_state::~gc_state() {
}
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.
@ -110,34 +110,34 @@ void factor_vm::gc(gc_op op, cell requested_size) {
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:
@ -169,15 +169,15 @@ void factor_vm::gc(gc_op op, cell requested_size) {
}
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() {

View File

@ -4,12 +4,12 @@ struct must_start_gc_again {
};
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 {