diff options
author | Richard Leach <richardleach@users.noreply.github.com> | 2022-07-08 14:52:19 +0000 |
---|---|---|
committer | Richard Leach <richardleach@users.noreply.github.com> | 2022-08-17 11:19:10 +0100 |
commit | 9fdd7fc4796d89d16dceea42f2af91e4fde296ed (patch) | |
tree | 9f113c432769e4dd1e8628fe2500059a588cce52 /t/perf | |
parent | 434ccf36bb90d7dfe527c3ecd775983821669b4a (diff) | |
download | perl-9fdd7fc4796d89d16dceea42f2af91e4fde296ed.tar.gz |
Implement OP_PADSV_STORE - combined sassign/padsv OP
This commit introduces a new OP to replace simple cases
of OP_SASSIGN and OP_PADSV.
For example, 'my $x = 1' is currently implemented as:
1 <;> nextstate(main 1 -e:1) v:{
2 <$> const(IV 1) s
3 <0> padsv[$x:1,2] sRM*/LVINTRO
4 <2> sassign vKS/2
But now will be turned into:
1 <;> nextstate(main 1 -e:1) v:{
2 <$> const(IV 1) s
3 <1> padsv_store[$x:1,2] vKMS/LVINTRO
This intended to be a transparent performance optimization.
It should be applicable for RHS optrees of varying complexity.
Diffstat (limited to 't/perf')
-rw-r--r-- | t/perf/opcount.t | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/t/perf/opcount.t b/t/perf/opcount.t index 30e0676660..0c21247bd2 100644 --- a/t/perf/opcount.t +++ b/t/perf/opcount.t @@ -712,8 +712,8 @@ test_opcount(0, "builtin::is_bool is replaced with direct opcode", { entersub => 0, is_bool => 1, - padsv => 4, - sassign => 1, + padsv => 3, + padsv_store => 1, }); test_opcount(0, "builtin::is_bool gets constant-folded", @@ -788,4 +788,12 @@ test_opcount(0, "builtin::is_tainted is replaced with direct opcode", is_tainted => 1, }); +# sassign + padsv combinations are replaced by padsv_store +test_opcount(0, "sassign + padsv replaced by padsv_store", + sub { my $y; my $z = $y = 3; }, + { + padsv => 1, + padsv_store => 2, + }); + done_testing(); |