From 5a1b230f3ecb6d8b4f88e6df8fd33e3707f80cd8 Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Fri, 28 May 2010 14:37:20 +0300 Subject: Remove tid() from the predefined builtin types. Change erl_lint not to recognize this type as builtin and add a new erl_lint.beam version in bootstrap. Add an -opaque type declaration for this type in ets.erl and also declare this as an exported type. Use this type in file debugger/src/dbg_iload.erl in a spec. While at it, also clean up this later file a bit. --- bootstrap/lib/stdlib/ebin/erl_lint.beam | Bin 76548 -> 76652 bytes lib/debugger/src/dbg_iload.erl | 18 +++++++----------- lib/stdlib/src/erl_lint.erl | 2 -- lib/stdlib/src/ets.erl | 9 ++++++--- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/bootstrap/lib/stdlib/ebin/erl_lint.beam b/bootstrap/lib/stdlib/ebin/erl_lint.beam index 6862410a3a..1f1c43242d 100644 Binary files a/bootstrap/lib/stdlib/ebin/erl_lint.beam and b/bootstrap/lib/stdlib/ebin/erl_lint.beam differ diff --git a/lib/debugger/src/dbg_iload.erl b/lib/debugger/src/dbg_iload.erl index 1216338006..24167003c3 100644 --- a/lib/debugger/src/dbg_iload.erl +++ b/lib/debugger/src/dbg_iload.erl @@ -18,12 +18,8 @@ %% -module(dbg_iload). -%% External exports -export([load_mod/4]). -%% Internal exports --export([load_mod1/4]). - %%==================================================================== %% External exports %%==================================================================== @@ -36,29 +32,29 @@ %% Db = ETS identifier %% Load a new module into the database. %% -%% We want the loading of a module to be syncronous so no other +%% We want the loading of a module to be synchronous so that no other %% process tries to interpret code in a module not being completely %% loaded. This is achieved as this function is called from %% dbg_iserver. We are suspended until the module has been loaded. %%-------------------------------------------------------------------- +-spec load_mod(Mod, file:filename(), binary(), ets:tid()) -> + {'ok', Mod} when is_subtype(Mod, atom()). + load_mod(Mod, File, Binary, Db) -> Flag = process_flag(trap_exit, true), - Pid = spawn_link(?MODULE, load_mod1, [Mod, File, Binary, Db]), + Pid = spawn_link(fun () -> load_mod1(Mod, File, Binary, Db) end), receive {'EXIT', Pid, What} -> process_flag(trap_exit, Flag), What end. -%%==================================================================== -%% Internal exports -%%==================================================================== +-spec load_mod1(atom(), file:filename(), binary(), ets:tid()) -> no_return(). load_mod1(Mod, File, Binary, Db) -> store_module(Mod, File, Binary, Db), exit({ok, Mod}). - %%==================================================================== %% Internal functions %%==================================================================== @@ -84,7 +80,7 @@ store_module(Mod, File, Binary, Db) -> Attr = store_forms(Forms, Mod, Db, Exp, []), erase(mod_md5), erase(current_function), -% store_funs(Db, Mod), + %% store_funs(Db, Mod), erase(vcount), erase(funs), erase(fun_count), diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl index 6bbb52ebae..c8bbb04e9a 100644 --- a/lib/stdlib/src/erl_lint.erl +++ b/lib/stdlib/src/erl_lint.erl @@ -2672,7 +2672,6 @@ default_types() -> {set, 0}, {string, 0}, {term, 0}, - {tid, 0}, {timeout, 0}, {var, 1}], dict:from_list([{T, -1} || T <- DefTypes]). @@ -2694,7 +2693,6 @@ is_newly_introduced_builtin_type({gb_tree, 0}) -> true; % opaque is_newly_introduced_builtin_type({iodata, 0}) -> true; is_newly_introduced_builtin_type({queue, 0}) -> true; % opaque is_newly_introduced_builtin_type({set, 0}) -> true; % opaque -is_newly_introduced_builtin_type({tid, 0}) -> true; % opaque %% R13B01 is_newly_introduced_builtin_type({boolean, 0}) -> true; is_newly_introduced_builtin_type({Name, _}) when is_atom(Name) -> false. diff --git a/lib/stdlib/src/ets.erl b/lib/stdlib/src/ets.erl index b0a197d784..1d033f6f7b 100644 --- a/lib/stdlib/src/ets.erl +++ b/lib/stdlib/src/ets.erl @@ -42,12 +42,15 @@ -export([i/0, i/1, i/2, i/3]). --export_type([tab/0]). +-export_type([tab/0, tid/0]). -%%------------------------------------------------------------------------------ +%%----------------------------------------------------------------------------- -type tab() :: atom() | tid(). +%% a similar definition is also in erl_types +-opaque tid() :: integer(). + -type ext_info() :: 'md5sum' | 'object_count'. -type protection() :: 'private' | 'protected' | 'public'. -type type() :: 'bag' | 'duplicate_bag' | 'ordered_set' | 'set'. @@ -65,7 +68,7 @@ -type match_pattern() :: atom() | tuple(). -type match_specs() :: [{match_pattern(), [_], [_]}]. -%%------------------------------------------------------------------------------ +%%----------------------------------------------------------------------------- %% The following functions used to be found in this module, but %% are now BIFs (i.e. implemented in C). -- cgit v1.2.3