diff options
author | Aaron Patterson <[email protected]> | 2022-11-18 13:13:32 -0800 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2022-12-02 12:53:51 -0800 |
commit | be40af284a03d09e0197daed1c26f098c92d7d2d (patch) | |
tree | 815884c3c83c741cce317db34940ef0121ce4149 /yjit/src | |
parent | 07fe3d37c5a27629bbddb98c6c7af73054a47754 (diff) |
make flag clearing better
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6767
Diffstat (limited to 'yjit/src')
-rw-r--r-- | yjit/src/codegen.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index 099ea05f5a..3bd364daf2 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -2333,13 +2333,14 @@ fn gen_setinstancevariable( gen_write_iv(asm, comptime_receiver, recv, ivar_index, write_val, needs_extension); asm.comment("write shape"); - let cleared_flags = asm.and( - Opnd::mem(64, recv, RUBY_OFFSET_RBASIC_FLAGS), - Opnd::UImm(unsafe { rb_shape_flag_mask() }.into())); - let new_flags = asm.or(cleared_flags, Opnd::UImm((new_shape_id as u64) << unsafe { rb_shape_flag_shift() })); + 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)); - asm.store(Opnd::mem(64, recv, RUBY_OFFSET_RBASIC_FLAGS), new_flags); + // Store the new shape + asm.store(shape_opnd, Opnd::UImm(0 as u64)); + asm.store(shape_opnd, Opnd::UImm(new_shape_id as u64)); }, Some(ivar_index) => { |