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:
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 thecaller side (which can be reused on the callee side in the case of
def f(*a)). Prior to this commit,f(*a, 1)would generate3 arrays:
Instructions Before for
a = []; f(*a, 1):Instructions After for
a = []; f(*a, 1):With these changes, method calls to Ruby methods should
implicitly allocate at most one array.
Ignore typeprof bundled gem failure due to unrecognized instruction.