aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-11-10 16:17:39 -0500
committerPeter Zhu <peter@peterzhu.ca>2023-11-13 18:26:36 -0500
commit68869e9bd921e4021a9ee8eee5a36377dd2b2a90 (patch)
tree2a58392e4d2e40dd213acda55373eb959e93eb88 /vm_insnhelper.c
parentb41270842aae73bf59e17fb1d175a4ff557f0e87 (diff)
downloadruby-68869e9bd921e4021a9ee8eee5a36377dd2b2a90.tar.gz
Revert "Revert "Remove SHAPE_CAPACITY_CHANGE shapes""
This reverts commit 5f3fb4f4e397735783743fe52a7899b614bece20.
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index bea80ed588..be70b93588 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1460,11 +1460,11 @@ vm_setivar_default(VALUE obj, ID id, VALUE val, shape_id_t dest_shape_id, attr_i
RUBY_ASSERT(dest_shape_id != INVALID_SHAPE_ID && shape_id != INVALID_SHAPE_ID);
}
else if (dest_shape_id != INVALID_SHAPE_ID) {
+ rb_shape_t *shape = rb_shape_get_shape_by_id(shape_id);
rb_shape_t *dest_shape = rb_shape_get_shape_by_id(dest_shape_id);
- if (shape_id == dest_shape->parent_id && dest_shape->edge_name == id && dest_shape->type == SHAPE_IVAR) {
- RUBY_ASSERT(rb_shape_get_shape_by_id(shape_id)->capacity == dest_shape->capacity);
- RUBY_ASSERT(index < rb_shape_get_shape_by_id(shape_id)->capacity);
+ if (shape_id == dest_shape->parent_id && dest_shape->edge_name == id && shape->capacity == dest_shape->capacity) {
+ RUBY_ASSERT(index < dest_shape->capacity);
}
else {
return Qundef;
@@ -1508,10 +1508,11 @@ vm_setivar(VALUE obj, ID id, VALUE val, shape_id_t dest_shape_id, attr_index_t i
VM_ASSERT(!rb_ractor_shareable_p(obj));
}
else if (dest_shape_id != INVALID_SHAPE_ID) {
+ rb_shape_t *shape = rb_shape_get_shape_by_id(shape_id);
rb_shape_t *dest_shape = rb_shape_get_shape_by_id(dest_shape_id);
shape_id_t source_shape_id = dest_shape->parent_id;
- if (shape_id == source_shape_id && dest_shape->edge_name == id) {
+ if (shape_id == source_shape_id && dest_shape->edge_name == id && shape->capacity == dest_shape->capacity) {
RUBY_ASSERT(dest_shape_id != INVALID_SHAPE_ID && shape_id != INVALID_SHAPE_ID);
ROBJECT_SET_SHAPE_ID(obj, dest_shape_id);