[erlang-patches] Extended specs for built-in functions
Henrik Nord
henrik@REDACTED
Mon Feb 13 11:53:10 CET 2012
Hi
We have done a major rework in this area. (Check the master branch on
github for specifics).
I will try to merge this into maint, as the other changes will (most
likely) not take effect until R16.
If there are tests failing and/or other complications this patch might
not make it to maint.
Thank you for the contribution!
On 01/16/2012 03:21 PM, Tobias Schlager wrote:
> This patch extends the specs for the following built-in functions:
> * process_flag/2,3
> * system_flag/2
> * system_info/1
> * spawn_opt/2,3,4
>
> The main intention for this patch was to make dialyzer recognize the process_flag option 'sensitive'. When fixing this issue I noticed some more missing specs and added what I could find in the latest documentation.
>
> Regards
> Tobias
>
>
> > From 2d57bd2fe55573e48c035cc0e1ecc94617263630 Mon Sep 17 00:00:00 2001
> From: Tobias Schlager<tobias.schlager@REDACTED>
> Date: Mon, 16 Jan 2012 14:29:01 +0100
> Subject: [PATCH] extended specs for built-in functions
>
> ---
> lib/hipe/cerl/erl_bif_types.erl | 48 ++++++++++++++++++++++++++++++++++++--
> 1 files changed, 45 insertions(+), 3 deletions(-)
>
> diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl
> index cee399e..88058ae 100644
> --- a/lib/hipe/cerl/erl_bif_types.erl
> +++ b/lib/hipe/cerl/erl_bif_types.erl
> @@ -1202,11 +1202,13 @@ type(erlang, process_flag, 2, Xs) ->
> case t_atom_vals(Flag) of
> ['error_handler'] -> t_atom();
> ['min_heap_size'] -> t_non_neg_integer();
> + ['min_bin_vheap_size'] -> t_non_neg_integer();
> ['scheduler'] -> t_non_neg_integer();
> ['monitor_nodes'] -> t_boolean();
> ['priority'] -> t_process_priority_level();
> ['save_calls'] -> t_non_neg_integer();
> ['trap_exit'] -> t_boolean();
> + ['sensitive'] -> t_boolean();
> List when is_list(List) ->
> T_process_flag_returns;
> unknown ->
> @@ -1503,6 +1505,8 @@ type(erlang, system_flag, 2, Xs) ->
> t_non_neg_fixnum();
> ['min_heap_size'] ->
> t_non_neg_fixnum();
> + ['min_bin_vheap_size'] ->
> + t_non_neg_fixnum();
> ['multi_scheduling'] ->
> t_system_multi_scheduling();
> ['schedulers_online'] ->
> @@ -1546,8 +1550,12 @@ type(erlang, system_info, 1, Xs) ->
> t_list(t_tuple([t_atom(),
> t_list(t_tuple([t_atom(),
> t_any()]))]))]);
> + ['build_type'] ->
> + t_system_build_type_return();
> ['break_ignored'] ->
> t_boolean();
> + ['c_compiler_used'] ->
> + t_tuple([t_atom(), t_any()]);
> ['cpu_topology'] ->
> t_system_cpu_topology();
> ['compat_rel'] ->
> @@ -1560,6 +1568,8 @@ type(erlang, system_info, 1, Xs) ->
> t_binary();
> ['dist_ctrl'] ->
> t_list(t_tuple([t_atom(), t_sup([t_pid(), t_port])]));
> + ['driver_version'] ->
> + t_string();
> %% elib_malloc is intentionally not included,
> %% because it scheduled for removal in R15.
> ['endian'] ->
> @@ -1573,7 +1583,9 @@ type(erlang, system_info, 1, Xs) ->
> ['heap_sizes'] ->
> t_list(t_integer());
> ['heap_type'] ->
> - t_sup([t_atom('private'), t_atom('hybrid')]);
> + t_sup([t_atom('private'),
> + t_atom('shared'),
> + t_atom('hybrid')]);
> ['hipe_architecture'] ->
> t_atoms(['amd64', 'arm', 'powerpc', 'ppc64',
> 'undefined', 'ultrasparc', 'x86']);
> @@ -1581,12 +1593,20 @@ type(erlang, system_info, 1, Xs) ->
> t_binary();
> ['internal_cpu_topology'] -> %% Undocumented internal feature
> t_internal_cpu_topology();
> + ['kernel_poll'] ->
> + t_boolean();
> ['loaded'] ->
> t_binary();
> ['logical_processors'] ->
> t_non_neg_fixnum();
> ['machine'] ->
> t_string();
> + ['min_heap_size'] ->
> + t_tuple([t_atom('min_heap_size'),
> + t_non_neg_integer()]);
> + ['min_bin_vheap_size'] ->
> + t_tuple([t_atom('min_bin_vheap_size'),
> + t_non_neg_integer()]);
> ['multi_scheduling'] ->
> t_system_multi_scheduling();
> ['multi_scheduling_blockers'] ->
> @@ -1601,6 +1621,8 @@ type(erlang, system_info, 1, Xs) ->
> t_non_neg_fixnum(),
> t_non_neg_fixnum()]),
> t_string());
> + ['otp_release'] ->
> + t_string();
> ['process_count'] ->
> t_non_neg_fixnum();
> ['process_limit'] ->
> @@ -1630,6 +1652,8 @@ type(erlang, system_info, 1, Xs) ->
> t_non_neg_fixnum();
> ['trace_control_word'] ->
> t_integer();
> + ['update_cpu_info'] ->
> + t_sup([t_atom('changed'), t_atom('unchanged')]);
> ['version'] ->
> t_string();
> ['wordsize'] ->
> @@ -3747,8 +3771,13 @@ arg_types(erlang, pre_loaded, 0) ->
> arg_types(erlang, process_display, 2) ->
> [t_pid(), t_atom('backtrace')];
> arg_types(erlang, process_flag, 2) ->
> - [t_sup([t_atom('trap_exit'), t_atom('error_handler'),
> - t_atom('min_heap_size'), t_atom('priority'), t_atom('save_calls'),
> + [t_sup([t_atom('trap_exit'),
> + t_atom('error_handler'),
> + t_atom('min_heap_size'),
> + t_atom('min_bin_vheap_size'),
> + t_atom('priority'),
> + t_atom('save_calls'),
> + t_atom('sensitive'),
> t_atom('scheduler'), % undocumented
> t_atom('monitor_nodes'), % undocumented
> t_tuple([t_atom('monitor_nodes'), t_list()])]), % undocumented
> @@ -3861,6 +3890,7 @@ arg_types(erlang, system_flag, 2) ->
> t_atom('display_items'), % undocumented
> t_atom('fullsweep_after'),
> t_atom('min_heap_size'),
> + t_atom('min_bin_vheap_size'),
> t_atom('multi_scheduling'),
> t_atom('schedulers_online'),
> t_atom('scheduler_bind_type'),
> @@ -4733,6 +4763,7 @@ t_spawn_options() ->
> t_atom('monitor'),
> t_tuple([t_atom('priority'), t_process_priority_level()]),
> t_tuple([t_atom('min_heap_size'), t_fixnum()]),
> + t_tuple([t_atom('min_bin_vheap_size'), t_fixnum()]),
> t_tuple([t_atom('fullsweep_after'), t_fixnum()])]).
>
> t_spawn_opt_return(List) ->
> @@ -4821,6 +4852,17 @@ t_system_profile_return() ->
> t_sup(t_atom('undefined'),
> t_tuple([t_sup(t_pid(), t_port()), t_system_profile_options()])).
>
> +t_system_build_type_return() ->
> + t_sup([t_atom('opt'),
> + t_atom('debug'),
> + t_atom('purify'),
> + t_atom('quantify'),
> + t_atom('purecov'),
> + t_atom('gcov'),
> + t_atom('valgrind'),
> + t_atom('gprof'),
> + t_atom('lcnt')]).
> +
> %% =====================================================================
> %% These are used for the built-in functions of 'ets'
> %% =====================================================================
> --
> 1.7.7.5
>
>
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches
--
/Henrik Nord Erlang/OTP
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20120213/098db865/attachment.htm>
More information about the erlang-patches
mailing list