diff options
author | Hans Bolinder <[email protected]> | 2017-04-13 15:53:48 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2017-06-13 13:40:26 +0200 |
commit | 3ffed207dffdaad6924e3333f8ee30ac5920aa24 (patch) | |
tree | 604ec81a96540dbc8c9e4284811e47ac7af7424d /lib/dialyzer/src/dialyzer_utils.erl | |
parent | ce6fe3c77b31e6c0fcb13d347c3fcbbedfd544e7 (diff) | |
download | otp-3ffed207dffdaad6924e3333f8ee30ac5920aa24.tar.gz otp-3ffed207dffdaad6924e3333f8ee30ac5920aa24.tar.bz2 otp-3ffed207dffdaad6924e3333f8ee30ac5920aa24.zip |
dialyzer: Do not use two records for PLTs
Instead of two records, #plt{} with dict:s and #mini_plt{} with ETS
tables, one record is used for representing PLT:s in RAM.
The #mini_plt{} is the one now used throughout analyses, but it is
called #plt{}.
When writing the PLT to file, another record is used, #file_plt{} (as
before). When creating #file_plt{}, the #plt{} is deleted (it cannot
be used for further analyses).
Diffstat (limited to 'lib/dialyzer/src/dialyzer_utils.erl')
-rw-r--r-- | lib/dialyzer/src/dialyzer_utils.erl | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/dialyzer/src/dialyzer_utils.erl b/lib/dialyzer/src/dialyzer_utils.erl index 0dbb2bcf0a..511a6d66bf 100644 --- a/lib/dialyzer/src/dialyzer_utils.erl +++ b/lib/dialyzer/src/dialyzer_utils.erl @@ -40,6 +40,7 @@ src_compiler_opts/0, refold_pattern/1, ets_tab2list/1, + ets_move/2, parallelism/0, family/1 ]). @@ -998,18 +999,26 @@ label(Tree) -> %% ets:tab2list(T), ets:delete(T) %% to save some memory at the expense of somewhat longer execution time. ets_tab2list(T) -> - tab2list(ets:first(T), T, []). + F = fun(Vs, A) -> Vs ++ A end, + ets_take(ets:first(T), T, F, []). -tab2list('$end_of_table', T, A) -> +-spec ets_move(From :: ets:tid(), To :: ets:tid()) -> 'ok'. + +ets_move(T1, T2) -> + F = fun(Es, A) -> true = ets:insert(T2, Es), A end, + [] = ets_take(ets:first(T1), T1, F, []), + ok. + +ets_take('$end_of_table', T, F, A) -> case ets:first(T) of % no safe_fixtable()... '$end_of_table' -> A; - Key -> tab2list(Key, T, A) + Key -> ets_take(Key, T, F, A) end; -tab2list(Key, T, A) -> +ets_take(Key, T, F, A) -> Vs = ets:lookup(T, Key), Key1 = ets:next(T, Key), - ets:delete(T, Key), - tab2list(Key1, T, Vs ++ A). + true = ets:delete(T, Key), + ets_take(Key1, T, F, F(Vs, A)). -spec parallelism() -> integer(). |