Assume that FL_FINALIZE is in finalizer_table

If FL_FINALIZE is set but not in finalizer_table, then rb_bug.
This commit is contained in:
Peter Zhu 2024-02-29 11:07:53 -05:00
parent f8dd2342bf
commit 4c0f0b90a4

6
gc.c
View File

@ -4043,11 +4043,15 @@ rb_gc_copy_finalizer(VALUE dest, VALUE obj)
st_data_t data;
if (!FL_TEST(obj, FL_FINALIZE)) return;
if (st_lookup(finalizer_table, obj, &data)) {
if (RB_LIKELY(st_lookup(finalizer_table, obj, &data))) {
table = (VALUE)data;
st_insert(finalizer_table, dest, table);
FL_SET(dest, FL_FINALIZE);
}
else {
rb_bug("rb_gc_copy_finalizer: FL_FINALIZE set but not found in finalizer_table: %s", obj_info(obj));
}
}
static VALUE