VM: better start_gc_again() code
parent
c42c7aabbc
commit
8899914697
11
vm/gc.cpp
11
vm/gc.cpp
|
@ -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;
|
||||||
break;
|
} else if (current_gc->op == collect_aging_op) {
|
||||||
case 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;
|
||||||
break;
|
} else {
|
||||||
default:
|
|
||||||
// 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.
|
||||||
critical_error("in start_gc_again, bad GC op", current_gc->op);
|
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue