Refactor rb_shape_get_next_iv_shape
to take and return ids.
This commit is contained in:
parent
df7d25bb3e
commit
9966de11fb
Notes:
git
2025-05-09 08:23:12 +00:00
14
shape.c
14
shape.c
@ -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)
|
||||
static inline rb_shape_t *
|
||||
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);
|
||||
}
|
||||
|
||||
shape_id_t
|
||||
rb_shape_get_next_iv_shape(shape_id_t shape_id, ID id)
|
||||
{
|
||||
rb_shape_t *shape = rb_shape_get_shape_by_id(shape_id);
|
||||
rb_shape_t *next_shape = shape_get_next_iv_shape(shape, id);
|
||||
return rb_shape_id(next_shape);
|
||||
}
|
||||
|
||||
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);
|
||||
midway_shape = shape_get_next_iv_shape(midway_shape, dest_shape->edge_name);
|
||||
break;
|
||||
case SHAPE_OBJ_ID:
|
||||
case SHAPE_ROOT:
|
||||
|
2
shape.h
2
shape.h
@ -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);
|
||||
shape_id_t rb_shape_get_next_iv_shape(shape_id_t shape_id, 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(rb_shape_get_next_iv_shape(source_shape_id, id) == dest_shape_id);
|
||||
RUBY_ASSERT(index < dest_shape->capacity);
|
||||
}
|
||||
else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user