From: Matthew Horsfall Date: Sun, 15 Dec 2013 03:25:22 +0000 (-0500) Subject: Also optimise returning lists: 'return ($one, $two);' X-Git-Tag: upstream/5.20.0~1010 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=99c8f462f49adae5501b0c9e190423cd29bde857;p=platform%2Fupstream%2Fperl.git Also optimise returning lists: 'return ($one, $two);' --- diff --git a/op.c b/op.c index a9dafaa..9c3cc94 100644 --- a/op.c +++ b/op.c @@ -11140,11 +11140,19 @@ Perl_rpeep(pTHX_ OP *o) && OP_TYPE_IS(sibling->op_next->op_next, OP_LEAVESUB) && cUNOPx(sibling)->op_first == next && next->op_sibling && next->op_sibling->op_next - && next->op_sibling->op_next == sibling - && next->op_next && sibling->op_next) - { - next->op_sibling->op_next = sibling->op_next; - o->op_next = next->op_next; + && next->op_next + ) { + /* Look through the PUSHMARK's siblings for one that + * points to the RETURN */ + OP *top = next->op_sibling; + while (top && top->op_next) { + if (top->op_next == sibling) { + top->op_next = sibling->op_next; + o->op_next = next->op_next; + break; + } + top = top->op_sibling; + } } }