summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-29 13:25:02 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-29 13:25:02 +0000
commit6af6154b418ba392feb6afbc14ef318de4c0e9ef (patch)
tree3b8f57d216239fae12e53cd9e3fca8951f4b7a00 /compile.c
parenta61019eee34e0e0f3463da22cc0f3e62eeebf429 (diff)
merge revision(s) 53658: [Backport #12018]
* 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/branches/ruby_2_3@54401 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 b70a069916..e385c83f39 100644
--- a/compile.c
+++ b/compile.c
@@ -2228,8 +2228,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;
}
}