From: Nicholas Clark Date: Wed, 14 Jul 2004 23:35:24 +0000 (+0000) Subject: "That's the way to do it" X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c491ecac864a369a2913fd8e3ff31636a481b18b;p=p5sagit%2Fp5-mst-13.2.git "That's the way to do it" In taking out a bug spotted by my regression tests in t/cmd/for.t I actually managed to disable the entire optimisation. Which means that I didn't find the other bug. This optimisation is live, and passes all tests. p4raw-id: //depot/perl@23109 --- diff --git a/op.c b/op.c index d4c2887..8ceaa09 100644 --- a/op.c +++ b/op.c @@ -6751,17 +6751,17 @@ Perl_peep(pTHX_ register OP *o) if (!theirmark || theirmark->op_type != OP_PUSHMARK) break; - ourmark = ((LISTOP *)o)->op_first; - if (!ourmark || ourmark->op_type != OP_PUSHMARK) - break; - - if (ourmark->op_next != o) { + if (theirmark->op_sibling != o) { /* There's something between the mark and the reverse, eg for (1, reverse (...)) so no go. */ break; } + ourmark = ((LISTOP *)o)->op_first; + if (!ourmark || ourmark->op_type != OP_PUSHMARK) + break; + ourlast = ((LISTOP *)o)->op_last; if (!ourlast || ourlast->op_next != o) break; diff --git a/pp_hot.c b/pp_hot.c index 4157736..b170b3b 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1888,7 +1888,7 @@ PP(pp_iter) /* iterate array */ if (PL_op->op_private & OPpITER_REVERSED) { /* In reverse, use itermax as the min :-) */ - if (cx->blk_loop.iterix <= 0) + if (cx->blk_loop.iterix <= cx->blk_loop.itermax) RETPUSHNO; if (SvMAGICAL(av) || AvREIFY(av)) {