gc.c (mrb_field_write_barrier): change the condition

Minor GC may be suspended with the MRB_GC_STATE_SWEEP.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2023-03-13 18:52:03 +09:00
parent ccca6ec458
commit 8d1192f8a2
+3 -4
View File
@@ -1349,12 +1349,11 @@ mrb_field_write_barrier(mrb_state *mrb, struct RBasic *obj, struct RBasic *value
mrb_assert(gc->state == MRB_GC_STATE_MARK || (!is_dead(gc, value) && !is_dead(gc, obj)));
mrb_assert(is_generational(gc) || gc->state != MRB_GC_STATE_ROOT);
if (is_generational(gc) || gc->state == MRB_GC_STATE_MARK) {
add_gray_list(mrb, gc, value);
if (gc->state == MRB_GC_STATE_SWEEP) {
paint_partial_white(gc, obj); /* for never write barriers */
}
else {
mrb_assert(gc->state == MRB_GC_STATE_SWEEP);
paint_partial_white(gc, obj); /* for never write barriers */
add_gray_list(mrb, gc, value);
}
}