summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-06-06 09:26:35 +0200
committerJean Boussier <[email protected]>2025-06-07 18:30:44 +0200
commit689ec5114624978f47edcba4f055e62017e4ac36 (patch)
tree2fffb2d5d1523a8149249c85185cf932ebde6ff1 /object.c
parent42cf301254d4bfec30c07a221f34f3fa85a29f33 (diff)
Replicate `heap_index` in shape_id flags.
This is preparation to getting rid of `T_OBJECT` transitions. By first only replicating the information it's easier to ensure consistency.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13556
Diffstat (limited to 'object.c')
-rw-r--r--object.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/object.c b/object.c
index cee423cc19..3de93c4f0e 100644
--- a/object.c
+++ b/object.c
@@ -339,17 +339,15 @@ rb_obj_copy_ivar(VALUE dest, VALUE obj)
shape_id_t dest_shape_id = src_shape_id;
shape_id_t initial_shape_id = RBASIC_SHAPE_ID(dest);
- if (RSHAPE(initial_shape_id)->heap_index != RSHAPE(src_shape_id)->heap_index || !rb_shape_canonical_p(src_shape_id)) {
- RUBY_ASSERT(RSHAPE(initial_shape_id)->type == SHAPE_T_OBJECT);
+ RUBY_ASSERT(RSHAPE(initial_shape_id)->type == SHAPE_T_OBJECT);
- dest_shape_id = rb_shape_rebuild(initial_shape_id, src_shape_id);
- if (UNLIKELY(rb_shape_too_complex_p(dest_shape_id))) {
- st_table *table = rb_st_init_numtable_with_size(src_num_ivs);
- rb_obj_copy_ivs_to_hash_table(obj, table);
- rb_obj_init_too_complex(dest, table);
+ dest_shape_id = rb_shape_rebuild(initial_shape_id, src_shape_id);
+ if (UNLIKELY(rb_shape_too_complex_p(dest_shape_id))) {
+ st_table *table = rb_st_init_numtable_with_size(src_num_ivs);
+ rb_obj_copy_ivs_to_hash_table(obj, table);
+ rb_obj_init_too_complex(dest, table);
- return;
- }
+ return;
}
VALUE *src_buf = ROBJECT_FIELDS(obj);