Rename rb_shape_obj_too_complex
-> rb_shape_obj_too_complex_p
This commit is contained in:
parent
677d075c29
commit
3f7c0af051
Notes:
git
2025-05-09 08:23:09 +00:00
@ -587,7 +587,7 @@ dump_object(VALUE obj, struct dump_config *dc)
|
||||
|
||||
dump_append(dc, ", \"ivars\":");
|
||||
dump_append_lu(dc, ROBJECT_FIELDS_COUNT(obj));
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
dump_append(dc, ", \"too_complex_shape\":true");
|
||||
}
|
||||
break;
|
||||
|
22
gc.c
22
gc.c
@ -1228,7 +1228,7 @@ rb_gc_obj_free(void *objspace, VALUE obj)
|
||||
|
||||
switch (BUILTIN_TYPE(obj)) {
|
||||
case T_OBJECT:
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
RB_DEBUG_COUNTER_INC(obj_obj_too_complex);
|
||||
st_free_table(ROBJECT_FIELDS_HASH(obj));
|
||||
}
|
||||
@ -1244,7 +1244,7 @@ rb_gc_obj_free(void *objspace, VALUE obj)
|
||||
case T_CLASS:
|
||||
rb_id_table_free(RCLASS_M_TBL(obj));
|
||||
rb_cc_table_free(obj);
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
st_free_table((st_table *)RCLASS_FIELDS(obj));
|
||||
}
|
||||
else {
|
||||
@ -2127,7 +2127,7 @@ rb_obj_memsize_of(VALUE obj)
|
||||
|
||||
switch (BUILTIN_TYPE(obj)) {
|
||||
case T_OBJECT:
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
size += rb_st_memsize(ROBJECT_FIELDS_HASH(obj));
|
||||
}
|
||||
else if (!(RBASIC(obj)->flags & ROBJECT_EMBED)) {
|
||||
@ -2915,7 +2915,7 @@ rb_gc_mark_children(void *objspace, VALUE obj)
|
||||
mark_m_tbl(objspace, RCLASS_M_TBL(obj));
|
||||
mark_cvc_tbl(objspace, obj);
|
||||
rb_cc_table_mark(obj);
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
gc_mark_tbl_no_pin((st_table *)RCLASS_FIELDS(obj));
|
||||
}
|
||||
else {
|
||||
@ -3004,7 +3004,7 @@ rb_gc_mark_children(void *objspace, VALUE obj)
|
||||
case T_OBJECT: {
|
||||
rb_shape_t *shape = RSHAPE(ROBJECT_SHAPE_ID(obj));
|
||||
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
gc_mark_tbl_no_pin(ROBJECT_FIELDS_HASH(obj));
|
||||
}
|
||||
else {
|
||||
@ -3092,7 +3092,7 @@ rb_gc_obj_optimal_size(VALUE obj)
|
||||
return rb_ary_size_as_embedded(obj);
|
||||
|
||||
case T_OBJECT:
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
return sizeof(struct RObject);
|
||||
}
|
||||
else {
|
||||
@ -3334,7 +3334,7 @@ gc_ref_update_object(void *objspace, VALUE v)
|
||||
{
|
||||
VALUE *ptr = ROBJECT_FIELDS(v);
|
||||
|
||||
if (rb_shape_obj_too_complex(v)) {
|
||||
if (rb_shape_obj_too_complex_p(v)) {
|
||||
gc_ref_update_table_values_only(ROBJECT_FIELDS_HASH(v));
|
||||
return;
|
||||
}
|
||||
@ -3632,7 +3632,7 @@ vm_weak_table_foreach_update_weak_value(st_data_t *key, st_data_t *value, st_dat
|
||||
static void
|
||||
free_gen_fields_tbl(VALUE obj, struct gen_fields_tbl *fields_tbl)
|
||||
{
|
||||
if (UNLIKELY(rb_shape_obj_too_complex(obj))) {
|
||||
if (UNLIKELY(rb_shape_obj_too_complex_p(obj))) {
|
||||
st_free_table(fields_tbl->as.complex.table);
|
||||
}
|
||||
|
||||
@ -3727,7 +3727,7 @@ vm_weak_table_gen_fields_foreach(st_data_t key, st_data_t value, st_data_t data)
|
||||
if (!iter_data->weak_only) {
|
||||
struct gen_fields_tbl *fields_tbl = (struct gen_fields_tbl *)value;
|
||||
|
||||
if (rb_shape_obj_too_complex((VALUE)key)) {
|
||||
if (rb_shape_obj_too_complex_p((VALUE)key)) {
|
||||
st_foreach_with_replace(
|
||||
fields_tbl->as.complex.table,
|
||||
vm_weak_table_gen_fields_foreach_too_complex_i,
|
||||
@ -3889,7 +3889,7 @@ rb_gc_update_object_references(void *objspace, VALUE obj)
|
||||
update_cvc_tbl(objspace, obj);
|
||||
update_superclasses(objspace, obj);
|
||||
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
gc_ref_update_table_values_only(RCLASS_FIELDS_HASH(obj));
|
||||
}
|
||||
else {
|
||||
@ -4576,7 +4576,7 @@ rb_raw_obj_info_buitin_type(char *const buff, const size_t buff_size, const VALU
|
||||
}
|
||||
case T_OBJECT:
|
||||
{
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
size_t hash_len = rb_st_table_size(ROBJECT_FIELDS_HASH(obj));
|
||||
APPEND_F("(too_complex) len:%zu", hash_len);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ static inline st_table *
|
||||
RCLASS_FIELDS_HASH(VALUE obj)
|
||||
{
|
||||
RUBY_ASSERT(RB_TYPE_P(obj, RUBY_T_CLASS) || RB_TYPE_P(obj, RUBY_T_MODULE));
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex_p(obj));
|
||||
return (st_table *)RCLASS_FIELDS(obj);
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ static inline void
|
||||
RCLASS_SET_FIELDS_HASH(VALUE obj, const st_table *tbl)
|
||||
{
|
||||
RUBY_ASSERT(RB_TYPE_P(obj, RUBY_T_CLASS) || RB_TYPE_P(obj, RUBY_T_MODULE));
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex_p(obj));
|
||||
RCLASS_FIELDS(obj) = (VALUE *)tbl;
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ static inline uint32_t
|
||||
RCLASS_FIELDS_COUNT(VALUE obj)
|
||||
{
|
||||
RUBY_ASSERT(RB_TYPE_P(obj, RUBY_T_CLASS) || RB_TYPE_P(obj, RUBY_T_MODULE));
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
uint32_t count;
|
||||
|
||||
// "Too complex" classes could have their IV hash mutated in
|
||||
|
6
object.c
6
object.c
@ -138,7 +138,7 @@ rb_class_allocate_instance(VALUE klass)
|
||||
ROBJECT_SET_SHAPE_ID(obj, (shape_id_t)(rb_gc_heap_id_for_size(size) + FIRST_T_OBJECT_SHAPE_ID));
|
||||
|
||||
#if RUBY_DEBUG
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
||||
VALUE *ptr = ROBJECT_FIELDS(obj);
|
||||
for (size_t i = 0; i < ROBJECT_FIELDS_CAPACITY(obj); i++) {
|
||||
ptr[i] = Qundef;
|
||||
@ -520,7 +520,7 @@ rb_obj_clone_setup(VALUE obj, VALUE clone, VALUE kwfreeze)
|
||||
|
||||
if (RB_OBJ_FROZEN(obj)) {
|
||||
shape_id_t next_shape_id = rb_shape_transition_frozen(clone);
|
||||
if (!rb_shape_obj_too_complex(clone) && rb_shape_id_too_complex_p(next_shape_id)) {
|
||||
if (!rb_shape_obj_too_complex_p(clone) && rb_shape_id_too_complex_p(next_shape_id)) {
|
||||
rb_evict_ivars_to_hash(clone);
|
||||
}
|
||||
else {
|
||||
@ -544,7 +544,7 @@ rb_obj_clone_setup(VALUE obj, VALUE clone, VALUE kwfreeze)
|
||||
shape_id_t next_shape_id = rb_shape_transition_frozen(clone);
|
||||
// If we're out of shapes, but we want to freeze, then we need to
|
||||
// evacuate this clone to a hash
|
||||
if (!rb_shape_obj_too_complex(clone) && rb_shape_id_too_complex_p(next_shape_id)) {
|
||||
if (!rb_shape_obj_too_complex_p(clone) && rb_shape_id_too_complex_p(next_shape_id)) {
|
||||
rb_evict_ivars_to_hash(clone);
|
||||
}
|
||||
else {
|
||||
|
4
ractor.c
4
ractor.c
@ -3374,7 +3374,7 @@ obj_traverse_replace_i(VALUE obj, struct obj_traverse_replace_data *data)
|
||||
struct gen_fields_tbl *fields_tbl;
|
||||
rb_ivar_generic_fields_tbl_lookup(obj, &fields_tbl);
|
||||
|
||||
if (UNLIKELY(rb_shape_obj_too_complex(obj))) {
|
||||
if (UNLIKELY(rb_shape_obj_too_complex_p(obj))) {
|
||||
struct obj_traverse_replace_callback_data d = {
|
||||
.stop = false,
|
||||
.data = data,
|
||||
@ -3412,7 +3412,7 @@ obj_traverse_replace_i(VALUE obj, struct obj_traverse_replace_data *data)
|
||||
|
||||
case T_OBJECT:
|
||||
{
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
struct obj_traverse_replace_callback_data d = {
|
||||
.stop = false,
|
||||
.data = data,
|
||||
|
2
shape.c
2
shape.c
@ -1110,7 +1110,7 @@ rb_shape_rebuild_shape(rb_shape_t *initial_shape, rb_shape_t *dest_shape)
|
||||
}
|
||||
|
||||
RUBY_FUNC_EXPORTED bool
|
||||
rb_shape_obj_too_complex(VALUE obj)
|
||||
rb_shape_obj_too_complex_p(VALUE obj)
|
||||
{
|
||||
return rb_shape_too_complex_p(rb_shape_get_shape(obj));
|
||||
}
|
||||
|
12
shape.h
12
shape.h
@ -158,7 +158,7 @@ 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);
|
||||
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);
|
||||
RUBY_FUNC_EXPORTED bool rb_shape_obj_too_complex_p(VALUE obj);
|
||||
bool rb_shape_too_complex_p(rb_shape_t *shape);
|
||||
bool rb_shape_id_too_complex_p(shape_id_t shape_id);
|
||||
|
||||
@ -189,7 +189,7 @@ ROBJECT_FIELDS_CAPACITY(VALUE obj)
|
||||
RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
|
||||
// Asking for capacity doesn't make sense when the object is using
|
||||
// a hash table for storing instance variables
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
||||
return RSHAPE(ROBJECT_SHAPE_ID(obj))->capacity;
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ static inline st_table *
|
||||
ROBJECT_FIELDS_HASH(VALUE obj)
|
||||
{
|
||||
RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex_p(obj));
|
||||
return (st_table *)ROBJECT(obj)->as.heap.fields;
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ static inline void
|
||||
ROBJECT_SET_FIELDS_HASH(VALUE obj, const st_table *tbl)
|
||||
{
|
||||
RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex_p(obj));
|
||||
ROBJECT(obj)->as.heap.fields = (VALUE *)tbl;
|
||||
}
|
||||
|
||||
@ -214,12 +214,12 @@ size_t rb_id_table_size(const struct rb_id_table *tbl);
|
||||
static inline uint32_t
|
||||
ROBJECT_FIELDS_COUNT(VALUE obj)
|
||||
{
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
return (uint32_t)rb_st_table_size(ROBJECT_FIELDS_HASH(obj));
|
||||
}
|
||||
else {
|
||||
RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
||||
return RSHAPE(ROBJECT_SHAPE_ID(obj))->next_field_index;
|
||||
}
|
||||
}
|
||||
|
58
variable.c
58
variable.c
@ -1209,7 +1209,7 @@ rb_mark_generic_ivar(VALUE obj)
|
||||
st_data_t data;
|
||||
if (st_lookup(generic_fields_tbl_no_ractor_check(obj), (st_data_t)obj, &data)) {
|
||||
struct gen_fields_tbl *fields_tbl = (struct gen_fields_tbl *)data;
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
rb_mark_tbl_no_pin(fields_tbl->as.complex.table);
|
||||
}
|
||||
else {
|
||||
@ -1225,7 +1225,7 @@ rb_free_generic_ivar(VALUE obj)
|
||||
{
|
||||
st_data_t key = (st_data_t)obj, value;
|
||||
|
||||
bool too_complex = rb_shape_obj_too_complex(obj);
|
||||
bool too_complex = rb_shape_obj_too_complex_p(obj);
|
||||
|
||||
if (st_delete(generic_fields_tbl_no_ractor_check(obj), &key, &value)) {
|
||||
struct gen_fields_tbl *fields_tbl = (struct gen_fields_tbl *)value;
|
||||
@ -1244,7 +1244,7 @@ rb_generic_ivar_memsize(VALUE obj)
|
||||
struct gen_fields_tbl *fields_tbl;
|
||||
|
||||
if (rb_gen_fields_tbl_get(obj, 0, &fields_tbl)) {
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
return sizeof(struct gen_fields_tbl) + st_memsize(fields_tbl->as.complex.table);
|
||||
}
|
||||
else {
|
||||
@ -1284,7 +1284,7 @@ gen_fields_tbl_count(VALUE obj, const struct gen_fields_tbl *fields_tbl)
|
||||
uint32_t i;
|
||||
size_t n = 0;
|
||||
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
n = st_table_size(fields_tbl->as.complex.table);
|
||||
}
|
||||
else {
|
||||
@ -1302,7 +1302,7 @@ VALUE
|
||||
rb_field_get(VALUE obj, rb_shape_t *target_shape)
|
||||
{
|
||||
RUBY_ASSERT(!SPECIAL_CONST_P(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
||||
RUBY_ASSERT(target_shape->type == SHAPE_IVAR || target_shape->type == SHAPE_OBJ_ID);
|
||||
|
||||
attr_index_t attr_index = target_shape->next_field_index - 1;
|
||||
@ -1349,7 +1349,7 @@ rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
|
||||
shape_id = RCLASS_SHAPE_ID(obj);
|
||||
#endif
|
||||
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
st_table * iv_table = RCLASS_FIELDS_HASH(obj);
|
||||
if (rb_st_lookup(iv_table, (st_data_t)id, (st_data_t *)&val)) {
|
||||
found = true;
|
||||
@ -1390,7 +1390,7 @@ rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
|
||||
#if !SHAPE_IN_BASIC_FLAGS
|
||||
shape_id = ROBJECT_SHAPE_ID(obj);
|
||||
#endif
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
st_table * iv_table = ROBJECT_FIELDS_HASH(obj);
|
||||
VALUE val;
|
||||
if (rb_st_lookup(iv_table, (st_data_t)id, (st_data_t *)&val)) {
|
||||
@ -1401,7 +1401,7 @@ rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
|
||||
}
|
||||
}
|
||||
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
||||
ivar_list = ROBJECT_FIELDS(obj);
|
||||
break;
|
||||
}
|
||||
@ -1410,7 +1410,7 @@ rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
|
||||
struct gen_fields_tbl *fields_tbl;
|
||||
rb_gen_fields_tbl_get(obj, id, &fields_tbl);
|
||||
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
VALUE val;
|
||||
if (rb_st_lookup(fields_tbl->as.complex.table, (st_data_t)id, (st_data_t *)&val)) {
|
||||
return val;
|
||||
@ -1467,7 +1467,7 @@ rb_ivar_delete(VALUE obj, ID id, VALUE undef)
|
||||
}
|
||||
|
||||
if (!rb_shape_transition_shape_remove_ivar(obj, id, shape, &val)) {
|
||||
if (!rb_shape_obj_too_complex(obj)) {
|
||||
if (!rb_shape_obj_too_complex_p(obj)) {
|
||||
rb_evict_fields_to_hash(obj);
|
||||
}
|
||||
|
||||
@ -1510,7 +1510,7 @@ rb_attr_delete(VALUE obj, ID id)
|
||||
static void
|
||||
obj_transition_too_complex(VALUE obj, st_table *table)
|
||||
{
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
||||
shape_id_t shape_id = rb_shape_transition_complex(obj);
|
||||
|
||||
VALUE *old_fields = NULL;
|
||||
@ -1571,7 +1571,7 @@ void
|
||||
rb_obj_init_too_complex(VALUE obj, st_table *table)
|
||||
{
|
||||
// This method is meant to be called on newly allocated object.
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
||||
RUBY_ASSERT(rb_shape_canonical_p(rb_shape_get_shape(obj)));
|
||||
RUBY_ASSERT(rb_shape_get_shape(obj)->next_field_index == 0);
|
||||
|
||||
@ -1584,20 +1584,20 @@ rb_evict_fields_to_hash(VALUE obj)
|
||||
{
|
||||
void rb_obj_copy_fields_to_hash_table(VALUE obj, st_table *table);
|
||||
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
||||
|
||||
rb_shape_t *shape = rb_shape_get_shape(obj);
|
||||
st_table *table = st_init_numtable_with_size(shape->next_field_index);
|
||||
rb_obj_copy_fields_to_hash_table(obj, table);
|
||||
obj_transition_too_complex(obj, table);
|
||||
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex_p(obj));
|
||||
}
|
||||
|
||||
void
|
||||
rb_evict_ivars_to_hash(VALUE obj)
|
||||
{
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
||||
|
||||
st_table *table = st_init_numtable_with_size(rb_ivar_count(obj));
|
||||
|
||||
@ -1605,7 +1605,7 @@ rb_evict_ivars_to_hash(VALUE obj)
|
||||
rb_obj_copy_ivs_to_hash_table(obj, table);
|
||||
obj_transition_too_complex(obj, table);
|
||||
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex_p(obj));
|
||||
}
|
||||
|
||||
struct general_ivar_set_result {
|
||||
@ -1664,7 +1664,7 @@ general_ivar_set(VALUE obj, ID id, VALUE val, void *data,
|
||||
|
||||
too_complex:
|
||||
{
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex_p(obj));
|
||||
|
||||
st_table *table = too_complex_table_func(obj, data);
|
||||
result.existing = st_insert(table, (st_data_t)id, (st_data_t)val);
|
||||
@ -1756,7 +1756,7 @@ generic_fields_lookup_ensure_size(st_data_t *k, st_data_t *v, st_data_t u, int e
|
||||
static VALUE *
|
||||
generic_ivar_set_shape_fields(VALUE obj, void *data)
|
||||
{
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
||||
|
||||
struct gen_fields_lookup_ensure_size *fields_lookup = data;
|
||||
|
||||
@ -1816,7 +1816,7 @@ generic_ivar_set_too_complex_table(VALUE obj, void *data)
|
||||
FL_SET_RAW(obj, FL_EXIVAR);
|
||||
}
|
||||
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex_p(obj));
|
||||
|
||||
return fields_tbl->as.complex.table;
|
||||
}
|
||||
@ -1859,7 +1859,7 @@ generic_field_set(VALUE obj, rb_shape_t *target_shape, VALUE val)
|
||||
void
|
||||
rb_ensure_iv_list_size(VALUE obj, uint32_t current_capacity, uint32_t new_capacity)
|
||||
{
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
||||
|
||||
if (RBASIC(obj)->flags & ROBJECT_EMBED) {
|
||||
VALUE *ptr = ROBJECT_FIELDS(obj);
|
||||
@ -1897,7 +1897,7 @@ rb_obj_copy_fields_to_hash_table(VALUE obj, st_table *table)
|
||||
static VALUE *
|
||||
obj_ivar_set_shape_fields(VALUE obj, void *_data)
|
||||
{
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
||||
|
||||
return ROBJECT_FIELDS(obj);
|
||||
}
|
||||
@ -1923,7 +1923,7 @@ obj_ivar_set_transition_too_complex(VALUE obj, void *_data)
|
||||
static st_table *
|
||||
obj_ivar_set_too_complex_table(VALUE obj, void *_data)
|
||||
{
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex_p(obj));
|
||||
|
||||
return ROBJECT_FIELDS_HASH(obj);
|
||||
}
|
||||
@ -2014,7 +2014,7 @@ void rb_obj_freeze_inline(VALUE x)
|
||||
|
||||
// If we're transitioning from "not complex" to "too complex"
|
||||
// then evict ivars. This can happen if we run out of shapes
|
||||
if (rb_shape_id_too_complex_p(next_shape_id) && !rb_shape_obj_too_complex(x)) {
|
||||
if (rb_shape_id_too_complex_p(next_shape_id) && !rb_shape_obj_too_complex_p(x)) {
|
||||
rb_evict_fields_to_hash(x);
|
||||
}
|
||||
rb_shape_set_shape_id(x, next_shape_id);
|
||||
@ -2091,7 +2091,7 @@ rb_ivar_defined(VALUE obj, ID id)
|
||||
attr_index_t index;
|
||||
|
||||
if (SPECIAL_CONST_P(obj)) return Qfalse;
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
VALUE idx;
|
||||
st_table *table = NULL;
|
||||
switch (BUILTIN_TYPE(obj)) {
|
||||
@ -2156,7 +2156,7 @@ iterate_over_shapes_with_callback(rb_shape_t *shape, rb_ivar_foreach_callback_fu
|
||||
VALUE * iv_list;
|
||||
switch (BUILTIN_TYPE(itr_data->obj)) {
|
||||
case T_OBJECT:
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(itr_data->obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(itr_data->obj));
|
||||
iv_list = ROBJECT_FIELDS(itr_data->obj);
|
||||
break;
|
||||
case T_CLASS:
|
||||
@ -2231,7 +2231,7 @@ gen_fields_each(VALUE obj, rb_ivar_foreach_callback_func *func, st_data_t arg, b
|
||||
.ivar_only = ivar_only,
|
||||
};
|
||||
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
rb_st_foreach(fields_tbl->as.complex.table, each_hash_iv, (st_data_t)&itr_data);
|
||||
}
|
||||
else {
|
||||
@ -2252,7 +2252,7 @@ class_fields_each(VALUE obj, rb_ivar_foreach_callback_func *func, st_data_t arg,
|
||||
.ivar_only = ivar_only,
|
||||
};
|
||||
|
||||
if (rb_shape_obj_too_complex(obj)) {
|
||||
if (rb_shape_obj_too_complex_p(obj)) {
|
||||
rb_st_foreach(RCLASS_FIELDS_HASH(obj), each_hash_iv, (st_data_t)&itr_data);
|
||||
}
|
||||
else {
|
||||
@ -4509,7 +4509,7 @@ rb_iv_set(VALUE obj, const char *name, VALUE val)
|
||||
static VALUE *
|
||||
class_ivar_set_shape_fields(VALUE obj, void *_data)
|
||||
{
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
||||
|
||||
return RCLASS_FIELDS(obj);
|
||||
}
|
||||
@ -4535,7 +4535,7 @@ class_ivar_set_transition_too_complex(VALUE obj, void *_data)
|
||||
static st_table *
|
||||
class_ivar_set_too_complex_table(VALUE obj, void *_data)
|
||||
{
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex_p(obj));
|
||||
|
||||
return RCLASS_FIELDS_HASH(obj);
|
||||
}
|
||||
|
@ -1546,7 +1546,7 @@ vm_setivar(VALUE obj, ID id, VALUE val, shape_id_t dest_shape_id, attr_index_t i
|
||||
|
||||
VALUE *ptr = ROBJECT_FIELDS(obj);
|
||||
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex(obj));
|
||||
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
||||
RB_OBJ_WRITE(obj, &ptr[index], val);
|
||||
|
||||
RB_DEBUG_COUNTER_INC(ivar_set_ic_hit);
|
||||
|
@ -100,7 +100,7 @@ fn main() {
|
||||
.allowlist_function("rb_shape_get_iv_index")
|
||||
.allowlist_function("rb_shape_get_next_no_warnings")
|
||||
.allowlist_function("rb_shape_id")
|
||||
.allowlist_function("rb_shape_obj_too_complex")
|
||||
.allowlist_function("rb_shape_obj_too_complex_p")
|
||||
.allowlist_function("rb_shape_too_complex_p")
|
||||
.allowlist_var("SHAPE_ID_NUM_BITS")
|
||||
|
||||
|
@ -441,7 +441,7 @@ impl VALUE {
|
||||
}
|
||||
|
||||
pub fn shape_too_complex(self) -> bool {
|
||||
unsafe { rb_shape_obj_too_complex(self) }
|
||||
unsafe { rb_shape_obj_too_complex_p(self) }
|
||||
}
|
||||
|
||||
pub fn shape_id_of(self) -> u32 {
|
||||
|
2
yjit/src/cruby_bindings.inc.rs
generated
2
yjit/src/cruby_bindings.inc.rs
generated
@ -1091,7 +1091,7 @@ extern "C" {
|
||||
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_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_p(obj: VALUE) -> bool;
|
||||
pub fn rb_shape_too_complex_p(shape: *mut rb_shape_t) -> bool;
|
||||
pub fn rb_shape_get_next_no_warnings(
|
||||
shape: *mut rb_shape_t,
|
||||
|
@ -113,7 +113,7 @@ fn main() {
|
||||
.allowlist_function("rb_shape_get_iv_index")
|
||||
.allowlist_function("rb_shape_get_next_no_warnings")
|
||||
.allowlist_function("rb_shape_id")
|
||||
.allowlist_function("rb_shape_obj_too_complex")
|
||||
.allowlist_function("rb_shape_obj_too_complex_p")
|
||||
.allowlist_var("SHAPE_ID_NUM_BITS")
|
||||
|
||||
// From ruby/internal/intern/object.h
|
||||
|
@ -478,7 +478,7 @@ impl VALUE {
|
||||
}
|
||||
|
||||
pub fn shape_too_complex(self) -> bool {
|
||||
unsafe { rb_shape_obj_too_complex(self) }
|
||||
unsafe { rb_shape_obj_too_complex_p(self) }
|
||||
}
|
||||
|
||||
pub fn shape_id_of(self) -> u32 {
|
||||
|
2
zjit/src/cruby_bindings.inc.rs
generated
2
zjit/src/cruby_bindings.inc.rs
generated
@ -871,7 +871,7 @@ unsafe extern "C" {
|
||||
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_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_p(obj: VALUE) -> bool;
|
||||
pub fn rb_shape_get_next_no_warnings(
|
||||
shape: *mut rb_shape_t,
|
||||
obj: VALUE,
|
||||
|
Loading…
x
Reference in New Issue
Block a user