summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-05-08 18:36:01 +0200
committerJean Boussier <[email protected]>2025-05-09 10:22:51 +0200
commit9966de11fb349688f12ea16dc4c082269a8fdb42 ()
treea10e5679439dc108952b52fd79e89d6327112531
parentdf7d25bb3e8105783f3a243f12213d5c52c42377 (diff)
Refactor `rb_shape_get_next_iv_shape` to take and return ids.
Notes: Merged: https://.com/ruby/ruby/pull/13283
-rw-r--r--shape.c14
-rw-r--r--shape.h2
-rw-r--r--vm_insnhelper.c2
3 files changed, 13 insertions, 5 deletions
@@ -789,14 +789,22 @@ rb_shape_object_id_shape(VALUE obj)
* This function is used for assertions where we don't want to increment
* max_iv_count
*/
-rb_shape_t *
-rb_shape_get_next_iv_shape(rb_shape_t *shape, ID id)
{
RUBY_ASSERT(!is_instance_id(id) || RTEST(rb_sym2str(ID2SYM(id))));
bool dont_care;
return get_next_shape_internal(shape, id, SHAPE_IVAR, &dont_care, true);
}
static inline rb_shape_t *
shape_get_next(rb_shape_t *shape, VALUE obj, ID id, bool emit_warnings)
{
@@ -1087,7 +1095,7 @@ rb_shape_rebuild_shape(rb_shape_t *initial_shape, rb_shape_t *dest_shape)
switch ((enum shape_type)dest_shape->type) {
case SHAPE_IVAR:
- midway_shape = rb_shape_get_next_iv_shape(midway_shape, dest_shape->edge_name);
break;
case SHAPE_OBJ_ID:
case SHAPE_ROOT:
@@ -156,7 +156,7 @@ rb_shape_t *rb_shape_get_parent(rb_shape_t *shape);
RUBY_FUNC_EXPORTED rb_shape_t *rb_shape_get_shape_by_id(shape_id_t shape_id);
RUBY_FUNC_EXPORTED shape_id_t rb_shape_get_shape_id(VALUE obj);
-rb_shape_t *rb_shape_get_next_iv_shape(rb_shape_t *shape, ID id);
bool rb_shape_get_iv_index(rb_shape_t *shape, ID id, attr_index_t *value);
bool rb_shape_get_iv_index_with_hint(shape_id_t shape_id, ID id, attr_index_t *value, shape_id_t *shape_id_hint);
RUBY_FUNC_EXPORTED bool rb_shape_obj_too_complex(VALUE obj);
@@ -1533,7 +1533,7 @@ vm_setivar(VALUE obj, ID id, VALUE val, shape_id_t dest_shape_id, attr_index_t i
ROBJECT_SET_SHAPE_ID(obj, dest_shape_id);
- RUBY_ASSERT(rb_shape_get_next_iv_shape(rb_shape_get_shape_by_id(source_shape_id), id) == dest_shape);
RUBY_ASSERT(index < dest_shape->capacity);
}
else {