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`.
This commit is contained in:
Jean Boussier 2025-04-30 09:42:57 +02:00
parent 4e30b77b90
commit 0ea210d1ea
Notes: git 2025-05-08 05:58:20 +00:00
26 changed files with 354 additions and 354 deletions

View file

@ -2938,7 +2938,7 @@ fn gen_get_ivar(
}
Some(ivar_index) => {
if embed_test_result {
// See ROBJECT_IVPTR() from include/ruby/internal/core/robject.h
// See ROBJECT_FIELDS() from include/ruby/internal/core/robject.h
// Load the variable
let offs = ROBJECT_OFFSET_AS_ARY as i32 + (ivar_index * SIZEOF_VALUE) as i32;
@ -2951,7 +2951,7 @@ fn gen_get_ivar(
// Compile time value is *not* embedded.
// Get a pointer to the extended table
let tbl_opnd = asm.load(Opnd::mem(64, recv, ROBJECT_OFFSET_AS_HEAP_IVPTR as i32));
let tbl_opnd = asm.load(Opnd::mem(64, recv, ROBJECT_OFFSET_AS_HEAP_FIELDS as i32));
// Read the ivar from the extended table
let ivar_opnd = Opnd::mem(64, tbl_opnd, (SIZEOF_VALUE * ivar_index) as i32);
@ -3020,7 +3020,7 @@ fn gen_write_iv(
// Compile time value is *not* embedded.
// Get a pointer to the extended table
let tbl_opnd = asm.load(Opnd::mem(64, recv, ROBJECT_OFFSET_AS_HEAP_IVPTR as i32));
let tbl_opnd = asm.load(Opnd::mem(64, recv, ROBJECT_OFFSET_AS_HEAP_FIELDS as i32));
// Write the ivar in to the extended table
let ivar_opnd = Opnd::mem(64, tbl_opnd, (SIZEOF_VALUE * ivar_index) as i32);
@ -3126,7 +3126,7 @@ fn gen_set_ivar(
let needs_extension = unsafe { (*current_shape).capacity != (*next_shape).capacity };
// We can write to the object, but we need to transition the shape
let ivar_index = unsafe { (*current_shape).next_iv_index } as usize;
let ivar_index = unsafe { (*current_shape).next_field_index } as usize;
let needs_extension = if needs_extension {
Some((current_capacity, unsafe { (*next_shape).capacity }))

View file

@ -648,7 +648,7 @@ pub type redblack_node_t = redblack_node;
pub struct rb_shape {
pub edges: *mut rb_id_table,
pub edge_name: ID,
pub next_iv_index: attr_index_t,
pub next_field_index: attr_index_t,
pub capacity: attr_index_t,
pub type_: u8,
pub heap_index: u8,
@ -973,7 +973,7 @@ pub const DEFINED_REF: defined_type = 15;
pub const DEFINED_FUNC: defined_type = 16;
pub const DEFINED_CONST_FROM: defined_type = 17;
pub type defined_type = u32;
pub const ROBJECT_OFFSET_AS_HEAP_IVPTR: robject_offsets = 16;
pub const ROBJECT_OFFSET_AS_HEAP_FIELDS: robject_offsets = 16;
pub const ROBJECT_OFFSET_AS_ARY: robject_offsets = 16;
pub type robject_offsets = u32;
pub const RUBY_OFFSET_RSTRING_LEN: rstring_offsets = 16;