@@ -1720,6 +1720,7 @@ general_field_set_at(VALUE obj, rb_shape_t *target_shape, VALUE val, void *data,
17201720 attr_index_t index = target_shape -> next_field_index - 1 ;
17211721 if (index >= current_shape -> capacity ) {
17221722 shape_resize_fields_func (obj , current_shape -> capacity , target_shape -> capacity , data );
1723+ set_shape_func (obj , target_shape , data );
17231724 }
17241725
17251726 if (target_shape -> next_field_index > current_shape -> next_field_index ) {
@@ -2319,7 +2320,7 @@ rb_copy_generic_ivar(VALUE dest, VALUE obj)
23192320 rb_shape_t * shape_to_set_on_dest = src_shape ;
23202321 rb_shape_t * initial_shape = rb_shape_get_shape (dest );
23212322
2322- if (initial_shape -> heap_index != src_shape -> heap_index || !rb_shape_canonical_p (src_shape )) {
2323+ if (!rb_shape_canonical_p (src_shape )) {
23232324 RUBY_ASSERT (initial_shape -> type == SHAPE_ROOT );
23242325
23252326 shape_to_set_on_dest = rb_shape_rebuild_shape (initial_shape , src_shape );
@@ -2339,10 +2340,10 @@ rb_copy_generic_ivar(VALUE dest, VALUE obj)
23392340
23402341 if (src_shape -> next_field_index == shape_to_set_on_dest -> next_field_index ) {
23412342 // Happy path, we can just memcpy the ivptr content
2342- MEMCPY (dest_buf , src_buf , VALUE , src_num_ivs );
2343+ MEMCPY (dest_buf , src_buf , VALUE , shape_to_set_on_dest -> next_field_index );
23432344
23442345 // Fire write barriers
2345- for (uint32_t i = 0 ; i < src_num_ivs ; i ++ ) {
2346+ for (uint32_t i = 0 ; i < shape_to_set_on_dest -> next_field_index ; i ++ ) {
23462347 RB_OBJ_WRITTEN (dest , Qundef , dest_buf [i ]);
23472348 }
23482349 }
0 commit comments