mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
compile.c: splatarray peephole opt
* compile.c (iseq_peephole_optimize): remove splatarray following always-array insn. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8cbb7747cd
commit
d6fdd1c330
1 changed files with 20 additions and 0 deletions
20
compile.c
20
compile.c
|
@ -2256,6 +2256,26 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
|
|||
}
|
||||
}
|
||||
|
||||
if (IS_INSN_ID(iobj, newarray) ||
|
||||
IS_INSN_ID(iobj, duparray) ||
|
||||
IS_INSN_ID(iobj, expandarray) ||
|
||||
IS_INSN_ID(iobj, concatarray) ||
|
||||
IS_INSN_ID(iobj, splatarray) ||
|
||||
0) {
|
||||
/*
|
||||
* newarray N
|
||||
* splatarray
|
||||
* =>
|
||||
* newarray N
|
||||
* newarray always puts an array
|
||||
*/
|
||||
LINK_ELEMENT *next = iobj->link.next;
|
||||
if (IS_INSN(next) && IS_INSN_ID(next, splatarray)) {
|
||||
/* remove splatarray following always-array insn */
|
||||
REMOVE_ELEM(next);
|
||||
}
|
||||
}
|
||||
|
||||
if (do_tailcallopt &&
|
||||
(IS_INSN_ID(iobj, send) ||
|
||||
IS_INSN_ID(iobj, opt_aref_with) ||
|
||||
|
|
Loading…
Reference in a new issue