This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Improve void varop optimisation
authorFather Chrysostomos <sprout@cpan.org>
Thu, 16 Oct 2014 23:18:59 +0000 (16:18 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 16 Oct 2014 23:35:26 +0000 (16:35 -0700)
commit0298c7603f0a7ee6e46fc9ebc8283c40ee2f6ad4
treedcfda707202b23a150d00d41d7d8731a7c3eac71
parent47d3b731f074752fe0862ffdf333cfd3935f793a
Improve void varop optimisation

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.
lib/B/Deparse.t
op.c
t/op/opt.t