From 1ff30ea2b1675fa6bfa50bb5bac1f8cdea8524e1 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 16 Nov 2015 08:41:41 +0000 Subject: [PATCH] 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 --- ChangeLog | 5 ++++- compile.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0722072129..0c5d05b82d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ -Mon Nov 16 17:40:39 2015 Nobuyoshi Nakada +Mon Nov 16 17:41:33 2015 Nobuyoshi Nakada + + * compile.c (iseq_peephole_optimize): optimize tail calls on aref + and aset specialized instructions. * compile.c (iseq_peephole_optimize): optimize replaced leave instruction copied to jump instruction too. diff --git a/compile.c b/compile.c index ce0b932c81..2d47082618 100644 --- a/compile.c +++ b/compile.c @@ -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); 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]; rb_iseq_t *blockiseq = (rb_iseq_t *)piobj->operands[1]; if (blockiseq == 0) {