summaryrefslogtreecommitdiff
path: root/shape.c
diff options
context:
space:
mode:
-rw-r--r--shape.c17
1 files changed, 14 insertions, 3 deletions
@@ -322,6 +322,9 @@ rb_shape_get_root_shape(void)
shape_id_t
rb_shape_id(rb_shape_t *shape)
{
return (shape_id_t)(shape - GET_SHAPE_TREE()->shape_list);
}
@@ -999,14 +1002,14 @@ rb_shape_id_offset(void)
return sizeof(uintptr_t) - SHAPE_ID_NUM_BITS / sizeof(uintptr_t);
}
-rb_shape_t *
-rb_shape_traverse_from_new_root(rb_shape_t *initial_shape, rb_shape_t *dest_shape)
{
RUBY_ASSERT(initial_shape->type == SHAPE_T_OBJECT);
rb_shape_t *next_shape = initial_shape;
if (dest_shape->type != initial_shape->type) {
- next_shape = rb_shape_traverse_from_new_root(initial_shape, rb_shape_get_parent(dest_shape));
if (!next_shape) {
return NULL;
}
@@ -1050,6 +1053,14 @@ rb_shape_traverse_from_new_root(rb_shape_t *initial_shape, rb_shape_t *dest_shap
return next_shape;
}
// Rebuild a similar shape with the same ivars but starting from
// a different SHAPE_T_OBJECT, and don't cary over non-canonical transitions
// such as SHAPE_FROZEN or SHAPE_OBJ_ID.