From 269c705f93c4db631f4cad89991bc5d69a7dcd03 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 24 Nov 2023 10:25:06 -0500 Subject: Fix compaction for generic ivars When generic instance variable has a shape, it is marked movable. If it it transitions to too complex, it needs to update references otherwise it may have incorrect references. --- gc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gc.c') diff --git a/gc.c b/gc.c index 260b891b1e..2d7eb4de93 100644 --- a/gc.c +++ b/gc.c @@ -7255,7 +7255,7 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj) gc_mark_set_parent(objspace, obj); if (FL_TEST(obj, FL_EXIVAR)) { - rb_mark_and_update_generic_ivar(obj); + rb_mark_generic_ivar(obj); } switch (BUILTIN_TYPE(obj)) { @@ -10249,6 +10249,12 @@ gc_ref_update_table_values_only(rb_objspace_t *objspace, st_table *tbl) } } +void +rb_gc_ref_update_table_values_only(st_table *tbl) +{ + gc_ref_update_table_values_only(&rb_objspace, tbl); +} + static void gc_update_table_refs(rb_objspace_t * objspace, st_table *tbl) { @@ -10623,7 +10629,7 @@ gc_update_object_references(rb_objspace_t *objspace, VALUE obj) gc_report(4, objspace, "update-refs: %p ->\n", (void *)obj); if (FL_TEST(obj, FL_EXIVAR)) { - rb_mark_and_update_generic_ivar(obj); + rb_ref_update_generic_ivar(obj); } switch (BUILTIN_TYPE(obj)) { -- cgit v1.2.3