gc_marks_finish: do not goto into a branch

I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.
This commit is contained in:
卜部昌平 2020-06-15 14:31:31 +09:00
Родитель e9cb092b2d
Коммит 228118482e
1 изменённых файлов: 3 добавлений и 3 удалений

6
gc.c
Просмотреть файл

@ -6459,15 +6459,15 @@ gc_marks_finish(rb_objspace_t *objspace)
if (objspace->profile.count - objspace->rgengc.last_major_gc < RVALUE_OLD_AGE) { if (objspace->profile.count - objspace->rgengc.last_major_gc < RVALUE_OLD_AGE) {
full_marking = TRUE; full_marking = TRUE;
/* do not update last_major_gc, because full marking is not done. */ /* do not update last_major_gc, because full marking is not done. */
goto increment; /* goto increment; */
} }
else { else {
gc_report(1, objspace, "gc_marks_finish: next is full GC!!)\n"); gc_report(1, objspace, "gc_marks_finish: next is full GC!!)\n");
objspace->rgengc.need_major_gc |= GPR_FLAG_MAJOR_BY_NOFREE; objspace->rgengc.need_major_gc |= GPR_FLAG_MAJOR_BY_NOFREE;
} }
} }
else { if (full_marking) {
increment: /* increment: */
gc_report(1, objspace, "gc_marks_finish: heap_set_increment!!\n"); gc_report(1, objspace, "gc_marks_finish: heap_set_increment!!\n");
heap_set_increment(objspace, heap_extend_pages(objspace, sweep_slots, total_slots)); heap_set_increment(objspace, heap_extend_pages(objspace, sweep_slots, total_slots));
heap_increment(objspace, heap); heap_increment(objspace, heap);