@@ -339,17 +339,16 @@ rb_obj_copy_ivar(VALUE dest, VALUE obj)
339339 shape_id_t dest_shape_id = src_shape_id ;
340340 shape_id_t initial_shape_id = RBASIC_SHAPE_ID (dest );
341341
342- if (RSHAPE (initial_shape_id )-> heap_index != RSHAPE (src_shape_id )-> heap_index || !rb_shape_canonical_p (src_shape_id )) {
343- RUBY_ASSERT (RSHAPE (initial_shape_id )-> type == SHAPE_T_OBJECT );
342+ RUBY_ASSERT (RSHAPE (initial_shape_id )-> type == SHAPE_ROOT );
344343
345- dest_shape_id = rb_shape_rebuild (initial_shape_id , src_shape_id );
346- if (UNLIKELY (rb_shape_too_complex_p (dest_shape_id ))) {
347- st_table * table = rb_st_init_numtable_with_size (src_num_ivs );
348- rb_obj_copy_ivs_to_hash_table (obj , table );
349- rb_obj_init_too_complex (dest , table );
344+ dest_shape_id = rb_shape_rebuild (initial_shape_id , src_shape_id );
350345
351- return ;
352- }
346+ if (UNLIKELY (rb_shape_too_complex_p (dest_shape_id ))) {
347+ st_table * table = rb_st_init_numtable_with_size (src_num_ivs );
348+ rb_obj_copy_ivs_to_hash_table (obj , table );
349+ rb_obj_init_too_complex (dest , table );
350+
351+ return ;
353352 }
354353
355354 VALUE * src_buf = ROBJECT_FIELDS (obj );
@@ -365,7 +364,7 @@ rb_obj_copy_ivar(VALUE dest, VALUE obj)
365364 }
366365
367366 rb_shape_copy_fields (dest , dest_buf , dest_shape_id , obj , src_buf , src_shape_id );
368- rb_obj_set_shape_id (dest , dest_shape_id );
367+ RBASIC_SET_SHAPE_ID (dest , dest_shape_id );
369368}
370369
371370static void
0 commit comments