From 8d14d6ea2d9e278a04ebe7e5805221f4cd4cd950 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Thu, 29 May 2025 12:35:46 -0400 Subject: ZJIT: Spill to the stack using arguments instead of FrameState The FrameState on the SendWithoutBlock represents the entry state, but for instructions that push to the stack in the middle of the instruction before actually doing the send like opt_aref_with, the FrameState is incorrect. We need to write to the stack using the arguments for the instruction. --- test/ruby/test_zjit.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb index 4452f413f0..796851a9bf 100644 --- a/test/ruby/test_zjit.rb +++ b/test/ruby/test_zjit.rb @@ -487,6 +487,14 @@ class TestZJIT < Test::Unit::TestCase }, call_threshold: 5, num_profiles: 3 end + def test_opt_aref_with + assert_compiles ':ok', %q{ + def aref_with(hash) = hash["key"] + + aref_with({ "key" => :ok }) + } + end + # tool/ruby_vm/views/*.erb relies on the zjit instructions a) being contiguous and # b) being reliably ordered after all the other instructions. def test_instruction_order -- cgit v1.2.3