Fix empty hash instruction
When we have an empty hash the iseq should have a newhash but instead had a duphash. To fix, check if the node's elements are equal to 0. If so we want a newhash, otherwise use the original duphash instructions.
newhash
duphash
0
Before:
== disasm: #<ISeq:<main>@test2.rb:1 (1,0)-(1,2)> 0000 duphash {} ( 1)[Li] 0002 leave
After:
== disasm: #<ISeq:<main>@test2.rb:1 (1,0)-(1,2)> 0000 newhash 0 ( 1)[Li] 0002 leave
Fixes the test TestYJIT#test_compile_newhash. Related to ruby/prism#2935
TestYJIT#test_compile_newhash
Fix empty hash instruction
When we have an empty hash the iseq should have a
newhash
but insteadhad a
duphash
. To fix, check if the node's elements are equal to0
.If so we want a
newhash
, otherwise use the originalduphash
instructions.
Before:
After:
Fixes the test
TestYJIT#test_compile_newhash
. Related to ruby/prism#2935