In perl.git, the branch sprout/list has been created
<http://perl5.git.perl.org/perl.git/commitdiff/f7b8799087278086080dd23e8d2902a5fe3183ac?hp=0000000000000000000000000000000000000000>
at f7b8799087278086080dd23e8d2902a5fe3183ac (commit)
- Log -----------------------------------------------------------------
commit f7b8799087278086080dd23e8d2902a5fe3183ac
Author: Father Chrysostomos <[email protected]>
Date: Thu Oct 16 21:52:32 2014 -0700
Make null list+pushmark happen in more cases
This optimisation, added in 7d3c8a683, nulls the list+pushmark pair if
it occurs in list context, since the two ops effectively cancel each
other out. I recently extended it in 8717a761e to apply to void con-
text, too.
It works by checking in the peephole optimiser whether the sibling of
the current op is a list with a pushmark kid:
1 current op
4 list
2 pushmark
3 ...
5 ...
That means the optimisation doesnât happen if the elder sibling of the
list op is something that is not part of the execution chain, such as
$package_var:
- ex-rv2sv
1 gvsv
4 list
2 pushmark
3 ...
5 ...
because the ex-rv2sv is never the âcurrent opâ. So ($_,($_,$_))
doesnât get optimised.
We canât just handle this when âpushmarkâ or âlistâ is the
current
op, because, in the former case, there is no way to get to the parent
op to null it; in the latter case, there is no way to get to the op
pointing to pushmark, to rethread the op_next pointers.
However, handling this when list or void context is applied, before we
even get to the peephole optimiser, just works, and requires much less
code. We can just null the ops there, and leave it to the peephole
optimiserâs handling of null ops to rethread op_next pointers.
This breaks this convention:
op_prepend_elem(OP_LIST, foo, list(that_list))
by creating two redundant null ops that were not there before, but the
only pieces of code doing that were calling list() needlessly anyway.
M embed.fnc
M embed.h
M op.c
M proto.h
M t/op/opt.t
commit 830638b98f8672d138bb94a54b2fcdf4e0cb7b24
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