diff options
author | Björn Gustavsson <[email protected]> | 2017-05-08 16:08:34 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2017-05-10 10:37:11 +0200 |
commit | 8f84553cb56a6cbe0ae6785dba18c81ed6e47641 (patch) | |
tree | 31f0519c91b1ea265907e74491fd13d209a03ae9 /lib/compiler/src | |
parent | 2bcc3f97e9273c543b803a812da393e640464978 (diff) | |
download | otp-8f84553cb56a6cbe0ae6785dba18c81ed6e47641.tar.gz otp-8f84553cb56a6cbe0ae6785dba18c81ed6e47641.tar.bz2 otp-8f84553cb56a6cbe0ae6785dba18c81ed6e47641.zip |
erl_bifs: Remove pure BIFs serving no useful purpose
Functions that can are known be pure can be evaluated at
compile-time if the arguments are literals and if the result is
expressible as a literal.
list_to_ref/1 and list_to_port/1 returns terms that cannot be
expressed as literals, so the optimization is not possible.
The argument for port_to_list/1 is never a literal, so there is
no way to evaluate it at compile-time. Therefore, marking those
functions as pure serves no useful purpose.
Note: list_to_pid/1 *is* marked as pure, but only so that we can test
the code in sys_core_fold that rejects pure functions that evaluate to
at term that is not possible to express as a literal. It is sufficient
to have one pure function of that kind.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/erl_bifs.erl | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/lib/compiler/src/erl_bifs.erl b/lib/compiler/src/erl_bifs.erl index 043fe227a9..bafa9d75b7 100644 --- a/lib/compiler/src/erl_bifs.erl +++ b/lib/compiler/src/erl_bifs.erl @@ -107,14 +107,11 @@ is_pure(erlang, list_to_binary, 1) -> true; is_pure(erlang, list_to_float, 1) -> true; is_pure(erlang, list_to_integer, 1) -> true; is_pure(erlang, list_to_pid, 1) -> true; -is_pure(erlang, list_to_port, 1) -> true; -is_pure(erlang, list_to_ref, 1) -> true; is_pure(erlang, list_to_tuple, 1) -> true; is_pure(erlang, max, 2) -> true; is_pure(erlang, min, 2) -> true; is_pure(erlang, phash, 2) -> false; is_pure(erlang, pid_to_list, 1) -> true; -is_pure(erlang, port_to_list, 1) -> true; is_pure(erlang, round, 1) -> true; is_pure(erlang, setelement, 3) -> true; is_pure(erlang, size, 1) -> true; |