summaryrefslogtreecommitdiff
path: root/shape.c
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2023-10-19 16:01:35 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2023-10-24 10:52:06 -0700
commita3f66e09f6596259677f00255a9b6231a2739774 (patch)
treeaddc47766e34c520307baab7952343855af872e0 /shape.c
parentcaf6a72348431e0e6b61be84919cd06c7a745189 (diff)
geniv objects can become too complex
Diffstat (limited to 'shape.c')
-rw-r--r--shape.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/shape.c b/shape.c
index 54805e27c8..0dd0c109a0 100644
--- a/shape.c
+++ b/shape.c
@@ -592,7 +592,7 @@ rb_shape_transition_shape_remove_ivar(VALUE obj, ID id, rb_shape_t *shape, VALUE
}
}
-void
+rb_shape_t *
rb_shape_transition_shape_frozen(VALUE obj)
{
rb_shape_t* shape = rb_shape_get_shape(obj);
@@ -600,21 +600,23 @@ rb_shape_transition_shape_frozen(VALUE obj)
RUBY_ASSERT(RB_OBJ_FROZEN(obj));
if (rb_shape_frozen_shape_p(shape) || rb_shape_obj_too_complex(obj)) {
- return;
+ return shape;
}
rb_shape_t* next_shape;
if (shape == rb_shape_get_root_shape()) {
- rb_shape_set_shape_id(obj, SPECIAL_CONST_SHAPE_ID);
- return;
+ return rb_shape_get_shape_by_id(SPECIAL_CONST_SHAPE_ID);
}
bool dont_care;
next_shape = get_next_shape_internal(shape, (ID)id_frozen, SHAPE_FROZEN, &dont_care, true, false);
+ if (!next_shape) {
+ next_shape = rb_shape_get_shape_by_id(OBJ_TOO_COMPLEX_SHAPE_ID);
+ }
RUBY_ASSERT(next_shape);
- rb_shape_set_shape(obj, next_shape);
+ return next_shape;
}
/*