Rename rb_shape_get_shape_by_id
-> RSHAPE
This commit is contained in:
parent
9966de11fb
commit
334ebba221
Notes:
git
2025-05-09 08:23:11 +00:00
2
gc.c
2
gc.c
@ -3002,7 +3002,7 @@ rb_gc_mark_children(void *objspace, VALUE obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case T_OBJECT: {
|
case T_OBJECT: {
|
||||||
rb_shape_t *shape = rb_shape_get_shape_by_id(ROBJECT_SHAPE_ID(obj));
|
rb_shape_t *shape = RSHAPE(ROBJECT_SHAPE_ID(obj));
|
||||||
|
|
||||||
if (rb_shape_obj_too_complex(obj)) {
|
if (rb_shape_obj_too_complex(obj)) {
|
||||||
gc_mark_tbl_no_pin(ROBJECT_FIELDS_HASH(obj));
|
gc_mark_tbl_no_pin(ROBJECT_FIELDS_HASH(obj));
|
||||||
|
@ -147,7 +147,7 @@ RCLASS_FIELDS_COUNT(VALUE obj)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return rb_shape_get_shape_by_id(RCLASS_SHAPE_ID(obj))->next_field_index;
|
return RSHAPE(RCLASS_SHAPE_ID(obj))->next_field_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
object.c
4
object.c
@ -388,12 +388,12 @@ rb_obj_copy_ivar(VALUE dest, VALUE obj)
|
|||||||
while (src_shape->parent_id != INVALID_SHAPE_ID) {
|
while (src_shape->parent_id != INVALID_SHAPE_ID) {
|
||||||
if (src_shape->type == SHAPE_IVAR) {
|
if (src_shape->type == SHAPE_IVAR) {
|
||||||
while (dest_shape->edge_name != src_shape->edge_name) {
|
while (dest_shape->edge_name != src_shape->edge_name) {
|
||||||
dest_shape = rb_shape_get_shape_by_id(dest_shape->parent_id);
|
dest_shape = RSHAPE(dest_shape->parent_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
RB_OBJ_WRITE(dest, &dest_buf[dest_shape->next_field_index - 1], src_buf[src_shape->next_field_index - 1]);
|
RB_OBJ_WRITE(dest, &dest_buf[dest_shape->next_field_index - 1], src_buf[src_shape->next_field_index - 1]);
|
||||||
}
|
}
|
||||||
src_shape = rb_shape_get_shape_by_id(src_shape->parent_id);
|
src_shape = RSHAPE(src_shape->parent_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
47
shape.c
47
shape.c
@ -332,7 +332,7 @@ void
|
|||||||
rb_shape_each_shape(each_shape_callback callback, void *data)
|
rb_shape_each_shape(each_shape_callback callback, void *data)
|
||||||
{
|
{
|
||||||
rb_shape_t *cursor = rb_shape_get_root_shape();
|
rb_shape_t *cursor = rb_shape_get_root_shape();
|
||||||
rb_shape_t *end = rb_shape_get_shape_by_id(GET_SHAPE_TREE()->next_shape_id);
|
rb_shape_t *end = RSHAPE(GET_SHAPE_TREE()->next_shape_id);
|
||||||
while (cursor < end) {
|
while (cursor < end) {
|
||||||
callback(cursor, data);
|
callback(cursor, data);
|
||||||
cursor += 1;
|
cursor += 1;
|
||||||
@ -340,18 +340,17 @@ rb_shape_each_shape(each_shape_callback callback, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
RUBY_FUNC_EXPORTED rb_shape_t *
|
RUBY_FUNC_EXPORTED rb_shape_t *
|
||||||
rb_shape_get_shape_by_id(shape_id_t shape_id)
|
RSHAPE(shape_id_t shape_id)
|
||||||
{
|
{
|
||||||
RUBY_ASSERT(shape_id != INVALID_SHAPE_ID);
|
RUBY_ASSERT(shape_id != INVALID_SHAPE_ID);
|
||||||
|
|
||||||
rb_shape_t *shape = &GET_SHAPE_TREE()->shape_list[shape_id];
|
return &GET_SHAPE_TREE()->shape_list[shape_id];
|
||||||
return shape;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_shape_t *
|
rb_shape_t *
|
||||||
rb_shape_get_parent(rb_shape_t *shape)
|
rb_shape_get_parent(rb_shape_t *shape)
|
||||||
{
|
{
|
||||||
return rb_shape_get_shape_by_id(shape->parent_id);
|
return RSHAPE(shape->parent_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !SHAPE_IN_BASIC_FLAGS
|
#if !SHAPE_IN_BASIC_FLAGS
|
||||||
@ -385,7 +384,7 @@ size_t
|
|||||||
rb_shape_depth(shape_id_t shape_id)
|
rb_shape_depth(shape_id_t shape_id)
|
||||||
{
|
{
|
||||||
size_t depth = 1;
|
size_t depth = 1;
|
||||||
rb_shape_t *shape = rb_shape_get_shape_by_id(shape_id);
|
rb_shape_t *shape = RSHAPE(shape_id);
|
||||||
|
|
||||||
while (shape->parent_id != INVALID_SHAPE_ID) {
|
while (shape->parent_id != INVALID_SHAPE_ID) {
|
||||||
depth++;
|
depth++;
|
||||||
@ -398,7 +397,7 @@ rb_shape_depth(shape_id_t shape_id)
|
|||||||
rb_shape_t *
|
rb_shape_t *
|
||||||
rb_shape_get_shape(VALUE obj)
|
rb_shape_get_shape(VALUE obj)
|
||||||
{
|
{
|
||||||
return rb_shape_get_shape_by_id(rb_shape_get_shape_id(obj));
|
return RSHAPE(rb_shape_get_shape_id(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
static rb_shape_t *
|
static rb_shape_t *
|
||||||
@ -715,7 +714,7 @@ rb_shape_transition_shape_frozen(VALUE obj)
|
|||||||
rb_shape_t *next_shape;
|
rb_shape_t *next_shape;
|
||||||
|
|
||||||
if (shape == rb_shape_get_root_shape()) {
|
if (shape == rb_shape_get_root_shape()) {
|
||||||
return rb_shape_get_shape_by_id(SPECIAL_CONST_SHAPE_ID);
|
return RSHAPE(SPECIAL_CONST_SHAPE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dont_care;
|
bool dont_care;
|
||||||
@ -728,7 +727,7 @@ rb_shape_transition_shape_frozen(VALUE obj)
|
|||||||
static rb_shape_t *
|
static rb_shape_t *
|
||||||
shape_transition_too_complex(rb_shape_t *original_shape)
|
shape_transition_too_complex(rb_shape_t *original_shape)
|
||||||
{
|
{
|
||||||
rb_shape_t *next_shape = rb_shape_get_shape_by_id(ROOT_TOO_COMPLEX_SHAPE_ID);
|
rb_shape_t *next_shape = RSHAPE(ROOT_TOO_COMPLEX_SHAPE_ID);
|
||||||
|
|
||||||
if (original_shape->flags & SHAPE_FL_FROZEN) {
|
if (original_shape->flags & SHAPE_FL_FROZEN) {
|
||||||
bool dont_care;
|
bool dont_care;
|
||||||
@ -800,7 +799,7 @@ shape_get_next_iv_shape(rb_shape_t *shape, ID id)
|
|||||||
shape_id_t
|
shape_id_t
|
||||||
rb_shape_get_next_iv_shape(shape_id_t shape_id, ID id)
|
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 *shape = RSHAPE(shape_id);
|
||||||
rb_shape_t *next_shape = shape_get_next_iv_shape(shape, id);
|
rb_shape_t *next_shape = shape_get_next_iv_shape(shape, id);
|
||||||
return rb_shape_id(next_shape);
|
return rb_shape_id(next_shape);
|
||||||
}
|
}
|
||||||
@ -874,7 +873,7 @@ 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)
|
rb_shape_get_iv_index_with_hint(shape_id_t shape_id, ID id, attr_index_t *value, shape_id_t *shape_id_hint)
|
||||||
{
|
{
|
||||||
attr_index_t index_hint = *value;
|
attr_index_t index_hint = *value;
|
||||||
rb_shape_t *shape = rb_shape_get_shape_by_id(shape_id);
|
rb_shape_t *shape = RSHAPE(shape_id);
|
||||||
rb_shape_t *initial_shape = shape;
|
rb_shape_t *initial_shape = shape;
|
||||||
|
|
||||||
if (*shape_id_hint == INVALID_SHAPE_ID) {
|
if (*shape_id_hint == INVALID_SHAPE_ID) {
|
||||||
@ -882,7 +881,7 @@ rb_shape_get_iv_index_with_hint(shape_id_t shape_id, ID id, attr_index_t *value,
|
|||||||
return rb_shape_get_iv_index(shape, id, value);
|
return rb_shape_get_iv_index(shape, id, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_shape_t *shape_hint = rb_shape_get_shape_by_id(*shape_id_hint);
|
rb_shape_t *shape_hint = RSHAPE(*shape_id_hint);
|
||||||
|
|
||||||
// We assume it's likely shape_id_hint and shape_id have a close common
|
// We assume it's likely shape_id_hint and shape_id have a close common
|
||||||
// ancestor, so we check up to ANCESTOR_SEARCH_MAX_DEPTH ancestors before
|
// ancestor, so we check up to ANCESTOR_SEARCH_MAX_DEPTH ancestors before
|
||||||
@ -1065,8 +1064,8 @@ shape_traverse_from_new_root(rb_shape_t *initial_shape, rb_shape_t *dest_shape)
|
|||||||
shape_id_t
|
shape_id_t
|
||||||
rb_shape_traverse_from_new_root(shape_id_t initial_shape_id, shape_id_t dest_shape_id)
|
rb_shape_traverse_from_new_root(shape_id_t initial_shape_id, shape_id_t dest_shape_id)
|
||||||
{
|
{
|
||||||
rb_shape_t *initial_shape = rb_shape_get_shape_by_id(initial_shape_id);
|
rb_shape_t *initial_shape = RSHAPE(initial_shape_id);
|
||||||
rb_shape_t *dest_shape = rb_shape_get_shape_by_id(dest_shape_id);
|
rb_shape_t *dest_shape = RSHAPE(dest_shape_id);
|
||||||
return rb_shape_id(shape_traverse_from_new_root(initial_shape, dest_shape));
|
return rb_shape_id(shape_traverse_from_new_root(initial_shape, dest_shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1119,7 +1118,7 @@ rb_shape_obj_too_complex(VALUE obj)
|
|||||||
bool
|
bool
|
||||||
rb_shape_id_too_complex_p(shape_id_t shape_id)
|
rb_shape_id_too_complex_p(shape_id_t shape_id)
|
||||||
{
|
{
|
||||||
return rb_shape_too_complex_p(rb_shape_get_shape_by_id(shape_id));
|
return rb_shape_too_complex_p(RSHAPE(shape_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -1131,7 +1130,7 @@ rb_shape_too_complex_p(rb_shape_t *shape)
|
|||||||
size_t
|
size_t
|
||||||
rb_shape_edges_count(shape_id_t shape_id)
|
rb_shape_edges_count(shape_id_t shape_id)
|
||||||
{
|
{
|
||||||
rb_shape_t *shape = rb_shape_get_shape_by_id(shape_id);
|
rb_shape_t *shape = RSHAPE(shape_id);
|
||||||
if (shape->edges) {
|
if (shape->edges) {
|
||||||
if (SINGLE_CHILD_P(shape->edges)) {
|
if (SINGLE_CHILD_P(shape->edges)) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -1146,7 +1145,7 @@ rb_shape_edges_count(shape_id_t shape_id)
|
|||||||
size_t
|
size_t
|
||||||
rb_shape_memsize(shape_id_t shape_id)
|
rb_shape_memsize(shape_id_t shape_id)
|
||||||
{
|
{
|
||||||
rb_shape_t *shape = rb_shape_get_shape_by_id(shape_id);
|
rb_shape_t *shape = RSHAPE(shape_id);
|
||||||
|
|
||||||
size_t memsize = sizeof(rb_shape_t);
|
size_t memsize = sizeof(rb_shape_t);
|
||||||
if (shape->edges && !SINGLE_CHILD_P(shape->edges)) {
|
if (shape->edges && !SINGLE_CHILD_P(shape->edges)) {
|
||||||
@ -1164,7 +1163,7 @@ static VALUE
|
|||||||
shape_too_complex(VALUE self)
|
shape_too_complex(VALUE self)
|
||||||
{
|
{
|
||||||
shape_id_t shape_id = NUM2INT(rb_struct_getmember(self, rb_intern("id")));
|
shape_id_t shape_id = NUM2INT(rb_struct_getmember(self, rb_intern("id")));
|
||||||
rb_shape_t *shape = rb_shape_get_shape_by_id(shape_id);
|
rb_shape_t *shape = RSHAPE(shape_id);
|
||||||
return RBOOL(rb_shape_too_complex_p(shape));
|
return RBOOL(rb_shape_too_complex_p(shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1172,7 +1171,7 @@ static VALUE
|
|||||||
shape_frozen(VALUE self)
|
shape_frozen(VALUE self)
|
||||||
{
|
{
|
||||||
shape_id_t shape_id = NUM2INT(rb_struct_getmember(self, rb_intern("id")));
|
shape_id_t shape_id = NUM2INT(rb_struct_getmember(self, rb_intern("id")));
|
||||||
rb_shape_t *shape = rb_shape_get_shape_by_id(shape_id);
|
rb_shape_t *shape = RSHAPE(shape_id);
|
||||||
return RBOOL(rb_shape_frozen_shape_p(shape));
|
return RBOOL(rb_shape_frozen_shape_p(shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1180,7 +1179,7 @@ static VALUE
|
|||||||
shape_has_object_id(VALUE self)
|
shape_has_object_id(VALUE self)
|
||||||
{
|
{
|
||||||
shape_id_t shape_id = NUM2INT(rb_struct_getmember(self, rb_intern("id")));
|
shape_id_t shape_id = NUM2INT(rb_struct_getmember(self, rb_intern("id")));
|
||||||
rb_shape_t *shape = rb_shape_get_shape_by_id(shape_id);
|
rb_shape_t *shape = RSHAPE(shape_id);
|
||||||
return RBOOL(rb_shape_has_object_id(shape));
|
return RBOOL(rb_shape_has_object_id(shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1224,7 +1223,7 @@ rb_shape_edges(VALUE self)
|
|||||||
{
|
{
|
||||||
rb_shape_t *shape;
|
rb_shape_t *shape;
|
||||||
|
|
||||||
shape = rb_shape_get_shape_by_id(NUM2INT(rb_struct_getmember(self, rb_intern("id"))));
|
shape = RSHAPE(NUM2INT(rb_struct_getmember(self, rb_intern("id"))));
|
||||||
|
|
||||||
VALUE hash = rb_hash_new();
|
VALUE hash = rb_hash_new();
|
||||||
|
|
||||||
@ -1264,7 +1263,7 @@ static VALUE
|
|||||||
rb_shape_parent(VALUE self)
|
rb_shape_parent(VALUE self)
|
||||||
{
|
{
|
||||||
rb_shape_t *shape;
|
rb_shape_t *shape;
|
||||||
shape = rb_shape_get_shape_by_id(NUM2INT(rb_struct_getmember(self, rb_intern("id"))));
|
shape = RSHAPE(NUM2INT(rb_struct_getmember(self, rb_intern("id"))));
|
||||||
if (shape->parent_id != INVALID_SHAPE_ID) {
|
if (shape->parent_id != INVALID_SHAPE_ID) {
|
||||||
return rb_shape_t_to_rb_cShape(rb_shape_get_parent(shape));
|
return rb_shape_t_to_rb_cShape(rb_shape_get_parent(shape));
|
||||||
}
|
}
|
||||||
@ -1353,7 +1352,7 @@ rb_shape_find_by_id(VALUE mod, VALUE id)
|
|||||||
if (shape_id >= GET_SHAPE_TREE()->next_shape_id) {
|
if (shape_id >= GET_SHAPE_TREE()->next_shape_id) {
|
||||||
rb_raise(rb_eArgError, "Shape ID %d is out of bounds\n", shape_id);
|
rb_raise(rb_eArgError, "Shape ID %d is out of bounds\n", shape_id);
|
||||||
}
|
}
|
||||||
return rb_shape_t_to_rb_cShape(rb_shape_get_shape_by_id(shape_id));
|
return rb_shape_t_to_rb_cShape(RSHAPE(shape_id));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1457,7 +1456,7 @@ void
|
|||||||
rb_shape_free_all(void)
|
rb_shape_free_all(void)
|
||||||
{
|
{
|
||||||
rb_shape_t *cursor = rb_shape_get_root_shape();
|
rb_shape_t *cursor = rb_shape_get_root_shape();
|
||||||
rb_shape_t *end = rb_shape_get_shape_by_id(GET_SHAPE_TREE()->next_shape_id);
|
rb_shape_t *end = RSHAPE(GET_SHAPE_TREE()->next_shape_id);
|
||||||
while (cursor < end) {
|
while (cursor < end) {
|
||||||
if (cursor->edges && !SINGLE_CHILD_P(cursor->edges)) {
|
if (cursor->edges && !SINGLE_CHILD_P(cursor->edges)) {
|
||||||
rb_id_table_free(cursor->edges);
|
rb_id_table_free(cursor->edges);
|
||||||
|
8
shape.h
8
shape.h
@ -154,7 +154,7 @@ int32_t rb_shape_id_offset(void);
|
|||||||
|
|
||||||
rb_shape_t *rb_shape_get_parent(rb_shape_t *shape);
|
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 rb_shape_t *RSHAPE(shape_id_t shape_id);
|
||||||
RUBY_FUNC_EXPORTED shape_id_t rb_shape_get_shape_id(VALUE obj);
|
RUBY_FUNC_EXPORTED shape_id_t rb_shape_get_shape_id(VALUE obj);
|
||||||
shape_id_t rb_shape_get_next_iv_shape(shape_id_t shape_id, 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(rb_shape_t *shape, ID id, attr_index_t *value);
|
||||||
@ -191,7 +191,7 @@ ROBJECT_FIELDS_CAPACITY(VALUE obj)
|
|||||||
// Asking for capacity doesn't make sense when the object is using
|
// Asking for capacity doesn't make sense when the object is using
|
||||||
// a hash table for storing instance variables
|
// a hash table for storing instance variables
|
||||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||||
return rb_shape_get_shape_by_id(ROBJECT_SHAPE_ID(obj))->capacity;
|
return RSHAPE(ROBJECT_SHAPE_ID(obj))->capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline st_table *
|
static inline st_table *
|
||||||
@ -221,14 +221,14 @@ ROBJECT_FIELDS_COUNT(VALUE obj)
|
|||||||
else {
|
else {
|
||||||
RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
|
RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
|
||||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||||
return rb_shape_get_shape_by_id(ROBJECT_SHAPE_ID(obj))->next_field_index;
|
return RSHAPE(ROBJECT_SHAPE_ID(obj))->next_field_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
RBASIC_FIELDS_COUNT(VALUE obj)
|
RBASIC_FIELDS_COUNT(VALUE obj)
|
||||||
{
|
{
|
||||||
return rb_shape_get_shape_by_id(rb_shape_get_shape_id(obj))->next_field_index;
|
return RSHAPE(rb_shape_get_shape_id(obj))->next_field_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
shape_id_t rb_shape_traverse_from_new_root(shape_id_t initial_shape_id, shape_id_t orig_shape_id);
|
shape_id_t rb_shape_traverse_from_new_root(shape_id_t initial_shape_id, shape_id_t orig_shape_id);
|
||||||
|
10
variable.c
10
variable.c
@ -1360,7 +1360,7 @@ rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
attr_index_t index = 0;
|
attr_index_t index = 0;
|
||||||
shape = rb_shape_get_shape_by_id(shape_id);
|
shape = RSHAPE(shape_id);
|
||||||
found = rb_shape_get_iv_index(shape, id, &index);
|
found = rb_shape_get_iv_index(shape, id, &index);
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
@ -1432,7 +1432,7 @@ rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
|
|||||||
}
|
}
|
||||||
|
|
||||||
attr_index_t index = 0;
|
attr_index_t index = 0;
|
||||||
shape = rb_shape_get_shape_by_id(shape_id);
|
shape = RSHAPE(shape_id);
|
||||||
if (rb_shape_get_iv_index(shape, id, &index)) {
|
if (rb_shape_get_iv_index(shape, id, &index)) {
|
||||||
return ivar_list[index];
|
return ivar_list[index];
|
||||||
}
|
}
|
||||||
@ -1729,7 +1729,7 @@ generic_fields_lookup_ensure_size(st_data_t *k, st_data_t *v, st_data_t u, int e
|
|||||||
if (!existing || fields_lookup->resize) {
|
if (!existing || fields_lookup->resize) {
|
||||||
if (existing) {
|
if (existing) {
|
||||||
RUBY_ASSERT(fields_lookup->shape->type == SHAPE_IVAR || fields_lookup->shape->type == SHAPE_OBJ_ID);
|
RUBY_ASSERT(fields_lookup->shape->type == SHAPE_IVAR || fields_lookup->shape->type == SHAPE_OBJ_ID);
|
||||||
RUBY_ASSERT(rb_shape_get_shape_by_id(fields_lookup->shape->parent_id)->capacity < fields_lookup->shape->capacity);
|
RUBY_ASSERT(RSHAPE(fields_lookup->shape->parent_id)->capacity < fields_lookup->shape->capacity);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
FL_SET_RAW((VALUE)*k, FL_EXIVAR);
|
FL_SET_RAW((VALUE)*k, FL_EXIVAR);
|
||||||
@ -2338,12 +2338,12 @@ rb_copy_generic_ivar(VALUE dest, VALUE obj)
|
|||||||
while (src_shape->parent_id != INVALID_SHAPE_ID) {
|
while (src_shape->parent_id != INVALID_SHAPE_ID) {
|
||||||
if (src_shape->type == SHAPE_IVAR) {
|
if (src_shape->type == SHAPE_IVAR) {
|
||||||
while (dest_shape->edge_name != src_shape->edge_name) {
|
while (dest_shape->edge_name != src_shape->edge_name) {
|
||||||
dest_shape = rb_shape_get_shape_by_id(dest_shape->parent_id);
|
dest_shape = RSHAPE(dest_shape->parent_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
RB_OBJ_WRITE(dest, &dest_buf[dest_shape->next_field_index - 1], src_buf[src_shape->next_field_index - 1]);
|
RB_OBJ_WRITE(dest, &dest_buf[dest_shape->next_field_index - 1], src_buf[src_shape->next_field_index - 1]);
|
||||||
}
|
}
|
||||||
src_shape = rb_shape_get_shape_by_id(src_shape->parent_id);
|
src_shape = RSHAPE(src_shape->parent_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1476,8 +1476,8 @@ 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);
|
RUBY_ASSERT(dest_shape_id != INVALID_SHAPE_ID && shape_id != INVALID_SHAPE_ID);
|
||||||
}
|
}
|
||||||
else if (dest_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 *shape = RSHAPE(shape_id);
|
||||||
rb_shape_t *dest_shape = rb_shape_get_shape_by_id(dest_shape_id);
|
rb_shape_t *dest_shape = RSHAPE(dest_shape_id);
|
||||||
|
|
||||||
if (shape_id == dest_shape->parent_id && dest_shape->edge_name == id && shape->capacity == dest_shape->capacity) {
|
if (shape_id == dest_shape->parent_id && dest_shape->edge_name == id && shape->capacity == dest_shape->capacity) {
|
||||||
RUBY_ASSERT(index < dest_shape->capacity);
|
RUBY_ASSERT(index < dest_shape->capacity);
|
||||||
@ -1524,8 +1524,8 @@ 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));
|
VM_ASSERT(!rb_ractor_shareable_p(obj));
|
||||||
}
|
}
|
||||||
else if (dest_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 *shape = RSHAPE(shape_id);
|
||||||
rb_shape_t *dest_shape = rb_shape_get_shape_by_id(dest_shape_id);
|
rb_shape_t *dest_shape = RSHAPE(dest_shape_id);
|
||||||
shape_id_t source_shape_id = dest_shape->parent_id;
|
shape_id_t source_shape_id = dest_shape->parent_id;
|
||||||
|
|
||||||
if (shape_id == source_shape_id && dest_shape->edge_name == id && shape->capacity == dest_shape->capacity) {
|
if (shape_id == source_shape_id && dest_shape->edge_name == id && shape->capacity == dest_shape->capacity) {
|
||||||
|
@ -95,7 +95,7 @@ fn main() {
|
|||||||
|
|
||||||
// From shape.h
|
// From shape.h
|
||||||
.allowlist_function("rb_shape_get_shape_id")
|
.allowlist_function("rb_shape_get_shape_id")
|
||||||
.allowlist_function("rb_shape_get_shape_by_id")
|
.allowlist_function("RSHAPE")
|
||||||
.allowlist_function("rb_shape_id_offset")
|
.allowlist_function("rb_shape_id_offset")
|
||||||
.allowlist_function("rb_shape_get_iv_index")
|
.allowlist_function("rb_shape_get_iv_index")
|
||||||
.allowlist_function("rb_shape_get_next_no_warnings")
|
.allowlist_function("rb_shape_get_next_no_warnings")
|
||||||
|
@ -2894,7 +2894,7 @@ fn gen_get_ivar(
|
|||||||
|
|
||||||
let ivar_index = unsafe {
|
let ivar_index = unsafe {
|
||||||
let shape_id = comptime_receiver.shape_id_of();
|
let shape_id = comptime_receiver.shape_id_of();
|
||||||
let shape = rb_shape_get_shape_by_id(shape_id);
|
let shape = RSHAPE(shape_id);
|
||||||
let mut ivar_index: u32 = 0;
|
let mut ivar_index: u32 = 0;
|
||||||
if rb_shape_get_iv_index(shape, ivar_name, &mut ivar_index) {
|
if rb_shape_get_iv_index(shape, ivar_name, &mut ivar_index) {
|
||||||
Some(ivar_index as usize)
|
Some(ivar_index as usize)
|
||||||
@ -3097,7 +3097,7 @@ fn gen_set_ivar(
|
|||||||
let shape_too_complex = comptime_receiver.shape_too_complex();
|
let shape_too_complex = comptime_receiver.shape_too_complex();
|
||||||
let ivar_index = if !shape_too_complex {
|
let ivar_index = if !shape_too_complex {
|
||||||
let shape_id = comptime_receiver.shape_id_of();
|
let shape_id = comptime_receiver.shape_id_of();
|
||||||
let shape = unsafe { rb_shape_get_shape_by_id(shape_id) };
|
let shape = unsafe { RSHAPE(shape_id) };
|
||||||
let mut ivar_index: u32 = 0;
|
let mut ivar_index: u32 = 0;
|
||||||
if unsafe { rb_shape_get_iv_index(shape, ivar_name, &mut ivar_index) } {
|
if unsafe { rb_shape_get_iv_index(shape, ivar_name, &mut ivar_index) } {
|
||||||
Some(ivar_index as usize)
|
Some(ivar_index as usize)
|
||||||
@ -3387,7 +3387,7 @@ fn gen_definedivar(
|
|||||||
|
|
||||||
let shape_id = comptime_receiver.shape_id_of();
|
let shape_id = comptime_receiver.shape_id_of();
|
||||||
let ivar_exists = unsafe {
|
let ivar_exists = unsafe {
|
||||||
let shape = rb_shape_get_shape_by_id(shape_id);
|
let shape = RSHAPE(shape_id);
|
||||||
let mut ivar_index: u32 = 0;
|
let mut ivar_index: u32 = 0;
|
||||||
rb_shape_get_iv_index(shape, ivar_name, &mut ivar_index)
|
rb_shape_get_iv_index(shape, ivar_name, &mut ivar_index)
|
||||||
};
|
};
|
||||||
|
@ -450,7 +450,7 @@ impl VALUE {
|
|||||||
|
|
||||||
pub fn shape_of(self) -> *mut rb_shape {
|
pub fn shape_of(self) -> *mut rb_shape {
|
||||||
unsafe {
|
unsafe {
|
||||||
let shape = rb_shape_get_shape_by_id(self.shape_id_of());
|
let shape = RSHAPE(self.shape_id_of());
|
||||||
|
|
||||||
if shape.is_null() {
|
if shape.is_null() {
|
||||||
panic!("Shape should not be null");
|
panic!("Shape should not be null");
|
||||||
|
2
yjit/src/cruby_bindings.inc.rs
generated
2
yjit/src/cruby_bindings.inc.rs
generated
@ -1088,7 +1088,7 @@ extern "C" {
|
|||||||
pub fn rb_obj_info(obj: VALUE) -> *const ::std::os::raw::c_char;
|
pub fn rb_obj_info(obj: VALUE) -> *const ::std::os::raw::c_char;
|
||||||
pub fn rb_ec_stack_check(ec: *mut rb_execution_context_struct) -> ::std::os::raw::c_int;
|
pub fn rb_ec_stack_check(ec: *mut rb_execution_context_struct) -> ::std::os::raw::c_int;
|
||||||
pub fn rb_shape_id_offset() -> i32;
|
pub fn rb_shape_id_offset() -> i32;
|
||||||
pub fn rb_shape_get_shape_by_id(shape_id: shape_id_t) -> *mut rb_shape_t;
|
pub fn RSHAPE(shape_id: shape_id_t) -> *mut rb_shape_t;
|
||||||
pub fn rb_shape_get_shape_id(obj: VALUE) -> shape_id_t;
|
pub fn rb_shape_get_shape_id(obj: VALUE) -> shape_id_t;
|
||||||
pub fn rb_shape_get_iv_index(shape: *mut rb_shape_t, id: ID, value: *mut attr_index_t) -> bool;
|
pub fn rb_shape_get_iv_index(shape: *mut rb_shape_t, id: ID, value: *mut attr_index_t) -> bool;
|
||||||
pub fn rb_shape_obj_too_complex(obj: VALUE) -> bool;
|
pub fn rb_shape_obj_too_complex(obj: VALUE) -> bool;
|
||||||
|
@ -108,7 +108,7 @@ fn main() {
|
|||||||
|
|
||||||
// From shape.h
|
// From shape.h
|
||||||
.allowlist_function("rb_shape_get_shape_id")
|
.allowlist_function("rb_shape_get_shape_id")
|
||||||
.allowlist_function("rb_shape_get_shape_by_id")
|
.allowlist_function("RSHAPE")
|
||||||
.allowlist_function("rb_shape_id_offset")
|
.allowlist_function("rb_shape_id_offset")
|
||||||
.allowlist_function("rb_shape_get_iv_index")
|
.allowlist_function("rb_shape_get_iv_index")
|
||||||
.allowlist_function("rb_shape_get_next_no_warnings")
|
.allowlist_function("rb_shape_get_next_no_warnings")
|
||||||
|
@ -487,7 +487,7 @@ impl VALUE {
|
|||||||
|
|
||||||
pub fn shape_of(self) -> *mut rb_shape {
|
pub fn shape_of(self) -> *mut rb_shape {
|
||||||
unsafe {
|
unsafe {
|
||||||
let shape = rb_shape_get_shape_by_id(self.shape_id_of());
|
let shape = RSHAPE(self.shape_id_of());
|
||||||
|
|
||||||
if shape.is_null() {
|
if shape.is_null() {
|
||||||
panic!("Shape should not be null");
|
panic!("Shape should not be null");
|
||||||
|
2
zjit/src/cruby_bindings.inc.rs
generated
2
zjit/src/cruby_bindings.inc.rs
generated
@ -868,7 +868,7 @@ unsafe extern "C" {
|
|||||||
pub fn rb_obj_info(obj: VALUE) -> *const ::std::os::raw::c_char;
|
pub fn rb_obj_info(obj: VALUE) -> *const ::std::os::raw::c_char;
|
||||||
pub fn rb_ec_stack_check(ec: *mut rb_execution_context_struct) -> ::std::os::raw::c_int;
|
pub fn rb_ec_stack_check(ec: *mut rb_execution_context_struct) -> ::std::os::raw::c_int;
|
||||||
pub fn rb_shape_id_offset() -> i32;
|
pub fn rb_shape_id_offset() -> i32;
|
||||||
pub fn rb_shape_get_shape_by_id(shape_id: shape_id_t) -> *mut rb_shape_t;
|
pub fn RSHAPE(shape_id: shape_id_t) -> *mut rb_shape_t;
|
||||||
pub fn rb_shape_get_shape_id(obj: VALUE) -> shape_id_t;
|
pub fn rb_shape_get_shape_id(obj: VALUE) -> shape_id_t;
|
||||||
pub fn rb_shape_get_iv_index(shape: *mut rb_shape_t, id: ID, value: *mut attr_index_t) -> bool;
|
pub fn rb_shape_get_iv_index(shape: *mut rb_shape_t, id: ID, value: *mut attr_index_t) -> bool;
|
||||||
pub fn rb_shape_obj_too_complex(obj: VALUE) -> bool;
|
pub fn rb_shape_obj_too_complex(obj: VALUE) -> bool;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user