diff options
author | John Högberg <[email protected]> | 2019-06-20 09:53:53 +0200 |
---|---|---|
committer | John Högberg <[email protected]> | 2019-07-05 11:33:38 +0200 |
commit | 950ce53fc5e4c80d10c78d0cf1fad88745b633eb (patch) | |
tree | a54c27791f76cbd9a837980f073ac7784be43c32 /lib/compiler/src | |
parent | 1a872b02ee81c0f2653426d4796771ec3bfaea0c (diff) | |
download | otp-950ce53fc5e4c80d10c78d0cf1fad88745b633eb.tar.gz otp-950ce53fc5e4c80d10c78d0cf1fad88745b633eb.tar.bz2 otp-950ce53fc5e4c80d10c78d0cf1fad88745b633eb.zip |
compiler: Remove beam_call_types:never_throws/3
The idea was to look at the argument types to see if we could get
rid of failure branches, but this didn't turn out to be useful and
the function ended up being a copy of erl_bifs:is_safe/3, so we may
as well get rid of it.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/beam_call_types.erl | 34 | ||||
-rw-r--r-- | lib/compiler/src/beam_validator.erl | 2 |
2 files changed, 2 insertions, 34 deletions
diff --git a/lib/compiler/src/beam_call_types.erl b/lib/compiler/src/beam_call_types.erl index e72250ab37..2aba6f7961 100644 --- a/lib/compiler/src/beam_call_types.erl +++ b/lib/compiler/src/beam_call_types.erl @@ -24,39 +24,7 @@ -import(lists, [duplicate/2,foldl/3]). --export([never_throws/3, types/3]). - --spec never_throws(Mod, Func, Arity) -> boolean() when - Mod :: atom(), - Func :: atom(), - Arity :: non_neg_integer(). - -never_throws(erlang, '/=', 2) -> true; -never_throws(erlang, '<', 2) -> true; -never_throws(erlang, '=/=', 2) -> true; -never_throws(erlang, '=:=', 2) -> true; -never_throws(erlang, '=<', 2) -> true; -never_throws(erlang, '==', 2) -> true; -never_throws(erlang, '>', 2) -> true; -never_throws(erlang, '>=', 2) -> true; -never_throws(erlang, is_atom, 1) -> true; -never_throws(erlang, is_boolean, 1) -> true; -never_throws(erlang, is_binary, 1) -> true; -never_throws(erlang, is_bitstring, 1) -> true; -never_throws(erlang, is_float, 1) -> true; -never_throws(erlang, is_function, 1) -> true; -never_throws(erlang, is_integer, 1) -> true; -never_throws(erlang, is_list, 1) -> true; -never_throws(erlang, is_map, 1) -> true; -never_throws(erlang, is_number, 1) -> true; -never_throws(erlang, is_pid, 1) -> true; -never_throws(erlang, is_port, 1) -> true; -never_throws(erlang, is_reference, 1) -> true; -never_throws(erlang, is_tuple, 1) -> true; -never_throws(erlang, get, 1) -> true; -never_throws(erlang, self, 0) -> true; -never_throws(erlang, node, 0) -> true; -never_throws(_, _, _) -> false. +-export([types/3]). %% %% Returns the inferred return and argument types for known functions, and diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl index 8064912aac..d959700b88 100644 --- a/lib/compiler/src/beam_validator.erl +++ b/lib/compiler/src/beam_validator.erl @@ -396,7 +396,7 @@ valfun_1({init,Reg}, Vst) -> valfun_1({test_heap,Heap,Live}, Vst) -> test_heap(Heap, Live, Vst); valfun_1({bif,Op,{f,_},Ss,Dst}=I, Vst) -> - case beam_call_types:never_throws(erlang, Op, length(Ss)) of + case erl_bifs:is_safe(erlang, Op, length(Ss)) of true -> %% It can't fail, so we finish handling it here (not updating %% catch state). |