Add check for T_NONE in rb_gc_mark_weak

This commit adds a check for T_NONE in rb_gc_mark_weak, just like
gc_mark_ptr. This will help debugging.
This commit is contained in:
Peter Zhu 2023-09-05 09:27:11 -04:00
parent 5b157997e2
commit ef65183692

5
gc.c
View File

@ -6903,6 +6903,11 @@ rb_gc_mark_weak(VALUE *ptr)
GC_ASSERT(objspace->rgengc.parent_object == 0 || FL_TEST(objspace->rgengc.parent_object, FL_WB_PROTECTED));
if (UNLIKELY(RB_TYPE_P(obj, T_NONE))) {
rp(obj);
rb_bug("try to mark T_NONE object");
}
/* If we are in a minor GC and the other object is old, then obj should
* already be marked and cannot be reclaimed in this GC cycle so we don't
* need to add it to the weak refences list. */