diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-26 06:14:59 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-26 06:14:59 +0000 |
commit | f4ca0739ecf00e9c50aaca55e0ecc5e33dd49284 (patch) | |
tree | c62dcb1a1d10abec183165d0d8afe6107c12392f /compile.c | |
parent | 667c0a3a8caeaa96378f778ee2fbef1b51c3cd13 (diff) | |
download | ruby-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.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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; } } |