aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-05-25 06:41:04 +0200
committerBjörn Gustavsson <[email protected]>2016-05-30 13:19:20 +0200
commit4d6601a9cd84e31b0ab27e3587e82425dced2c75 (patch)
treeb7a769b2b20a997ee15926563b3af12053015d04 /lib/compiler
parenta6edfacf112f3048630bbd002b1eb8d933ebb2df (diff)
downloadotp-4d6601a9cd84e31b0ab27e3587e82425dced2c75.tar.gz
otp-4d6601a9cd84e31b0ab27e3587e82425dced2c75.tar.bz2
otp-4d6601a9cd84e31b0ab27e3587e82425dced2c75.zip
Teach beam_utils:is_pure_test/1 to handle is_bitstr and is_function2
The 'is_bitstr' and 'is_function2' tests are pure. The corresponding BIFs have different names; thus the default call to erl_internal:new_type_test/2 is not sufficient.
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/src/beam_utils.erl5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/compiler/src/beam_utils.erl b/lib/compiler/src/beam_utils.erl
index cc5bb4b98b..a15ecf633e 100644
--- a/lib/compiler/src/beam_utils.erl
+++ b/lib/compiler/src/beam_utils.erl
@@ -167,8 +167,7 @@ bif_to_test(is_record, [_,_,_]=Ops, Fail) -> {test,is_record,Fail,Ops}.
%% is_pure_test({test,Op,Fail,Ops}) -> true|false.
%% Return 'true' if the test instruction does not modify any
-%% registers and/or bit syntax matching state, nor modifies
-%% any bit syntax matching state.
+%% registers and/or bit syntax matching state.
%%
is_pure_test({test,is_eq,_,[_,_]}) -> true;
is_pure_test({test,is_ne,_,[_,_]}) -> true;
@@ -180,6 +179,8 @@ is_pure_test({test,is_nil,_,[_]}) -> true;
is_pure_test({test,is_nonempty_list,_,[_]}) -> true;
is_pure_test({test,test_arity,_,[_,_]}) -> true;
is_pure_test({test,has_map_fields,_,[_|_]}) -> true;
+is_pure_test({test,is_bitstr,_,[_]}) -> true;
+is_pure_test({test,is_function2,_,[_,_]}) -> true;
is_pure_test({test,Op,_,Ops}) ->
erl_internal:new_type_test(Op, length(Ops)).