diff options
author | Jean Boussier <[email protected]> | 2025-06-07 16:48:26 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2025-06-07 18:30:44 +0200 |
commit | a640723d31262904b4de14be55357fb426873d7f (patch) | |
tree | 3cc1e8b9e2d8d2b2864bba5e1a1eb22589b30145 /gc.c | |
parent | 191f6e3b8744ae459ab7f6cb4d95ac5218856084 (diff) |
Simplify `rb_gc_rebuild_shape`
Now that there no longer multiple shape roots, all we need to do
when moving an object from one slot to the other is to update the
`heap_index` part of the shape_id.
Since this never need to create a shape transition, it will always
work and never result in a complex shape.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13556
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 14 |
1 files changed, 2 insertions, 12 deletions
@@ -381,19 +381,9 @@ rb_gc_set_shape(VALUE obj, uint32_t shape_id) uint32_t rb_gc_rebuild_shape(VALUE obj, size_t heap_id) { - shape_id_t orig_shape_id = rb_obj_shape_id(obj); - if (rb_shape_too_complex_p(orig_shape_id)) { - return (uint32_t)orig_shape_id; - } - - shape_id_t initial_shape_id = rb_shape_root(heap_id); - shape_id_t new_shape_id = rb_shape_traverse_from_new_root(initial_shape_id, orig_shape_id); - - if (new_shape_id == INVALID_SHAPE_ID) { - return 0; - } + RUBY_ASSERT(RB_TYPE_P(obj, T_OBJECT)); - return (uint32_t)new_shape_id; + return (uint32_t)rb_shape_transition_heap(obj, heap_id); } void rb_vm_update_references(void *ptr); |