Project

General

Profile

Actions

Bug #21326

closed

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

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

Added by zenspider (Ryan Davis) 6 months ago. Updated 4 months ago.

Status:
Closed
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) 6 months ago Actions #1 [ruby-core:121997]

  • Assignee set to prism

Updated by hsbt (Hiroshi SHIBATA) 6 months ago Actions #2

  • Status changed from Open to Assigned

Updated by tenderlovemaking (Aaron Patterson) 4 months ago Actions #3

  • Status changed from Assigned to Closed

Applied in changeset git|86320a53002a3adaf35ad7434c70e86747a8b345.


Fix compilation for forwarding params in Prism

[Bug #21326]

Actions

Also available in: PDF Atom