diff options
author | Jemma Issroff <[email protected]> | 2022-12-02 12:33:20 -0500 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2022-12-02 12:53:51 -0800 |
commit | 4c5e89791b2e5e168aadb949c90f804736a472bd (patch) | |
tree | 105b2fcc73e3409abf84e26b5eb5718dcc16a559 /yjit/src | |
parent | 606653e43a8207e15d6c3b450754d2a8bd349fc9 (diff) |
Extracted rb_shape_id_offset
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6767
Diffstat (limited to 'yjit/src')
-rw-r--r-- | yjit/src/codegen.rs | 12 | ||||
-rw-r--r-- | yjit/src/cruby_bindings.inc.rs | 3 |
2 files changed, 9 insertions, 6 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index 14ce15a54e..f904c7e0e1 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -2046,8 +2046,8 @@ fn gen_get_ivar( let expected_shape = unsafe { rb_shape_get_shape_id(comptime_receiver) }; let shape_bit_size = unsafe { rb_shape_id_num_bits() }; // either 16 or 32 depending on RUBY_DEBUG - let shape_byte_size = shape_bit_size / 8; - let shape_opnd = Opnd::mem(shape_bit_size, recv, RUBY_OFFSET_RBASIC_FLAGS + (8 - shape_byte_size as i32)); + let shape_id_offset = unsafe { rb_shape_id_offset() }; + let shape_opnd = Opnd::mem(shape_bit_size, recv, shape_id_offset); asm.comment("guard shape"); asm.cmp(shape_opnd, Opnd::UImm(expected_shape as u64)); @@ -2270,8 +2270,8 @@ fn gen_setinstancevariable( let expected_shape = unsafe { rb_shape_get_shape_id(comptime_receiver) }; let shape_bit_size = unsafe { rb_shape_id_num_bits() }; // either 16 or 32 depending on RUBY_DEBUG - let shape_byte_size = shape_bit_size / 8; - let shape_opnd = Opnd::mem(shape_bit_size, recv, RUBY_OFFSET_RBASIC_FLAGS + (8 - shape_byte_size as i32)); + let shape_id_offset = unsafe { rb_shape_id_offset() }; + let shape_opnd = Opnd::mem(shape_bit_size, recv, shape_id_offset); asm.comment("guard shape"); asm.cmp(shape_opnd, Opnd::UImm(expected_shape as u64)); @@ -2335,8 +2335,8 @@ fn gen_setinstancevariable( asm.comment("write shape"); let shape_bit_size = unsafe { rb_shape_id_num_bits() }; // either 16 or 32 depending on RUBY_DEBUG - let shape_byte_size = shape_bit_size / 8; - let shape_opnd = Opnd::mem(shape_bit_size, recv, RUBY_OFFSET_RBASIC_FLAGS + (8 - shape_byte_size as i32)); + let shape_id_offset = unsafe { rb_shape_id_offset() }; + let shape_opnd = Opnd::mem(shape_bit_size, recv, shape_id_offset); // Store the new shape asm.store(shape_opnd, Opnd::UImm(new_shape_id as u64)); diff --git a/yjit/src/cruby_bindings.inc.rs b/yjit/src/cruby_bindings.inc.rs index d2ad67e802..6f99a4441d 100644 --- a/yjit/src/cruby_bindings.inc.rs +++ b/yjit/src/cruby_bindings.inc.rs @@ -444,6 +444,9 @@ extern "C" { pub fn rb_shape_id_num_bits() -> u8; } extern "C" { + pub fn rb_shape_id_offset() -> i32; +} +extern "C" { pub fn rb_shape_flag_mask() -> u64; } extern "C" { |