VM: better start_gc_again() code

char-rename
Björn Lindqvist 2016-09-28 05:20:12 +02:00
parent c42c7aabbc
commit 8899914697
1 changed files with 13 additions and 18 deletions

View File

@ -72,23 +72,19 @@ void factor_vm::end_gc() {
} }
void factor_vm::start_gc_again() { void factor_vm::start_gc_again() {
switch (current_gc->op) { if (current_gc->op == collect_nursery_op) {
case 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) {
break; // Aging collection can fail if the aging semispace cannot fit
case collect_aging_op: // all the live objects from the other aging semispace and the
// Aging collection can fail if the aging semispace cannot fit // nursery.
// all the live objects from the other aging semispace and the current_gc->op = collect_to_tenured_op;
// nursery. } else {
current_gc->op = collect_to_tenured_op; // Nothing else should fail mid-collection due to insufficient
break; // space in the target generation.
default: critical_error("in start_gc_again, bad GC op", current_gc->op);
// Nothing else should fail mid-collection due to insufficient
// space in the target generation.
critical_error("in start_gc_again, bad GC op", current_gc->op);
break;
} }
} }
@ -161,7 +157,6 @@ void factor_vm::gc(gc_op op, cell requested_size) {
catch (const must_start_gc_again&) { catch (const must_start_gc_again&) {
// We come back here if the target generation is full. // We come back here if the target generation is full.
start_gc_again(); start_gc_again();
continue;
} }
} }