In perl.git, the branch sprout/nolistpushmarkopt has been created
<http://perl5.git.perl.org/perl.git/commitdiff/5b807558721d4a1b9a2121285e81b695d4b5025b?hp=0000000000000000000000000000000000000000>
at 5b807558721d4a1b9a2121285e81b695d4b5025b (commit)
- Log -----------------------------------------------------------------
commit 5b807558721d4a1b9a2121285e81b695d4b5025b
Author: Father Chrysostomos <[email protected]>
Date: Fri Oct 17 13:56:52 2014 -0700
Allow void padrange even without nextstate
This allows the padrange optimisation to happen with code like this:
my ($a, $b), our $c;
The padrange optimisation looks for:
list
pushmark
padsv
padsv
...
nextstate
if it is in void context.
padsv pushes an sv on to the stack, and then nextstate resets the
stack. padrange doesnât bother pushing in void context, which is why
this optimisation was written this way.
However, there are various ops that donât bother touching the stack in
void context, for efficiency; conversely, there are many that do for
simplicityâs sake. In all cases, however, things pushed in void con-
text are subsequently reset, usually by list/nextstate/leavesub,
before they can accidentally become part of a list. So whether pad-
range pushes SVs or not in void context is irrelevant, and it does not
matter whether there is a nextstate op.
Further, this optimisation also allowed:
ex-list
pushmark
...
pushmark and list ops cancel each other out in list and void context.
padrange does not push a mark in void context, so the list is removed
from the execution chain. That was also happening for a nulled list,
which is incorrect, as that means a lone pushmark is being removed. I
donât believe ex-list+pushmark ever occurs in void context, but if it
does then this code was wrong.
M op.c
commit de4d3e9afc1a641a8e2646dfc1104c961e49c70d
Author: Father Chrysostomos <[email protected]>
Date: Fri Oct 17 13:21:59 2014 -0700
op.c: Change a pushre if into assert()
M op.c
commit a3353dbeb3804ed7053b9be5196a69c0811e7f94
Author: Father Chrysostomos <[email protected]>
Date: Fri Oct 17 13:07:31 2014 -0700
Skip padrange optimisation for one padop
cachegrind shows that padrange is marginally slower than pushmark+padsv
(<[email protected]>).
M ext/B/t/optree_sort.t
M op.c
commit c51d52ee469b65f967308e6daad9be1395d927e9
Author: Father Chrysostomos <[email protected]>
Date: Thu Oct 16 17:53:54 2014 -0700
B::Concise: Dump private vars for null ops
This can be very helpful for debugging. For null ops that were not
always null, output the private flags as we would for unnulled ops.
M ext/B/B/Concise.pm
M ext/B/t/optree_varinit.t
-----------------------------------------------------------------------
--
Perl5 Master Repository