Skip to content

ZJIT: Reuse caller-built splat array for rest parameters - #1097

Closed
efegokdemir wants to merge 2 commits into
Shopify:masterfrom
efegokdemir:efe/zjit-rest-splat-reuse
Closed

efegokdemir wants to merge 2 commits into
Shopify:masterfrom
efegokdemir:efe/zjit-rest-splat-reuse

Conversation

@efegokdemir

Copy link
Copy Markdown

Reuse the caller-built splat array when a rest parameter consumes its entire suffix, avoiding a second allocation. If leading or optional parameters consume part of the array, behead it only after the stack-overflow side-exit point so interpreter replay still sees the original arguments. make zjit-check passed: 2,115 Rust tests, 1 skipped, and 28 CLI tests with 7,624 assertions. Fixes #1095.

Avoid rebuilding the rest array when it is already represented by the caller's mutable splat. Defer beheading until after stack-overflow exits so an interpreter replay still sees the original arguments.

Fixes Shopify#1095
@github-actions github-actions Bot added the jit label Nov 3, 2026
thomasklemm added a commit to thomasklemm/lowrail that referenced this pull request Nov 3, 2026
The reader is joined before the writer, so a copy or byte-count assertion
failure can leave the reader waiting for EOF and hide the original error.
Close the owned writer socket in ensure so the existing thread join can
report that error. Keep the byte-count and content assertions unchanged.
@tekknolagi

Copy link
Copy Markdown

Please file PRs to ruby/ruby.

@tekknolagi tekknolagi closed this Nov 9, 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.

ZJIT: Rest parameter copies a caller-built splat array that the interpreter reuses

2 participants