aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-26 06:14:59 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-26 06:14:59 +0000
commitf4ca0739ecf00e9c50aaca55e0ecc5e33dd49284 (patch)
treec62dcb1a1d10abec183165d0d8afe6107c12392f /compile.c
parent667c0a3a8caeaa96378f778ee2fbef1b51c3cd13 (diff)
downloadruby-f4ca0739ecf00e9c50aaca55e0ecc5e33dd49284.tar.gz
compile.c: fix tailcall optimization
* compile.c (iseq_peephole_optimize): don't apply tailcall optimization to send/invokesuper instructions with blockiseq. This is a follow-up to the changes in r51903; blockiseq is now the third operand of send/invokesuper instructions. [ruby-core:73413] [Bug #12018] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index 85372ae696..ea9b4905ad 100644
--- a/compile.c
+++ b/compile.c
@@ -2248,8 +2248,12 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
if (piobj) {
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) {
+ if (piobj->insn_id == BIN(send) || piobj->insn_id == BIN(invokesuper)) {
+ if (piobj->operands[2] == 0) { /* no blockiseq */
+ ci->flag |= VM_CALL_TAILCALL;
+ }
+ }
+ else {
ci->flag |= VM_CALL_TAILCALL;
}
}