This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pessimise pp_argelem, pp_argdefelem
These two ops assumed that, since they occur at the start of a
function, weird tricks with goto and closures can't be used to
cause the new lexical vars to already have a value, so the assign code
can be simpler and quicker than that found in pp_sassign and pp_aassign.
However Father Chrysostomos demonstrated that this wasn't the case,
using e.g. code that does strange things in signature default expressions.
In particular we can not assume:
* that scalar lexicals will be undef
* that array and hash lexicals will be empty
* that lexicals and @_ can't be magical or tied;
* that @_ remains unchanged (especially in relation to its number of
elements)
* that there are no common elements, since with aliases and closures,
my @a = @_ can be equivalent to my @a = (...); @a = ($a_[0],...)
So this commit removes the short-cuts, and for aggregates, if the
new lexical array or hash may be non-empty, makes a copy of each @_
element first.
It is intended in the near future that normal runs of OP_ARGELEM
will be replaced by OP_SIGNATURE, which will be able to do a better job of
knowing when its safe to optimise.