diff options
author | Jean Boussier <[email protected]> | 2025-05-08 20:17:09 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2025-05-09 10:22:51 +0200 |
commit | 3f7c0af05191c6120db1617fef1d5be18151dfe6 (patch) | |
tree | 71e00eadbb496572bba83ffde26bd6895b07c463 /variable.c | |
parent | 677d075c2901198aad2f17b7d9f07af021c5e974 (diff) |
Rename `rb_shape_obj_too_complex` -> `rb_shape_obj_too_complex_p`
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13283
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/variable.c b/variable.c index a33af83cef..f914e5a8f8 100644 --- a/variable.c +++ b/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); } |