aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-01-19 12:37:49 +0100
committerBjörn Gustavsson <[email protected]>2018-01-24 12:43:36 +0100
commit4ad250c85a1abb80b6e0a30855c8982d174b369c (patch)
treeb927b57166df183c787bf3369c310a3b33094e04 /lib/compiler/test
parent4571e13801c53e1c2bbf744ab178a4a0f9f0a7cd (diff)
downloadotp-4ad250c85a1abb80b6e0a30855c8982d174b369c.tar.gz
otp-4ad250c85a1abb80b6e0a30855c8982d174b369c.tar.bz2
otp-4ad250c85a1abb80b6e0a30855c8982d174b369c.zip
Optimize matching of empty binaries
Extend an existing optimization in beam_dead to avoid creating a match context when matching an empty binary.
Diffstat (limited to 'lib/compiler/test')
-rw-r--r--lib/compiler/test/bs_match_SUITE.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/compiler/test/bs_match_SUITE.erl b/lib/compiler/test/bs_match_SUITE.erl
index 4bd5e8e2e1..235956a714 100644
--- a/lib/compiler/test/bs_match_SUITE.erl
+++ b/lib/compiler/test/bs_match_SUITE.erl
@@ -678,6 +678,10 @@ coverage(Config) when is_list(Config) ->
<<>> = coverage_per_key(<<4:32>>),
<<$a,$b,$c>> = coverage_per_key(<<7:32,"abc">>),
+ binary = coverage_bitstring(<<>>),
+ binary = coverage_bitstring(<<7>>),
+ bitstring = coverage_bitstring(<<7:4>>),
+ other = coverage_bitstring([a]),
ok.
coverage_fold(Fun, Acc, <<H,T/binary>>) ->
@@ -768,6 +772,10 @@ coverage_per_key(<<BinSize:32,Bin/binary>> = B) ->
true = (byte_size(B) =:= BinSize),
Bin.
+coverage_bitstring(Bin) when is_binary(Bin) -> binary;
+coverage_bitstring(<<_/bitstring>>) -> bitstring;
+coverage_bitstring(_) -> other.
+
multiple_uses(Config) when is_list(Config) ->
{344,62879,345,<<245,159,1,89>>} = multiple_uses_1(<<1,88,245,159,1,89>>),
true = multiple_uses_2(<<0,0,197,18>>),