aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/src/dialyzer_codeserver.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2016-12-09 16:16:11 +0100
committerHans Bolinder <[email protected]>2017-01-11 09:34:59 +0100
commit7a6ea7e9946e72a03167145c476e66ee77098b6e (patch)
tree173a4689b82de0835073929c414a026cf029de52 /lib/dialyzer/src/dialyzer_codeserver.erl
parent7f3b77274958b62523e83ab2b37ad29ec9a6cf3c (diff)
downloadotp-7a6ea7e9946e72a03167145c476e66ee77098b6e.tar.gz
otp-7a6ea7e9946e72a03167145c476e66ee77098b6e.tar.bz2
otp-7a6ea7e9946e72a03167145c476e66ee77098b6e.zip
dialyzer: Optimize memory consumption
Some SCC info is no longer cached. It reduces the peak memory consumption of workers during the typesig phase, and seems to cost very little time.
Diffstat (limited to 'lib/dialyzer/src/dialyzer_codeserver.erl')
-rw-r--r--lib/dialyzer/src/dialyzer_codeserver.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/dialyzer/src/dialyzer_codeserver.erl b/lib/dialyzer/src/dialyzer_codeserver.erl
index 03cd9671af..5028c4f3ba 100644
--- a/lib/dialyzer/src/dialyzer_codeserver.erl
+++ b/lib/dialyzer/src/dialyzer_codeserver.erl
@@ -48,6 +48,7 @@
is_exported/2,
lookup_mod_code/2,
lookup_mfa_code/2,
+ lookup_mfa_var_label/2,
lookup_mod_records/2,
lookup_mod_contracts/2,
lookup_mfa_contract/2,
@@ -173,8 +174,8 @@ insert(Mod, ModCode, CS) ->
As = cerl:get_ann(ModCode),
Funs =
[{{Mod, cerl:fname_id(Var), cerl:fname_arity(Var)},
- Val} || Val = {Var, _Fun} <- Defs],
- Keys = [Key || {Key, _Value} <- Funs],
+ Val, {Var, cerl_trees:get_label(Fun)}} || Val = {Var, Fun} <- Defs],
+ Keys = [Key || {Key, _Value, _Label} <- Funs],
ModEntry = {Mod, {Name, Exports, Attrs, Keys, As}},
true = ets:insert(CS#codeserver.code, [ModEntry|Funs]),
CS.
@@ -237,6 +238,11 @@ lookup_mod_code(Mod, CS) when is_atom(Mod) ->
lookup_mfa_code({_M, _F, _A} = MFA, CS) ->
table__lookup(CS#codeserver.code, MFA).
+-spec lookup_mfa_var_label(mfa(), codeserver()) -> {cerl:c_var(), label()}.
+
+lookup_mfa_var_label({_M, _F, _A} = MFA, CS) ->
+ ets:lookup_element(CS#codeserver.code, MFA, 3).
+
-spec get_next_core_label(codeserver()) -> label().
get_next_core_label(#codeserver{next_core_label = NCL}) ->