diff --git a/gc.c b/gc.c index c720971b70..fe5c5cff0d 100644 --- a/gc.c +++ b/gc.c @@ -373,7 +373,7 @@ rb_gc_get_shape(VALUE obj) void rb_gc_set_shape(VALUE obj, uint32_t shape_id) { - rb_shape_set_shape_id(obj, (uint32_t)shape_id); + rb_obj_set_shape_id(obj, (uint32_t)shape_id); } uint32_t diff --git a/object.c b/object.c index 97fe0afa74..99950d477f 100644 --- a/object.c +++ b/object.c @@ -362,7 +362,7 @@ rb_obj_copy_ivar(VALUE dest, VALUE obj) } rb_shape_copy_fields(dest, dest_buf, dest_shape_id, obj, src_buf, src_shape_id); - rb_shape_set_shape_id(dest, dest_shape_id); + rb_obj_set_shape_id(dest, dest_shape_id); } static void @@ -500,7 +500,7 @@ rb_obj_clone_setup(VALUE obj, VALUE clone, VALUE kwfreeze) rb_evict_ivars_to_hash(clone); } else { - rb_shape_set_shape_id(clone, next_shape_id); + rb_obj_set_shape_id(clone, next_shape_id); } } break; @@ -524,7 +524,7 @@ rb_obj_clone_setup(VALUE obj, VALUE clone, VALUE kwfreeze) rb_evict_ivars_to_hash(clone); } else { - rb_shape_set_shape_id(clone, next_shape_id); + rb_obj_set_shape_id(clone, next_shape_id); } break; } diff --git a/shape.h b/shape.h index ee522a48e5..91f1931290 100644 --- a/shape.h +++ b/shape.h @@ -230,7 +230,7 @@ RBASIC_FIELDS_COUNT(VALUE obj) shape_id_t rb_shape_traverse_from_new_root(shape_id_t initial_shape_id, shape_id_t orig_shape_id); -bool rb_shape_set_shape_id(VALUE obj, shape_id_t shape_id); +bool rb_obj_set_shape_id(VALUE obj, shape_id_t shape_id); static inline bool rb_shape_obj_has_id(VALUE obj) diff --git a/string.c b/string.c index a922c9269a..faa4a16106 100644 --- a/string.c +++ b/string.c @@ -959,8 +959,7 @@ static VALUE setup_fake_str(struct RString *fake_str, const char *name, long len, int encidx) { fake_str->basic.flags = T_STRING|RSTRING_NOEMBED|STR_NOFREE|STR_FAKESTR; - - rb_shape_set_shape_id((VALUE)fake_str, 0); + RBASIC_SET_SHAPE_ID((VALUE)fake_str, ROOT_SHAPE_ID); if (!name) { RUBY_ASSERT_ALWAYS(len == 0); diff --git a/variable.c b/variable.c index 5c83ec955a..c29ca02390 100644 --- a/variable.c +++ b/variable.c @@ -1554,7 +1554,7 @@ rb_ivar_delete(VALUE obj, ID id, VALUE undef) MEMCPY(ROBJECT_FIELDS(obj), fields, VALUE, new_fields_count); xfree(fields); } - rb_shape_set_shape_id(obj, next_shape_id); + rb_obj_set_shape_id(obj, next_shape_id); if (locked) { RB_VM_LOCK_LEAVE_LEV(&lev); @@ -1617,13 +1617,13 @@ obj_transition_too_complex(VALUE obj, st_table *table) if (!(RBASIC(obj)->flags & ROBJECT_EMBED)) { old_fields = ROBJECT_FIELDS(obj); } - rb_shape_set_shape_id(obj, shape_id); + rb_obj_set_shape_id(obj, shape_id); ROBJECT_SET_FIELDS_HASH(obj, table); break; case T_CLASS: case T_MODULE: old_fields = RCLASS_PRIME_FIELDS(obj); - rb_shape_set_shape_id(obj, shape_id); + rb_obj_set_shape_id(obj, shape_id); RCLASS_SET_FIELDS_HASH(obj, table); break; default: @@ -1638,7 +1638,7 @@ obj_transition_too_complex(VALUE obj, st_table *table) * and hold the table because the xmalloc could trigger a GC * compaction. We want the table to be updated rather than * the original fields. */ - rb_shape_set_shape_id(obj, shape_id); + rb_obj_set_shape_id(obj, shape_id); old_fields_tbl->as.complex.table = table; old_fields = (VALUE *)old_fields_tbl; } @@ -1647,7 +1647,7 @@ obj_transition_too_complex(VALUE obj, st_table *table) fields_tbl->as.complex.table = table; st_insert(gen_ivs, (st_data_t)obj, (st_data_t)fields_tbl); - rb_shape_set_shape_id(obj, shape_id); + rb_obj_set_shape_id(obj, shape_id); } } @@ -1831,7 +1831,7 @@ generic_fields_lookup_ensure_size(st_data_t *k, st_data_t *v, st_data_t u, int e fields_lookup->fields_tbl = fields_tbl; if (fields_lookup->shape_id) { - rb_shape_set_shape_id(fields_lookup->obj, fields_lookup->shape_id); + rb_obj_set_shape_id(fields_lookup->obj, fields_lookup->shape_id); } return ST_CONTINUE; @@ -1986,7 +1986,7 @@ obj_ivar_set_shape_resize_fields(VALUE obj, attr_index_t old_capa, attr_index_t static void obj_ivar_set_set_shape_id(VALUE obj, shape_id_t shape_id, void *_data) { - rb_shape_set_shape_id(obj, shape_id); + rb_obj_set_shape_id(obj, shape_id); } static void @@ -2038,7 +2038,7 @@ rb_vm_set_ivar_id(VALUE obj, ID id, VALUE val) } bool -rb_shape_set_shape_id(VALUE obj, shape_id_t shape_id) +rb_obj_set_shape_id(VALUE obj, shape_id_t shape_id) { if (rb_obj_shape_id(obj) == shape_id) { return false; @@ -2063,7 +2063,7 @@ void rb_obj_freeze_inline(VALUE x) if (rb_shape_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); + rb_obj_set_shape_id(x, next_shape_id); if (RBASIC_CLASS(x)) { rb_freeze_singleton_class(x); @@ -2354,7 +2354,7 @@ rb_copy_generic_ivar(VALUE dest, VALUE obj) } if (!RSHAPE(dest_shape_id)->capacity) { - rb_shape_set_shape_id(dest, dest_shape_id); + rb_obj_set_shape_id(dest, dest_shape_id); FL_UNSET(dest, FL_EXIVAR); return; } @@ -2375,7 +2375,7 @@ rb_copy_generic_ivar(VALUE dest, VALUE obj) st_insert(generic_fields_tbl_no_ractor_check(obj), (st_data_t)dest, (st_data_t)new_fields_tbl); } - rb_shape_set_shape_id(dest, dest_shape_id); + rb_obj_set_shape_id(dest, dest_shape_id); } return; @@ -4671,7 +4671,7 @@ class_ivar_set_shape_resize_fields(VALUE obj, attr_index_t _old_capa, attr_index static void class_ivar_set_set_shape_id(VALUE obj, shape_id_t shape_id, void *_data) { - rb_shape_set_shape_id(obj, shape_id); + rb_obj_set_shape_id(obj, shape_id); } static void