summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-09-05 09:27:11 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-09-05 09:27:11 -0400
commitef65183692789f80dc1c1ad569a449edfdd46120 (patch)
tree84b88887c44441e112dc51ed9f007051969a208e /gc.c
parent5b157997e29ee41dd9c94861dde38d148bca941d (diff)
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.
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index 2863240aa6..b529a472ad 100644
--- a/gc.c
+++ b/gc.c
@@ -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. */