Skip to content

Backport 4.0: Add pushtoarray insn to fix segfault with forwarding + splat#15870

Merged
k0kubun merged 1 commit intoruby:ruby_4_0from
Shopify:rwstauner/backport-40-fwd-splat
Jan 14, 2026
Merged

Backport 4.0: Add pushtoarray insn to fix segfault with forwarding + splat#15870
k0kubun merged 1 commit intoruby:ruby_4_0from
Shopify:rwstauner/backport-40-fwd-splat

Conversation

@rwstauner
Copy link
Copy Markdown
Contributor

@rwstauner rwstauner commented Jan 14, 2026

Backporting #15855

Example insns diff for def x = [3]; def a(...) = b(*x, 2, 3, ...)

 == disasm: #<ISeq:a@-e:1 (1,13)-(1,42)>
 local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
 [ 1] "..."@0
 0000 putself                                                          (   1)[Ca]
 0000 putself
 0000 opt_send_without_block                 <calldata!mid:x, argc:0, FCALL|VCALL|ARGS_SIMPLE>
 0000 splatarray                             true
 0000 putobject                              2
 0000 putobject                              3
+0000 pushtoarray                            2
 0000 getlocal_WC_0                          "..."@0
 0000 sendforward                            <calldata!mid:b, argc:1, ARGS_SPLAT|ARGS_SPLAT_MUT|FCALL|FORWARDING>, nil
 0000 leave                                  [Re]

This matches the insns produced by parse.y

Example insns diff for `def x = [3]; def a(...) = b(*x, 2, 3, ...)`

     == disasm: #<ISeq:a@-e:1 (1,13)-(1,42)>
     local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
     [ 1] "..."@0
     0000 putself                                                          (   1)[Ca]
     0000 putself
     0000 opt_send_without_block                 <calldata!mid:x, argc:0, FCALL|VCALL|ARGS_SIMPLE>
     0000 splatarray                             true
     0000 putobject                              2
     0000 putobject                              3
    +0000 pushtoarray                            2
     0000 getlocal_WC_0                          "..."@0
     0000 sendforward                            <calldata!mid:b, argc:1, ARGS_SPLAT|ARGS_SPLAT_MUT|FCALL|FORWARDING>, nil
     0000 leave                                  [Re]

This matches the insns produced by parse.y
@rwstauner rwstauner requested a review from k0kubun as a code owner January 14, 2026 17:15
Copy link
Copy Markdown
Member

@k0kubun k0kubun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the backport PRs 🙏

@k0kubun k0kubun merged commit 33cae95 into ruby:ruby_4_0 Jan 14, 2026
90 checks passed
@k0kubun k0kubun deleted the rwstauner/backport-40-fwd-splat branch January 14, 2026 18:02
@hsbt hsbt added the Backport label Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants