After eliding the varop, the optimisation added in
5afbd733 repro-
cesses the previous op if it is a nextstate op. But it was doing this
by setting the current op to the one before the nextstate, so that the
o=o->op_next in the loop header would cause it to reprocess the next-
state in the next iteration. So, if that nextstate op were at the
beginning of a subroutine, the optimisation would be skipped, and this
would still execute two nextstate ops in a row:
sub foo {
our($a, $b);
die;
}
So, instead, just use ‘goto’ to reprocess the op, and we can do it
even if there is no op before the nextstate.
($m7, undef, $m8) = (1, 2, 3);
####
# 'our/local' works with padrange op
-no strict;
our($z, @z);
our $o1;
+no strict;
local $o11;
$o1 = 1;
local $o1 = 1;
break;
}
+ redo:
/* By default, this op has now been optimised. A couple of cases below
clear this again. */
o->op_opt = 1;
oldop->op_next = o->op_next->op_next;
/* Reprocess the previous op if it is a nextstate, to
allow double-nextstate optimisation. */
- if (oldop->op_type == OP_NEXTSTATE && oldoldop
- && oldoldop->op_next == oldop) {
+ if (oldop->op_type == OP_NEXTSTATE) {
oldop->op_opt = 0;
- o = oldop = oldoldop;
+ o = oldop;
+ oldop = oldoldop;
oldoldop = NULL;
- continue;
+ goto redo;
}
o = oldop;
}
@INC = '../lib';
}
-plan 20;
+plan 21;
use B qw 'svref_2object OPpASSIGN_COMMON';
'multiple nextstates become one';
+# rv2[ahs]v in void context
+
+is svref_2object(sub { our($foo,@fit,%far); our $bar; our($a,$b); time })
+ ->START->next->name, 'time',
+ 'rv2[ahs]v in void context';
+
+
# split to array
for(['@pkgary' , '@_' ],