diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-12-21 22:43:56 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-12-21 23:10:04 -0800 |
commit | d964400db079591cebd20d95c9dde745a05e5ade (patch) | |
tree | b26926f86e9e4617a2a8e9b4ebb61af7abee0318 /t/perf | |
parent | ef3a1d8a913a6ffccc2517a79a516651aa599054 (diff) | |
download | perl-d964400db079591cebd20d95c9dde745a05e5ade.tar.gz |
Ignore cx of padsv for padrange optimisation
Commit v5.21.6-352-gc46871e caused all padsv ops to be marked with
scalar context. This prevented the padrange optimisation from happen-
ing with a combination of scalars and aggregates in list context.
Adjust the padrange algorithm to ignore the distinction between list
and scalar context. We only do this optimisation when, even in list
context, each op will push just one thing on to the stack. (That’s
why we check OPf_REF on padav and padhv.) So the list/scalar distinc-
tion is irrelevant.
Diffstat (limited to 't/perf')
-rw-r--r-- | t/perf/optree.t | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/t/perf/optree.t b/t/perf/optree.t index dac0a25841..7e3a06e14a 100644 --- a/t/perf/optree.t +++ b/t/perf/optree.t @@ -10,7 +10,7 @@ BEGIN { @INC = '../lib'; } -plan 23; +plan 24; use v5.10; # state use B qw 'svref_2object OPpASSIGN_COMMON'; @@ -81,6 +81,17 @@ is svref_2object(sub{state($foo,@fit,%far);state $bar;state($a,$b); time}) 'pad[ahs]v state declarations in void context'; +# pushmark-padsv-padav-padhv in list context --> padrange + +{ + my @ops; + my $sub = sub { \my( $f, @f, %f ) }; + my $op = svref_2object($sub)->START; + push(@ops, $op->name), $op = $op->next while $$op; + is "@ops", "nextstate padrange refgen leavesub", 'multi-type padrange' +} + + # rv2[ahs]v in void context is svref_2object(sub { our($foo,@fit,%far); our $bar; our($a,$b); time }) |