diff options
| author | eileencodes <eileencodes@gmail.com> | 2024-07-17 13:26:02 -0400 |
|---|---|---|
| committer | Kevin Newton <kddnewton@gmail.com> | 2024-07-18 10:12:20 -0400 |
| commit | aa3030ac24389f838fd85390601489c60fd13877 (patch) | |
| tree | 6affa736f23103ceaa92c29928a134e5fc3c87d1 /ruby.c | |
| parent | c304bf13b55a30b9982f9c9e6187f5b56fc731b0 (diff) | |
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
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11190
Diffstat (limited to 'ruby.c')
0 files changed, 0 insertions, 0 deletions
