Update shape capacity when removing ivar and rewriting shape transitions

Since edc7af48acd12666a2945f30901d16b62a39f474, we now no longer have
undef ivar transitions. Instead, we rebuild the shapes table. When we do
this, we need to ensure that we retain our capacities on shapes.
This commit is contained in:
Jemma Issroff 2022-12-09 13:33:48 -05:00 committed by Jean Boussier
parent 0645c8b3c1
commit 12003acbb9
Notes: git 2022-12-10 15:10:40 +00:00
2 changed files with 2 additions and 3 deletions

View File

@ -242,9 +242,10 @@ remove_shape_recursive(VALUE obj, ID id, rb_shape_t * shape, VALUE * removed)
// has the same attributes as this shape.
if (new_parent) {
rb_shape_t * new_child = get_next_shape_internal(new_parent, shape->edge_name, shape->type);
new_child->capacity = shape->capacity;
if (new_child->type == SHAPE_IVAR) {
move_iv(obj, id, shape->next_iv_index - 1, new_child->next_iv_index - 1);
}
return new_child;

View File

@ -1422,8 +1422,6 @@ vm_setivar(VALUE obj, ID id, VALUE val, shape_id_t dest_shape_id, attr_index_t i
rb_shape_t *dest_shape = rb_shape_get_shape_by_id(dest_shape_id);
shape_id_t source_shape_id = dest_shape->parent_id;
RUBY_ASSERT(dest_shape->type == SHAPE_IVAR);
if (shape_id == source_shape_id && dest_shape->edge_name == id) {
RUBY_ASSERT(dest_shape_id != INVALID_SHAPE_ID && shape_id != INVALID_SHAPE_ID);