This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tweak multiple nextstate optimisation further
authorFather Chrysostomos <sprout@cpan.org>
Sun, 19 Oct 2014 05:31:14 +0000 (22:31 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 19 Oct 2014 05:43:03 +0000 (22:43 -0700)
There was still one niggling nulled nextstate in the execution
sequence in cases like this (the one numbered 4):

$ ./perl -Ilib  -MO=Concise -e 'time; our $x; our $y; time'
7  <@> leave[1 ref] vKP/REFC ->(end)
1     <0> enter ->2
2     <;> nextstate(main 1 -e:1) v:{ ->3
3     <0> time[t1] v ->4
-     <0> ex-nextstate v ->5
-     <1> rv2sv vK/OURINTR,1 ->4
-        <$> gv(*x) s ->-
4     <0> ex-nextstate v ->5
-     <1> rv2sv vK/OURINTR,1 ->5
-        <$> gv(*y) s ->-
5     <;> nextstate(main 3 -e:1) v:{ ->6
6     <0> time[t4] v ->7
-e syntax OK

op.c

diff --git a/op.c b/op.c
index f54203f..e28cc54 100644 (file)
--- a/op.c
+++ b/op.c
@@ -11888,6 +11888,9 @@ Perl_rpeep(pTHX_ OP *o)
                    op_null(o);
                    if (oldop)
                        oldop->op_next = nextop;
+                   /* Skip (old)oldop assignment since the current oldop's
+                      op_next already points to the next op.  */
+                   continue;
                }
            }
            break;