The following test (reduced from ruby-spec) fails:
# ./miniruby --zjit-call-threshold=1 --zjit-disable-hir-opt test.rb
def test
ofor = nil
n = 0
eval("n = 2")
raise unless ofor.nil? # commenting out this line dodges the bug
raise "n=#{n} and !=2" unless n == 2
end
test
test
The ofor.nil? call causes a local variable spill, clobbering the n assigned in eval.
Some ways to fix this:
- Reload all local variables after each
Send, like we already do for Send with a block.
- Put a
PatchPoint NoEpEscape after each send
- Reason about what value each local variable could hold in an optimization pass instead of during HIR build, loading/storing through EP like the interpreter as a baseline (Though, this might fix the symptom but not the root cause.)
We want to have a discussion before picking an option.
The following test (reduced from ruby-spec) fails:
The
ofor.nil?call causes a local variable spill, clobbering thenassigned ineval.Some ways to fix this:
Send, like we already do forSendwith a block.PatchPoint NoEpEscapeafter each sendWe want to have a discussion before picking an option.