diff options
author | Jean Boussier <[email protected]> | 2025-04-30 09:42:57 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2025-05-08 07:58:05 +0200 |
commit | 0ea210d1ea257162642969edce665935cc87c643 (patch) | |
tree | 501f2563c5f81e19c408e32cda63b823a5785df9 /object.c | |
parent | 4e30b77b90e463997de265af1e7a5819b4c46fcc (diff) |
Rename `ivptr` -> `fields`, `next_iv_index` -> `next_field_index`
Ivars will longer be the only thing stored inline
via shapes, so keeping the `iv_index` and `ivptr` names
would be confusing.
Instance variables won't be the only thing stored inline
via shapes, so keeping the `ivptr` name would be confusing.
`field` encompass anything that can be stored in a VALUE array.
Similarly, `gen_ivtbl` becomes `gen_fields_tbl`.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13159
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -95,9 +95,9 @@ static VALUE rb_cFalseClass_to_s; /*! \endcond */ size_t -rb_obj_embedded_size(uint32_t numiv) +rb_obj_embedded_size(uint32_t fields_count) { - return offsetof(struct RObject, as.ary) + (sizeof(VALUE) * numiv); + return offsetof(struct RObject, as.ary) + (sizeof(VALUE) * fields_count); } VALUE @@ -139,8 +139,8 @@ rb_class_allocate_instance(VALUE klass) #if RUBY_DEBUG RUBY_ASSERT(!rb_shape_obj_too_complex(obj)); - VALUE *ptr = ROBJECT_IVPTR(obj); - for (size_t i = 0; i < ROBJECT_IV_CAPACITY(obj); i++) { + VALUE *ptr = ROBJECT_FIELDS(obj); + for (size_t i = 0; i < ROBJECT_FIELDS_CAPACITY(obj); i++) { ptr[i] = Qundef; } #endif @@ -333,13 +333,13 @@ rb_obj_copy_ivar(VALUE dest, VALUE obj) if (rb_shape_obj_too_complex(obj)) { // obj is TOO_COMPLEX so we can copy its iv_hash - st_table *table = st_copy(ROBJECT_IV_HASH(obj)); + st_table *table = st_copy(ROBJECT_FIELDS_HASH(obj)); rb_obj_convert_to_too_complex(dest, table); return; } - uint32_t src_num_ivs = RBASIC_IV_COUNT(obj); + uint32_t src_num_ivs = RBASIC_FIELDS_COUNT(obj); rb_shape_t *shape_to_set_on_dest = src_shape; VALUE * src_buf; VALUE * dest_buf; @@ -353,8 +353,8 @@ rb_obj_copy_ivar(VALUE dest, VALUE obj) shape_to_set_on_dest = rb_shape_get_parent(src_shape); } - src_buf = ROBJECT_IVPTR(obj); - dest_buf = ROBJECT_IVPTR(dest); + src_buf = ROBJECT_FIELDS(obj); + dest_buf = ROBJECT_FIELDS(dest); rb_shape_t *initial_shape = rb_shape_get_shape(dest); @@ -374,7 +374,7 @@ rb_obj_copy_ivar(VALUE dest, VALUE obj) RUBY_ASSERT(src_num_ivs <= shape_to_set_on_dest->capacity || rb_shape_id(shape_to_set_on_dest) == OBJ_TOO_COMPLEX_SHAPE_ID); if (initial_shape->capacity < shape_to_set_on_dest->capacity) { rb_ensure_iv_list_size(dest, initial_shape->capacity, shape_to_set_on_dest->capacity); - dest_buf = ROBJECT_IVPTR(dest); + dest_buf = ROBJECT_FIELDS(dest); } MEMCPY(dest_buf, src_buf, VALUE, src_num_ivs); |