diff options
author | Kunshan Wang <wks1986@gmail.com> | 2022-10-27 17:47:47 +0800 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2023-01-31 09:24:26 -0500 |
commit | de724487f0820391e005f11e67ea132cffe3c9d3 (patch) | |
tree | 99d1d6ba3cf30c49f93af16744ac2bd1fdbb8f39 /gc.c | |
parent | d92289f6330c57b0fe970a654dbf33314bfd6203 (diff) |
Copying GC support for EXIVAR
Instance variables held in gen_ivtbl are marked with rb_gc_mark. It
prevents the referenced objects from moving, which is bad for copying
garbage collectors.
This commit allows those instance variables to be updated during
gc_update_object_references.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7206
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -7232,7 +7232,7 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj) gc_mark_set_parent(objspace, obj); if (FL_TEST(obj, FL_EXIVAR)) { - rb_mark_generic_ivar(obj); + rb_mark_and_update_generic_ivar(obj); } switch (BUILTIN_TYPE(obj)) { @@ -10560,6 +10560,10 @@ 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); + } + switch (BUILTIN_TYPE(obj)) { case T_CLASS: case T_MODULE: |