From 98f0e2c330a261a96e3a90ff4f5a8c671abdbec5 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Tue, 4 Apr 2023 00:40:31 -0700 Subject: [PATCH] RJIT: Fix the argument for defined --- lib/ruby_vm/rjit/insn_compiler.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ruby_vm/rjit/insn_compiler.rb b/lib/ruby_vm/rjit/insn_compiler.rb index d9aca5b52c8531..51ff1667b4b1c3 100644 --- a/lib/ruby_vm/rjit/insn_compiler.rb +++ b/lib/ruby_vm/rjit/insn_compiler.rb @@ -1283,7 +1283,7 @@ def defined(jit, ctx, asm) asm.cmovnz(:rax, :rcx) # Push the return value onto the stack - out_type = if C::SPECIAL_CONST_P(C.to_ruby(pushval)) + out_type = if C::SPECIAL_CONST_P(pushval) Type::UnknownImm else Type::Unknown @@ -1307,7 +1307,7 @@ def definedivar(jit, ctx, asm) ivar_name = jit.operand(0) # Value that will be pushed on the stack if the ivar is defined. In practice this is always the # string "instance-variable". If the ivar is not defined, nil will be pushed instead. - pushval = jit.operand(2) + pushval = jit.operand(2, ruby: true) # Get the receiver recv = :rcx @@ -1333,11 +1333,11 @@ def definedivar(jit, ctx, asm) # } asm.test(C_RET, 255) asm.mov(:rax, Qnil) - asm.mov(:rcx, pushval) + asm.mov(:rcx, to_value(pushval)) asm.cmovnz(:rax, :rcx) # Push the return value onto the stack - out_type = C::SPECIAL_CONST_P(C.to_ruby(pushval)) ? Type::UnknownImm : Type::Unknown + out_type = C::SPECIAL_CONST_P(pushval) ? Type::UnknownImm : Type::Unknown stack_ret = ctx.stack_push(out_type) asm.mov(stack_ret, :rax) @@ -1358,7 +1358,7 @@ def definedivar(jit, ctx, asm) asm.cmp(shape_opnd, shape_id) jit_chain_guard(:jne, jit, ctx, asm, side_exit) - result = ivar_exists ? pushval : Qnil + result = ivar_exists ? C.to_value(pushval) : Qnil putobject(jit, ctx, asm, val: result) # Jump to next instruction. This allows guard chains to share the same successor.