aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKatherine Oelsner <octokatherine@github.com>2023-10-18 14:05:48 -0700
committerJohn Hawthorn <john@hawthorn.email>2023-10-18 15:01:13 -0700
commita7032b80af18b7f2eb3552c5231ca36a8c69f1be (patch)
tree2a4fe0a060e061570061054c79b136373fb36d9e
parentde0764501987aff0f9b19594a2cbd5583ccce660 (diff)
downloadruby-a7032b80af18b7f2eb3552c5231ca36a8c69f1be.tar.gz
Revert "shape.h: Make attr_index_t uint8_t"
This reverts commit e3afc212ec059525fe4e5387b2a3be920ffe0f0e.
-rw-r--r--rjit_c.rb4
-rw-r--r--shape.h5
-rw-r--r--yjit/src/codegen.rs6
-rw-r--r--yjit/src/cruby_bindings.inc.rs4
4 files changed, 10 insertions, 9 deletions
diff --git a/rjit_c.rb b/rjit_c.rb
index 5a4c2446a6..72e8221cbc 100644
--- a/rjit_c.rb
+++ b/rjit_c.rb
@@ -898,7 +898,7 @@ module RubyVM::RJIT # :nodoc: all
end
def C.attr_index_t
- @attr_index_t ||= CType::Immediate.parse("uint8_t")
+ @attr_index_t ||= CType::Immediate.parse("uint32_t")
end
def C.iseq_inline_constant_cache
@@ -1479,7 +1479,7 @@ module RubyVM::RJIT # :nodoc: all
edges: [CType::Pointer.new { self.rb_id_table }, Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), edges)")],
edge_name: [self.ID, Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), edge_name)")],
next_iv_index: [self.attr_index_t, Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), next_iv_index)")],
- capacity: [self.attr_index_t, Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), capacity)")],
+ capacity: [CType::Immediate.parse("uint32_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), capacity)")],
type: [CType::Immediate.parse("uint8_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), type)")],
size_pool_index: [CType::Immediate.parse("uint8_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), size_pool_index)")],
parent_id: [self.shape_id_t, Primitive.cexpr!("OFFSETOF((*((struct rb_shape *)NULL)), parent_id)")],
diff --git a/shape.h b/shape.h
index 1b2221ad76..5689b48067 100644
--- a/shape.h
+++ b/shape.h
@@ -6,11 +6,12 @@
#if (SIZEOF_UINT64_T <= SIZEOF_VALUE)
#define SIZEOF_SHAPE_T 4
#define SHAPE_IN_BASIC_FLAGS 1
+typedef uint32_t attr_index_t;
#else
#define SIZEOF_SHAPE_T 2
#define SHAPE_IN_BASIC_FLAGS 0
+typedef uint16_t attr_index_t;
#endif
-typedef uint8_t attr_index_t;
#define MAX_IVARS (attr_index_t)(-1)
@@ -43,7 +44,7 @@ struct rb_shape {
struct rb_id_table * edges; // id_table from ID (ivar) to next shape
ID edge_name; // ID (ivar) for transition from parent to rb_shape
attr_index_t next_iv_index;
- attr_index_t capacity; // Total capacity of the object with this shape
+ uint32_t capacity; // Total capacity of the object with this shape
uint8_t type;
uint8_t size_pool_index;
shape_id_t parent_id;
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index 1636a4d74b..880338f88d 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -2264,7 +2264,7 @@ fn gen_get_ivar(
let ivar_index = unsafe {
let shape_id = comptime_receiver.shape_id_of();
let shape = rb_shape_get_shape_by_id(shape_id);
- let mut ivar_index: u8 = 0;
+ let mut ivar_index: u32 = 0;
if rb_shape_get_iv_index(shape, ivar_name, &mut ivar_index) {
Some(ivar_index as usize)
} else {
@@ -2450,7 +2450,7 @@ fn gen_setinstancevariable(
let ivar_index = if !shape_too_complex {
let shape_id = comptime_receiver.shape_id_of();
let shape = unsafe { rb_shape_get_shape_by_id(shape_id) };
- let mut ivar_index: u8 = 0;
+ let mut ivar_index: u32 = 0;
if unsafe { rb_shape_get_iv_index(shape, ivar_name, &mut ivar_index) } {
Some(ivar_index as usize)
} else {
@@ -2717,7 +2717,7 @@ fn gen_definedivar(
let shape_id = comptime_receiver.shape_id_of();
let ivar_exists = unsafe {
let shape = rb_shape_get_shape_by_id(shape_id);
- let mut ivar_index: u8 = 0;
+ let mut ivar_index: u32 = 0;
rb_shape_get_iv_index(shape, ivar_name, &mut ivar_index)
};
diff --git a/yjit/src/cruby_bindings.inc.rs b/yjit/src/cruby_bindings.inc.rs
index 3cc213ce83..ac70d4a334 100644
--- a/yjit/src/cruby_bindings.inc.rs
+++ b/yjit/src/cruby_bindings.inc.rs
@@ -588,7 +588,7 @@ pub const VM_ENV_FLAG_ESCAPED: vm_frame_env_flags = 4;
pub const VM_ENV_FLAG_WB_REQUIRED: vm_frame_env_flags = 8;
pub const VM_ENV_FLAG_ISOLATED: vm_frame_env_flags = 16;
pub type vm_frame_env_flags = u32;
-pub type attr_index_t = u8;
+pub type attr_index_t = u32;
pub type shape_id_t = u32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
@@ -596,7 +596,7 @@ pub struct rb_shape {
pub edges: *mut rb_id_table,
pub edge_name: ID,
pub next_iv_index: attr_index_t,
- pub capacity: attr_index_t,
+ pub capacity: u32,
pub type_: u8,
pub size_pool_index: u8,
pub parent_id: shape_id_t,