diff options
author | Peter Zhu <[email protected]> | 2025-01-21 16:36:03 -0500 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2025-01-22 08:54:52 -0500 |
commit | 89240eb2fbdbd9a46788b4976cd4bdf4cc58ada2 (patch) | |
tree | 5e3559e4506a9dab59f67edcae9fbcc7b81cef3e /gc/default/default.c | |
parent | 7070b1b1968f31f999636b42a1af872458cd5a81 (diff) |
Add generic ivar reference updating step
Previously, generic ivars worked differently than the other global tables
during compaction. The other global tables had their references updated
through iteration during rb_gc_update_vm_references. Generic ivars updated
the keys when the object moved and updated the values while reference
updating the object. This is inefficient as this required one lookup for
every moved object and one lookup for every object with generic ivars.
Instead, this commit changes it to iterate over the generic ivar table to
update both the keys and values.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12607
Diffstat (limited to 'gc/default/default.c')
-rw-r--r-- | gc/default/default.c | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/gc/default/default.c b/gc/default/default.c index e8d43986b9..a05a2ca29c 100644 --- a/gc/default/default.c +++ b/gc/default/default.c @@ -6927,15 +6927,6 @@ gc_move(rb_objspace_t *objspace, VALUE src, VALUE dest, size_t src_slot_size, si CLEAR_IN_BITMAP(GET_HEAP_UNCOLLECTIBLE_BITS(src), src); CLEAR_IN_BITMAP(GET_HEAP_PAGE(src)->remembered_bits, src); - if (FL_TEST(src, FL_EXIVAR)) { - /* Resizing the st table could cause a malloc */ - DURING_GC_COULD_MALLOC_REGION_START(); - { - rb_mv_generic_ivar(src, dest); - } - DURING_GC_COULD_MALLOC_REGION_END(); - } - if (FL_TEST(src, FL_SEEN_OBJ_ID)) { /* If the source object's object_id has been seen, we need to update * the object to object id mapping. */ |