This flag is set when the caller has already created a new array to handle a splat, such as for f(*a, b) and f(*a, *b). Previously, if f was defined as def f(*a), these calls would create an extra array on the callee side, instead of using the new array created by the caller.
This modifies setup_args_core to set the flag whenver it would add a splatarray true instruction. However, when splatarray true is changed to splatarray false in the peephole optimizer, to avoid unnecessary allocations on the caller side, the flag must be removed. Add optimize_args_splat_no_copy and have the peephole optimizer call that. This significantly simplifies the related peephole optimizer code.
On the callee side, in setup_parameters_complex, set args->rest_dupped to true if the flag is set.
This takes a similar approach for optimizing regular splats that was previiously used for keyword splats in d2c41b1bff1f3102544bb0d03d4e82356d034d33 (via VM_CALL_KW_SPLAT_MUT).
Add VM_CALL_ARGS_SPLAT_MUT callinfo flag
This flag is set when the caller has already created a new array to
handle a splat, such as for
f(*a, b)andf(*a, *b). Previously,if
fwas defined asdef f(*a), these calls would create an extraarray on the callee side, instead of using the new array created
by the caller.
This modifies
setup_args_coreto set the flag whenver it would adda
splatarray trueinstruction. However, whensplatarray trueischanged to
splatarray falsein the peephole optimizer, to avoidunnecessary allocations on the caller side, the flag must be removed.
Add
optimize_args_splat_no_copyand have the peephole optimizer callthat. This significantly simplifies the related peephole optimizer
code.
On the callee side, in
setup_parameters_complex, setargs->rest_duppedto true if the flag is set.This takes a similar approach for optimizing regular splats that was
previiously used for keyword splats in
d2c41b1bff1f3102544bb0d03d4e82356d034d33 (via VM_CALL_KW_SPLAT_MUT).