Skip to content

Commit

Permalink
dialyzer: Fix system_limit exception in race analysis
Browse files Browse the repository at this point in the history
dialyzer_callgraph:
  Avoid creation of too many ets tables by the race analysis.
dialyzer_dataflow:
  The digraph returned by the race analysis should not be the
  translated one.
  • Loading branch information
kostis authored and bjorng committed Feb 16, 2010
1 parent 8b7dd06 commit abe48c2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
29 changes: 18 additions & 11 deletions lib/dialyzer/src/dialyzer_callgraph.erl
Expand Up @@ -55,8 +55,8 @@

-export([cleanup/1, get_digraph/1, get_named_tables/1, get_public_tables/1,
get_race_code/1, get_race_detection/1, race_code_new/1,
put_race_code/2, put_race_detection/2, put_named_tables/2,
put_public_tables/2, put_behaviour_api_calls/2,
put_digraph/2, put_race_code/2, put_race_detection/2,
put_named_tables/2, put_public_tables/2, put_behaviour_api_calls/2,
get_behaviour_api_calls/1]).

-include("dialyzer.hrl").
Expand Down Expand Up @@ -611,15 +611,17 @@ digraph_reaching_subgraph(Funs, DG) ->

-spec cleanup(callgraph()) -> callgraph().

cleanup(#callgraph{name_map = NameMap,
rev_name_map = RevNameMap,
public_tables = PublicTables,
named_tables = NamedTables,
race_code = RaceCode}) ->
#callgraph{name_map = NameMap,
rev_name_map = RevNameMap,
public_tables = PublicTables,
named_tables = NamedTables,
cleanup(#callgraph{digraph = Digraph,
name_map = NameMap,
rev_name_map = RevNameMap,
public_tables = PublicTables,
named_tables = NamedTables,
race_code = RaceCode}) ->
#callgraph{digraph = Digraph,
name_map = NameMap,
rev_name_map = RevNameMap,
public_tables = PublicTables,
named_tables = NamedTables,
race_code = RaceCode}.

-spec get_digraph(callgraph()) -> digraph().
Expand Down Expand Up @@ -652,6 +654,11 @@ get_race_detection(#callgraph{race_detection = RD}) ->
race_code_new(Callgraph) ->
Callgraph#callgraph{race_code = dict:new()}.

-spec put_digraph(digraph(), callgraph()) -> callgraph().

put_digraph(Digraph, Callgraph) ->
Callgraph#callgraph{digraph = Digraph}.

-spec put_race_code(dict(), callgraph()) -> callgraph().

put_race_code(RaceCode, Callgraph) ->
Expand Down
10 changes: 8 additions & 2 deletions lib/dialyzer/src/dialyzer_dataflow.erl
Expand Up @@ -291,10 +291,16 @@ analyze_module(Tree, Plt, Callgraph, Records, GetWarnings) ->
case BehaviourTranslations of
[] -> dialyzer_races:race(State5);
Behaviours ->
Callgraph2 = State5#state.callgraph,
Digraph = dialyzer_callgraph:get_digraph(Callgraph2),
TranslatedCallgraph =
dialyzer_behaviours:translate_callgraph(Behaviours, Module,
State5#state.callgraph),
dialyzer_races:race(State5#state{callgraph = TranslatedCallgraph})
Callgraph2),
St =
dialyzer_races:race(State5#state{callgraph = TranslatedCallgraph}),
Callgraph3 = dialyzer_callgraph:put_digraph(Digraph,
St#state.callgraph),
St#state{callgraph = Callgraph3}
end;
false ->
state__restore_race_code(
Expand Down

0 comments on commit abe48c2

Please sign in to comment.