From 6bc8e4a279f953148e17b23b25f0db8d3d37fcbb Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 8 Feb 2023 17:37:25 -0800 Subject: [PATCH] Fix the operand for branchunless --- lib/ruby_vm/mjit/insn_compiler.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ruby_vm/mjit/insn_compiler.rb b/lib/ruby_vm/mjit/insn_compiler.rb index ed004c99e9..a4d79127be 100644 --- a/lib/ruby_vm/mjit/insn_compiler.rb +++ b/lib/ruby_vm/mjit/insn_compiler.rb @@ -342,8 +342,8 @@ module RubyVM::MJIT # TODO: skip check for known truthy # This `test` sets ZF only for Qnil and Qfalse, which let jz jump. - asm.test([SP, C.VALUE.size * (ctx.stack_size - 1)], ~Qnil) - ctx.stack_pop(1) + val = ctx.stack_pop + asm.test(val, ~Qnil) # Set stubs branch_stub = BranchStub.new(