Project

General

Profile

« Previous | Next » 

Revision aa3030ac

Added by eileencodes (Eileen Uchitelle) 11 months ago

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.

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