mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
Eliminate array allocation for f(*a, **lvar) and f(*a, **@iv)
The compiler already eliminates the array allocation for f(*a, &lvar) and f(*a, &@iv), and eliminating the array allocation for keyword splat is as safe as eliminating it for block passes.
This commit is contained in:
parent
c70c1d2a95
commit
1731dd05a7
1 changed files with 15 additions and 0 deletions
15
compile.c
15
compile.c
|
@ -3876,6 +3876,21 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
|
||||||
if ((flag & VM_CALL_ARGS_BLOCKARG) && !(flag & VM_CALL_KW_SPLAT)) {
|
if ((flag & VM_CALL_ARGS_BLOCKARG) && !(flag & VM_CALL_KW_SPLAT)) {
|
||||||
OPERAND_AT(iobj, 0) = Qfalse;
|
OPERAND_AT(iobj, 0) = Qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Eliminate array allocation for f(*a, **lvar) and f(*a, **@iv)
|
||||||
|
*
|
||||||
|
* splatarray true
|
||||||
|
* getlocal / getinstancevariable
|
||||||
|
* send ARGS_SPLAT|KW_SPLAT and not ARGS_BLOCKARG
|
||||||
|
* =>
|
||||||
|
* splatarray false
|
||||||
|
* getlocal / getinstancevariable
|
||||||
|
* send
|
||||||
|
*/
|
||||||
|
else if (!(flag & VM_CALL_ARGS_BLOCKARG) && (flag & VM_CALL_KW_SPLAT)) {
|
||||||
|
OPERAND_AT(iobj, 0) = Qfalse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue