diff options
author | eileencodes <[email protected]> | 2024-07-17 15:37:48 -0400 |
---|---|---|
committer | Kevin Newton <[email protected]> | 2024-07-18 21:15:43 -0400 |
commit | 69e65b9b5ad03d40eb6cfa7323d871465c28d960 (patch) | |
tree | 1e8c77dda4d4a21be13a4b3012b7eb3659b211e9 /test/ruby/test_rubyvm.rb | |
parent | 8db2325a11518f50f92fe05ccae112c0d71ce12f (diff) |
Fix interpolated sybmol node instructions
If the symbol node is interpolated like this `:"#{foo}"` the instruction
sequence should be `putstring` followed by `intern`. In this case it was
a `putobject` causing the `test_yjit` tests to fail. Note that yjit is
not required to reproduce - the instructions are `putstring` and
`intern` for yjit and non-yjit with the original parser.
To fix I moved `pm_interpolated_node_compile` out of the else, and
entirely removed the conditional. `pm_interpolated_node_compile` knows
how / when to use `putstring` over `putobject` already. The `intern` is
then added by removing the conditional.
Before:
```
== disasm: #<ISeq:<main>@test2.rb:1 (1,0)-(1,11)>
0000 putobject :foo ( 1)[Li]
0002 leave
```
After:
```
== disasm: #<ISeq:<main>@test2.rb:1 (1,0)-(1,11)>
0000 putstring "foo" ( 1)[Li]
0002 intern
0003 leave
```
Fixes the test `TestYJIT#test_compile_dynamic_symbol`. Related to ruby/prism#2935
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11191
Diffstat (limited to 'test/ruby/test_rubyvm.rb')
0 files changed, 0 insertions, 0 deletions