Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YJIT: Handle special case of splat and rest lining up #7422

Merged
merged 1 commit into from Mar 7, 2023

Conversation

jimmyhmiller
Copy link
Contributor

@jimmyhmiller jimmyhmiller commented Mar 2, 2023

If you have a method that takes rest arguments and a splat call that happens to line up perfectly with that rest, you can just dupe the array rather than move anything around. We still have to dupe, because people could have a custom to_a method or something like that which means it is hard to guarantee we have exclusive access to that array.

Example:

def foo(a, b, *rest)
end

foo(1, 2, *[3, 4])

Take two on #7419

@matzbot matzbot requested a review from a team March 2, 2023 20:25
If you have a method that takes rest arguments and a splat call that
happens to line up perfectly with that rest, you can just dupe the
array rather than move anything around. We still have to dupe, because
people could have a custom to_a method or something like that which
means it is hard to guarantee we have exclusive access to that array.

Example:

```ruby
def foo(a, b, *rest)
end

foo(1, 2, *[3, 4])
```
@maximecb maximecb merged commit 719a772 into ruby:master Mar 7, 2023
95 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants