Project

General

Profile

Actions

Bug #21326

open

Instruction generation differences between parse.y and prism for `def a(x, ...); b(...); end`

Added by zenspider (Ryan Davis) 2 days ago. Updated about 9 hours ago.

Status:
Assigned
Assignee:
Target version:
-
ruby -v:
ruby 3.5.0dev
[ruby-core:121993]

Description

Diff instructions using:

DUMP="puts RubyVM::InstructionSequence.compile(ARGV.first).disasm.gsub(/^\d+ /, '')"
RUBY="def a(x, ...); b(...); end"

env -u RUBYOPT \
    diff -U99 \
    <(./build/ruby -v --parser=parse.y -e "$DUMP" "$RUBY" 2>/dev/null) \
    <(./build/ruby -v --parser=prism   -e "$DUMP" "$RUBY" 2>/dev/null)

shows:

--- /dev/fd/63	2025-05-10 14:46:37
+++ /dev/fd/62	2025-05-10 14:46:37
@@ -1,17 +1,18 @@
-ruby 3.5.0dev (2025-05-10T17:32:21Z master 98667f82d2) +GC [arm64-darwin24]
+ruby 3.5.0dev (2025-05-10T17:32:21Z master 98667f82d2) +PRISM +GC [arm64-darwin24]
 == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,26)>
 definemethod                           :a, a                     (   1)[Li]
 putobject                              :a
 leave
 
 == disasm: #<ISeq:a@<compiled>:1 (1,0)-(1,26)>
 local table (size: 5, argc: 1 [opts: 0, rest: 1, post: 0, block: 3, kw: -1@-1, kwrest: 2])
 [ 5] x@0<Arg>   [ 4] "*"@1<AnonRest>[ 3] "**"@2<AnonKwrest>[ 2] "&"@3<Block>[ 1] "..."@4
 putself                                                          (   1)[LiCa]
 getlocal_WC_0                          "*"@1
-splatarray                             false
+splatarray                             true
 getlocal_WC_0                          "**"@2
 getblockparamproxy                     "&"@3, 0
 splatkw
-send                                   <calldata!mid:b, argc:2, ARGS_SPLAT|ARGS_BLOCKARG|FCALL|KW_SPLAT>, nil
+splatkw
+send                                   <calldata!mid:b, argc:2, ARGS_SPLAT|ARGS_SPLAT_MUT|ARGS_BLOCKARG|FCALL|KW_SPLAT>, nil
 leave                                  [Re]

PR here: https://github.com/ruby/ruby/pull/13299

goes back to at least 3.4.

Updated by mame (Yusuke Endoh) 2 days ago

  • Assignee set to prism
Actions #2

Updated by hsbt (Hiroshi SHIBATA) about 9 hours ago

  • Status changed from Open to Assigned
Actions

Also available in: Atom PDF

Like0
Like0Like0