Move special const checks to rb_gc_mark_weak

This commit is contained in:
Peter Zhu 2024-09-12 10:21:08 -04:00
parent 2d495300e2
commit 606db2c423
Notes: git 2024-09-12 20:03:49 +00:00
2 changed files with 4 additions and 3 deletions

2
gc.c
View File

@ -2100,6 +2100,8 @@ rb_gc_mark_maybe(VALUE obj)
void
rb_gc_mark_weak(VALUE *ptr)
{
if (RB_SPECIAL_CONST_P(*ptr)) return;
rb_gc_impl_mark_weak(rb_gc_get_objspace(), ptr);
}

View File

@ -4609,11 +4609,10 @@ rb_gc_impl_mark_weak(void *objspace_ptr, VALUE *ptr)
if (RB_UNLIKELY(!during_gc)) return;
VALUE obj = *ptr;
if (RB_SPECIAL_CONST_P(obj)) return;
GC_ASSERT(objspace->rgengc.parent_object == 0 || FL_TEST(objspace->rgengc.parent_object, FL_WB_PROTECTED));
VALUE obj = *ptr;
if (RB_UNLIKELY(RB_TYPE_P(obj, T_NONE))) {
rb_obj_info_dump(obj);
rb_bug("try to mark T_NONE object");