From 8f84553cb56a6cbe0ae6785dba18c81ed6e47641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Mon, 8 May 2017 16:08:34 +0200 Subject: 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. --- lib/compiler/src/erl_bifs.erl | 3 --- 1 file changed, 3 deletions(-) (limited to 'lib/compiler/src/erl_bifs.erl') 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; -- cgit v1.2.3