Project

General

Profile

« Previous | Next » 

Revision 69e65b9b

Added by eileencodes (Eileen Uchitelle) 12 months ago

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