diff options
author | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2021-12-02 13:06:27 +0000 |
---|---|---|
committer | Paul Evans <leonerd@leonerd.org.uk> | 2021-12-03 10:59:24 +0000 |
commit | 1c57e39668d648fff43de7f8971c1bf9f23debfc (patch) | |
tree | 28c64613317397e289d839617269e7a1cbf4cd8c /t/perf | |
parent | e728f790bcefcaf1d8b42e2f7ee16a9125f0af22 (diff) | |
download | perl-1c57e39668d648fff43de7f8971c1bf9f23debfc.tar.gz |
Improvements to OP_ISBOOL
* Apply OA_RETSCALAR, OA_TARGLEX and OA_FOLDCONST flags
* Handle both 'get' and 'set' magic
Diffstat (limited to 't/perf')
-rw-r--r-- | t/perf/opcount.t | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/t/perf/opcount.t b/t/perf/opcount.t index 815be12e87..80e3973d7d 100644 --- a/t/perf/opcount.t +++ b/t/perf/opcount.t @@ -696,10 +696,20 @@ test_opcount(0, "builtin::true/false are replaced with constants", }); test_opcount(0, "builtin::isbool is replaced with direct opcode", - sub { my $x = 123; my $y = builtin::isbool($x); }, + sub { my $x; my $y; $y = builtin::isbool($x); }, { entersub => 0, isbool => 1, + padsv => 3, # OA_TARGLEX applies so only 3, not 4 + sassign => 0, + }); + +test_opcount(0, "builtin::isbool gets constant-folded", + sub { builtin::isbool(123); }, + { + entersub => 0, + isbool => 0, + const => 1, }); done_testing(); |