ruby/yjit
Jeremy Evans b8516d6d01 Add pushtoarray VM instruction
This instruction is similar to concattoarray, but it takes the
number of arguments to push to the array, removes that number
of arguments from the stack, and adds them to the array now at
the top of the stack.

This allows `f(*a, 1)` to allocate only a single array on the
caller side (which can be reused on the callee side in the case of
`def f(*a)`). Prior to this commit, `f(*a, 1)` would generate
3 arrays:

* a dupped by splatarray true
* 1 wrapped in array by newarray
* a dupped again by concatarray

Instructions Before for `a = []; f(*a, 1)`:

```
0000 newarray                               0                         (   1)[Li]
0002 setlocal_WC_0                          a@0
0004 putself
0005 getlocal_WC_0                          a@0
0007 splatarray                             true
0009 putobject_INT2FIX_1_
0010 newarray                               1
0012 concatarray
0013 opt_send_without_block                 <calldata!mid:f, argc:1, ARGS_SPLAT|FCALL>
0015 leave
```

Instructions After for `a = []; f(*a, 1)`:

```
0000 newarray                               0                         (   1)[Li]
0002 setlocal_WC_0                          a@0
0004 putself
0005 getlocal_WC_0                          a@0
0007 splatarray                             true
0009 putobject_INT2FIX_1_
0010 pushtoarray                            1
0012 opt_send_without_block                 <calldata!mid:f, argc:1, ARGS_SPLAT|ARGS_SPLAT_MUT|FCALL>
0014 leave
```

With these changes, method calls to Ruby methods should
implicitly allocate at most one array.

Ignore typeprof bundled gem failure due to unrecognized instruction.
2024-01-24 18:25:55 -08:00
..
bindgen YJIT: Avoid leaks by skipping objects with a singleton class 2024-01-24 18:06:58 -05:00
src Add pushtoarray VM instruction 2024-01-24 18:25:55 -08:00
.gitignore
Cargo.lock Bump capstone from 0.10.0 to 0.11.0 in /yjit (#9653) 2024-01-22 14:44:00 -08:00
Cargo.toml Bump capstone from 0.10.0 to 0.11.0 in /yjit (#9653) 2024-01-22 14:44:00 -08:00
not_gmake.mk YJIT: Fix shared/static library symbol leaks 2023-01-27 12:28:09 -05:00
yjit.mk YJIT: Simplify linker flavor check 2023-10-05 17:31:54 -04:00