summaryrefslogtreecommitdiff
path: root/yjit
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-05-27 12:57:03 +0200
committerJean Boussier <[email protected]>2025-05-27 15:34:02 +0200
commita59835e1d53d3fb673978e93417f4080774f905a ()
tree9e270ff8d69e6bee682bcaf93f6b517808880b6a /yjit
parente535f8248b1ad9f18cfc8134dd7e8056d97a6244 (diff)
Refactor `rb_shape_get_iv_index` to take a `shape_id_t`
Further reduce exposure of `rb_shape_t`.
Notes: Merged: https://.com/ruby/ruby/pull/13450
-rw-r--r--yjit/src/codegen.rs9
-rw-r--r--yjit/src/cruby_bindings.inc.rs2
2 files changed, 4 insertions, 7 deletions
@@ -2904,9 +2904,8 @@ fn gen_get_ivar(
let ivar_index = unsafe {
let shape_id = comptime_receiver.shape_id_of();
- let shape = rb_shape_lookup(shape_id);
let mut ivar_index: u32 = 0;
- if rb_shape_get_iv_index(shape, ivar_name, &mut ivar_index) {
Some(ivar_index as usize)
} else {
None
@@ -3107,9 +3106,8 @@ fn gen_set_ivar(
let shape_too_complex = comptime_receiver.shape_too_complex();
let ivar_index = if !shape_too_complex {
let shape_id = comptime_receiver.shape_id_of();
- let shape = unsafe { rb_shape_lookup(shape_id) };
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 {
None
@@ -3397,9 +3395,8 @@ fn gen_definedivar(
let shape_id = comptime_receiver.shape_id_of();
let ivar_exists = unsafe {
- let shape = rb_shape_lookup(shape_id);
let mut ivar_index: u32 = 0;
- rb_shape_get_iv_index(shape, ivar_name, &mut ivar_index)
};
// Guard heap object (recv_opnd must be used before stack_pop)
@@ -1142,7 +1142,7 @@ extern "C" {
pub fn rb_shape_id_offset() -> i32;
pub fn rb_shape_lookup(shape_id: shape_id_t) -> *mut rb_shape_t;
pub fn rb_obj_shape_id(obj: VALUE) -> shape_id_t;
- pub fn rb_shape_get_iv_index(shape: *mut rb_shape_t, id: ID, value: *mut attr_index_t) -> bool;
pub fn rb_shape_obj_too_complex_p(obj: VALUE) -> bool;
pub fn rb_shape_too_complex_p(shape: *mut rb_shape_t) -> bool;
pub fn rb_shape_transition_add_ivar_no_warnings(obj: VALUE, id: ID) -> shape_id_t;