diff options
author | Jimmy Miller <jimmy.miller@shopify.com> | 2023-03-07 12:29:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-07 12:29:59 -0500 |
commit | 719a7726d17f0800b8f8ef42f3f48e7558d5a444 (patch) | |
tree | 1e440cc92507b60fd28677954df606c598d1fa8d /yjit/src/cruby_bindings.inc.rs | |
parent | a6de8b0d2dea18b03374d27901f31be407523baa (diff) | |
download | ruby-719a7726d17f0800b8f8ef42f3f48e7558d5a444.tar.gz |
YJIT: Handle special case of splat and rest lining up (#7422)
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])
```
Diffstat (limited to 'yjit/src/cruby_bindings.inc.rs')
-rw-r--r-- | yjit/src/cruby_bindings.inc.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/yjit/src/cruby_bindings.inc.rs b/yjit/src/cruby_bindings.inc.rs index b366950e7d..21a6d09e84 100644 --- a/yjit/src/cruby_bindings.inc.rs +++ b/yjit/src/cruby_bindings.inc.rs @@ -1095,6 +1095,7 @@ extern "C" { pub fn rb_obj_class(obj: VALUE) -> VALUE; pub fn rb_ary_new_capa(capa: ::std::os::raw::c_long) -> VALUE; pub fn rb_ary_store(ary: VALUE, key: ::std::os::raw::c_long, val: VALUE); + pub fn rb_ary_dup(ary: VALUE) -> VALUE; pub fn rb_ary_resurrect(ary: VALUE) -> VALUE; pub fn rb_ary_clear(ary: VALUE) -> VALUE; pub fn rb_hash_new() -> VALUE; |