aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-01-20 13:04:31 +0100
committerHans Bolinder <[email protected]>2017-02-03 08:58:01 +0100
commit7e0a7a58eb3557bd0d5d372a3793119a5e9ffe61 (patch)
tree48a5ba02fc5c3bbe0da1ffe49a9d9c724cffb9f9
parentda2a7ff4d340db6d139c3c6abdcfa978dcadb4c2 (diff)
downloadotp-7e0a7a58eb3557bd0d5d372a3793119a5e9ffe61.tar.gz
otp-7e0a7a58eb3557bd0d5d372a3793119a5e9ffe61.tar.bz2
otp-7e0a7a58eb3557bd0d5d372a3793119a5e9ffe61.zip
dialyzer: Remove code for non-started workers
Since SCCs and modules are now topologically sorted (relative the active graph), we can safely assume that workers have been started.
-rw-r--r--lib/dialyzer/src/dialyzer_coordinator.erl14
-rw-r--r--lib/dialyzer/src/dialyzer_worker.erl15
2 files changed, 8 insertions, 21 deletions
diff --git a/lib/dialyzer/src/dialyzer_coordinator.erl b/lib/dialyzer/src/dialyzer_coordinator.erl
index 99f95a4dca..de239f5c93 100644
--- a/lib/dialyzer/src/dialyzer_coordinator.erl
+++ b/lib/dialyzer/src/dialyzer_coordinator.erl
@@ -170,18 +170,16 @@ update_result(Mode, InitData, Job, Data, Result) ->
end.
-spec sccs_to_pids([scc() | module()], coordinator()) ->
- {[dialyzer_worker:worker()], [scc() | module()]}.
+ [dialyzer_worker:worker()].
sccs_to_pids(SCCs, {_Collector, _Regulator, SCCtoPID}) ->
Fold =
- fun(SCC, {Pids, Unknown}) ->
- try ets:lookup_element(SCCtoPID, SCC, 2) of
- Result -> {[Result|Pids], Unknown}
- catch
- _:_ -> {Pids, [SCC|Unknown]}
- end
+ fun(SCC, Pids) ->
+ %% The SCCs that SCC depends on have always been started.
+ Result = ets:lookup_element(SCCtoPID, SCC, 2),
+ [Result|Pids]
end,
- lists:foldl(Fold, {[], []}, SCCs).
+ lists:foldl(Fold, [], SCCs).
-spec job_done(job(), job_result(), coordinator()) -> ok.
diff --git a/lib/dialyzer/src/dialyzer_worker.erl b/lib/dialyzer/src/dialyzer_worker.erl
index 418c9798b3..1a251b5307 100644
--- a/lib/dialyzer/src/dialyzer_worker.erl
+++ b/lib/dialyzer/src/dialyzer_worker.erl
@@ -110,25 +110,14 @@ waits_more_success_typings(#state{depends_on = Depends}) ->
broadcast_done(#state{job = SCC, init_data = InitData,
coordinator = Coordinator}) ->
RequiredBy = dialyzer_succ_typings:find_required_by(SCC, InitData),
- {Callers, Unknown} =
- dialyzer_coordinator:sccs_to_pids(RequiredBy, Coordinator),
- send_done(Callers, SCC),
- continue_broadcast_done(Unknown, SCC, Coordinator).
+ Callers = dialyzer_coordinator:sccs_to_pids(RequiredBy, Coordinator),
+ send_done(Callers, SCC).
send_done(Callers, SCC) ->
?debug("Sending ~p: ~p\n",[SCC, Callers]),
SendSTFun = fun(PID) -> PID ! {done, SCC} end,
lists:foreach(SendSTFun, Callers).
-continue_broadcast_done([], _SCC, _Coordinator) -> ok;
-continue_broadcast_done(Rest, SCC, Coordinator) ->
- %% This time limit should be greater than the time required
- %% by the coordinator to spawn all processes.
- timer:sleep(500),
- {Callers, Unknown} = dialyzer_coordinator:sccs_to_pids(Rest, Coordinator),
- send_done(Callers, SCC),
- continue_broadcast_done(Unknown, SCC, Coordinator).
-
wait_for_success_typings(#state{depends_on = DependsOn} = State) ->
receive
{done, SCC} ->