aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2011-09-16 15:14:06 +0200
committerBjörn-Egil Dahlberg <[email protected]>2011-09-16 15:14:06 +0200
commit3753f81232c68c8db9e6dcd0b2911583cf1b5bd1 (patch)
tree600b4e671d3b21f88c7c2c1fa13802dcb4144ac4 /lib
parenta6b27d639e5c7c85e765331cfe7befbe23c4954b (diff)
parent1cc98829ed8649e585556cd009495522e42f21da (diff)
downloadotp-3753f81232c68c8db9e6dcd0b2911583cf1b5bd1.tar.gz
otp-3753f81232c68c8db9e6dcd0b2911583cf1b5bd1.tar.bz2
otp-3753f81232c68c8db9e6dcd0b2911583cf1b5bd1.zip
Merge branch 'pan/erl-bif-types/OTP-9496' into dev
* pan/erl-bif-types/OTP-9496: Cleanup ETS bif's in hipe:erl_bif_types.erl (for dialyzer)
Diffstat (limited to 'lib')
-rw-r--r--lib/hipe/cerl/erl_bif_types.erl19
-rw-r--r--lib/stdlib/doc/src/ets.xml3
-rw-r--r--lib/stdlib/test/ets_SUITE.erl38
3 files changed, 40 insertions, 20 deletions
diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl
index 10d60a4c9a..827fa79ec5 100644
--- a/lib/hipe/cerl/erl_bif_types.erl
+++ b/lib/hipe/cerl/erl_bif_types.erl
@@ -1203,6 +1203,7 @@ type(erlang, process_flag, 2, Xs) ->
case t_atom_vals(Flag) of
['error_handler'] -> t_atom();
['min_heap_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();
@@ -1903,7 +1904,7 @@ type(prim_file, internal_native2name, 1, Xs) ->
fun (_) -> t_prim_file_name() end);
type(prim_file, internal_normalize_utf8, 1, Xs) ->
strict(arg_types(prim_file, internal_normalize_utf8, 1), Xs,
- fun (_) -> t_binary() end);
+ fun (_) -> t_unicode_string() end);
%%-- gen_tcp ------------------------------------------------------------------
%% NOTE: All type information for this module added to avoid loss of precision
type(gen_tcp, accept, 1, Xs) ->
@@ -3747,6 +3748,7 @@ arg_types(erlang, process_display, 2) ->
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_atom('scheduler'), % undocumented
t_atom('monitor_nodes'), % undocumented
t_tuple([t_atom('monitor_nodes'), t_list()])]), % undocumented
t_sup([t_boolean(), t_atom(), t_non_neg_integer()])];
@@ -3785,7 +3787,7 @@ arg_types(erlang, send, 3) ->
arg_types(erlang, send_after, 3) ->
[t_non_neg_integer(), t_sup(t_pid(), t_atom()), t_any()];
arg_types(erlang, seq_trace, 2) ->
- [t_atom(), t_sup([t_boolean(), t_tuple([t_fixnum(), t_fixnum()]), t_nil()])];
+ [t_atom(), t_sup([t_boolean(), t_tuple([t_fixnum(), t_fixnum()]), t_fixnum(), t_nil()])];
arg_types(erlang, seq_trace_info, 1) ->
[t_seq_trace_info()];
arg_types(erlang, seq_trace_print, 1) ->
@@ -4034,7 +4036,7 @@ arg_types(ets, match_object, 3) ->
arg_types(ets, match_spec_compile, 1) ->
[t_matchspecs()];
arg_types(ets, match_spec_run_r, 3) ->
- [t_matchspecs(), t_any(), t_list()];
+ [t_list(t_tuple()),t_matchspecs(), t_list()];
arg_types(ets, member, 2) ->
[t_tab(), t_any()];
arg_types(ets, new, 2) ->
@@ -4066,8 +4068,12 @@ arg_types(ets, select_reverse, 3) ->
arg_types(ets, slot, 2) ->
[t_tab(), t_non_neg_fixnum()]; % 2nd arg can be 0
arg_types(ets, setopts, 2) ->
- Opt = t_sup(t_tuple([t_atom('heir'), t_pid(), t_any()]),
- t_tuple([t_atom('heir'), t_atom('none')])),
+ Opt = t_sup([t_tuple([t_atom('heir'), t_pid(), t_any()]),
+ t_tuple([t_atom('heir'), t_atom('none')]),
+ t_tuple([t_atom('protection'),
+ t_sup([t_atom('protected'),
+ t_atom('private'),
+ t_atom('public')])])]),
[t_tab(), t_sup(Opt, t_list(Opt))];
arg_types(ets, update_counter, 3) ->
Int = t_integer(),
@@ -4859,6 +4865,9 @@ t_ets_info_items() ->
t_atom('owner'),
t_atom('protection'),
t_atom('size'),
+ t_atom('compressed'),
+ t_atom('heir'),
+ t_atom('stats'),
t_atom('type')]).
%% =====================================================================
diff --git a/lib/stdlib/doc/src/ets.xml b/lib/stdlib/doc/src/ets.xml
index 8c952708c5..f19f92be6f 100644
--- a/lib/stdlib/doc/src/ets.xml
+++ b/lib/stdlib/doc/src/ets.xml
@@ -513,6 +513,9 @@ Error: fun containing local Erlang function calls
the table has been fixed by the process.</p>
<p>If the table never has been fixed, the call returns
<c>false</c>.</p>
+ <item><c>Item=stats, Value=tuple()</c> <br></br>
+ Returns internal statistics about set, bag and duplicate_bag tables on an internal format used by OTP test suites.
+ Not for production use.</item>
</item>
</list>
</desc>
diff --git a/lib/stdlib/test/ets_SUITE.erl b/lib/stdlib/test/ets_SUITE.erl
index 3ac6da3d28..57df963ae2 100644
--- a/lib/stdlib/test/ets_SUITE.erl
+++ b/lib/stdlib/test/ets_SUITE.erl
@@ -819,6 +819,14 @@ t_delete_all_objects(Config) when is_list(Config) ->
repeat_for_opts(t_delete_all_objects_do),
?line verify_etsmem(EtsMem).
+get_kept_objects(T) ->
+ case ets:info(T,stats) of
+ false ->
+ 0;
+ {_,_,_,_,_,_,KO} ->
+ KO
+ end.
+
t_delete_all_objects_do(Opts) ->
?line T=ets_new(x,Opts),
?line filltabint(T,4000),
@@ -828,10 +836,10 @@ t_delete_all_objects_do(Opts) ->
?line true = ets:delete_all_objects(T),
?line '$end_of_table' = ets:next(T,O),
?line 0 = ets:info(T,size),
- ?line 4000 = ets:info(T,kept_objects),
+ ?line 4000 = get_kept_objects(T),
?line ets:safe_fixtable(T,false),
?line 0 = ets:info(T,size),
- ?line 0 = ets:info(T,kept_objects),
+ ?line 0 = get_kept_objects(T),
?line filltabint(T,4000),
?line 4000 = ets:info(T,size),
?line true = ets:delete_all_objects(T),
@@ -861,10 +869,10 @@ t_delete_object_do(Opts) ->
?line ets:delete_object(T,{First, integer_to_list(First)}),
?line Next = ets:next(T,First),
?line 3999 = ets:info(T,size),
- ?line 1 = ets:info(T,kept_objects),
+ ?line 1 = get_kept_objects(T),
?line ets:safe_fixtable(T,false),
?line 3999 = ets:info(T,size),
- ?line 0 = ets:info(T,kept_objects),
+ ?line 0 = get_kept_objects(T),
?line ets:delete(T),
?line T1 = ets_new(x,[ordered_set | Opts]),
?line filltabint(T1,4000),
@@ -4971,7 +4979,7 @@ grow_pseudo_deleted_do(Type) ->
[true]}]),
Left = Mult*(Mod-1),
?line Left = ets:info(T,size),
- ?line Mult = ets:info(T,kept_objects),
+ ?line Mult = get_kept_objects(T),
filltabstr(T,Mult),
spawn_opt(fun()-> ?line true = ets:info(T,fixed),
Self ! start,
@@ -4985,7 +4993,7 @@ grow_pseudo_deleted_do(Type) ->
?line true = ets:safe_fixtable(T,false),
io:format("Unfix table done. ~p nitems=~p\n",[now(),ets:info(T,size)]),
?line false = ets:info(T,fixed),
- ?line 0 = ets:info(T,kept_objects),
+ ?line 0 = get_kept_objects(T),
?line done = receive_any(),
%%verify_table_load(T), % may fail if concurrency is poor (genny)
ets:delete(T),
@@ -5012,7 +5020,7 @@ shrink_pseudo_deleted_do(Type) ->
[{'>', '$1', Half}],
[true]}]),
?line Half = ets:info(T,size),
- ?line Half = ets:info(T,kept_objects),
+ ?line Half = get_kept_objects(T),
spawn_opt(fun()-> ?line true = ets:info(T,fixed),
Self ! start,
io:format("Starting to delete... ~p\n",[now()]),
@@ -5025,7 +5033,7 @@ shrink_pseudo_deleted_do(Type) ->
?line true = ets:safe_fixtable(T,false),
io:format("Unfix table done. ~p nitems=~p\n",[now(),ets:info(T,size)]),
?line false = ets:info(T,fixed),
- ?line 0 = ets:info(T,kept_objects),
+ ?line 0 = get_kept_objects(T),
?line done = receive_any(),
%%verify_table_load(T), % may fail if concurrency is poor (genny)
ets:delete(T),
@@ -5141,7 +5149,7 @@ smp_fixed_delete_do() ->
?line 0 = ets:info(T,size),
?line true = ets:info(T,fixed),
?line Buckets = num_of_buckets(T),
- ?line NumOfObjs = ets:info(T,kept_objects),
+ ?line NumOfObjs = get_kept_objects(T),
ets:safe_fixtable(T,false),
%% Will fail as unfix does not shrink the table:
%%?line Mem = ets:info(T,memory),
@@ -5173,7 +5181,7 @@ smp_unfix_fix_do() ->
Left = NumOfObjs - Deleted,
?line Left = ets:info(T,size),
?line true = ets:info(T,fixed),
- ?line Deleted = ets:info(T,kept_objects),
+ ?line Deleted = get_kept_objects(T),
{Child, Mref} =
spawn_opt(fun()-> ?line true = ets:info(T,fixed),
@@ -5190,7 +5198,7 @@ smp_unfix_fix_do() ->
end,
Deleted),
?line 0 = ets:info(T,size),
- ?line true = ets:info(T,kept_objects) >= Left,
+ ?line true = get_kept_objects(T) >= Left,
?line done = receive_any()
end,
[link, monitor, {scheduler,2}]),
@@ -5203,7 +5211,7 @@ smp_unfix_fix_do() ->
Child ! done,
{'DOWN', Mref, process, Child, normal} = receive_any(),
?line false = ets:info(T,fixed),
- ?line 0 = ets:info(T,kept_objects),
+ ?line 0 = get_kept_objects(T),
%%verify_table_load(T),
ets:delete(T),
process_flag(scheduler,0).
@@ -5241,7 +5249,7 @@ otp_8166_do(WC) ->
ZombieCrPid ! quit,
{'DOWN', ZombieCrMref, process, ZombieCrPid, normal} = receive_any(),
?line false = ets:info(T,fixed),
- ?line 0 = ets:info(T,kept_objects),
+ ?line 0 = get_kept_objects(T),
%%verify_table_load(T),
ets:delete(T),
process_flag(scheduler,0).
@@ -5308,7 +5316,7 @@ otp_8166_zombie_creator(T,Deleted) ->
verify_table_load(T) ->
?line Stats = ets:info(T,stats),
- ?line {Buckets,AvgLen,StdDev,ExpSD,_MinLen,_MaxLen} = Stats,
+ ?line {Buckets,AvgLen,StdDev,ExpSD,_MinLen,_MaxLen,_} = Stats,
?line ok = if
AvgLen > 7 ->
io:format("Table overloaded: Stats=~p\n~p\n",
@@ -5920,7 +5928,7 @@ very_big_num(0, Result) ->
?line Result.
make_port() ->
- ?line open_port({spawn, efile}, [eof]).
+ ?line open_port({spawn, "efile"}, [eof]).
make_pid() ->
?line spawn_link(?MODULE, sleeper, []).