mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
compile.c: tailcall on aref and aset
* compile.c (iseq_peephole_optimize): optimize tail calls on aref and aset specialized instructions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6339ac02ac
commit
1ff30ea2b1
2 changed files with 8 additions and 2 deletions
|
@ -1,4 +1,7 @@
|
||||||
Mon Nov 16 17:40:39 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Nov 16 17:41:33 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* compile.c (iseq_peephole_optimize): optimize tail calls on aref
|
||||||
|
and aset specialized instructions.
|
||||||
|
|
||||||
* compile.c (iseq_peephole_optimize): optimize replaced leave
|
* compile.c (iseq_peephole_optimize): optimize replaced leave
|
||||||
instruction copied to jump instruction too.
|
instruction copied to jump instruction too.
|
||||||
|
|
|
@ -2061,7 +2061,10 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
|
||||||
INSN *piobj = (INSN *)get_prev_insn(iobj);
|
INSN *piobj = (INSN *)get_prev_insn(iobj);
|
||||||
enum ruby_vminsn_type previ = piobj->insn_id;
|
enum ruby_vminsn_type previ = piobj->insn_id;
|
||||||
|
|
||||||
if (previ == BIN(send) || previ == BIN(opt_send_without_block) || previ == BIN(invokesuper)) {
|
if (previ == BIN(send) || previ == BIN(opt_send_without_block) ||
|
||||||
|
previ == BIN(invokesuper) ||
|
||||||
|
previ == BIN(opt_aref) || previ == BIN(opt_aref_with) ||
|
||||||
|
previ == BIN(opt_aset) || previ == BIN(opt_aset_with)) {
|
||||||
struct rb_call_info *ci = (struct rb_call_info *)piobj->operands[0];
|
struct rb_call_info *ci = (struct rb_call_info *)piobj->operands[0];
|
||||||
rb_iseq_t *blockiseq = (rb_iseq_t *)piobj->operands[1];
|
rb_iseq_t *blockiseq = (rb_iseq_t *)piobj->operands[1];
|
||||||
if (blockiseq == 0) {
|
if (blockiseq == 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue