aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/compile.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-01-12 11:44:39 +0100
committerHans Bolinder <[email protected]>2017-01-12 11:44:39 +0100
commit568e6b5faebf85fb35119858fcb4824f46a4266c (patch)
tree7bfb4c71f0a470815ab54722f41b573899ab80ff /lib/compiler/src/compile.erl
parentad8229b57c8dcd8ff129398b53e3b81849daecc7 (diff)
parent7cbac17f33c6f3dc2d8a0224eec8d378f00c560f (diff)
downloadotp-568e6b5faebf85fb35119858fcb4824f46a4266c.tar.gz
otp-568e6b5faebf85fb35119858fcb4824f46a4266c.tar.bz2
otp-568e6b5faebf85fb35119858fcb4824f46a4266c.zip
Merge branch 'hasse/dialyzer/memory_opt/OTP-14126' into maint
* hasse/dialyzer/memory_opt/OTP-14126: dialyzer: Compact 'file' annotations in Core code dialyzer: Try to reduce memory usage dialyzer: Use less memory when translating contracts dialyzer: Use maps instaed of dict dialyzer: Use maps instead of dict for module contracts map dialyzer: Compress a few more ETS tables dialyzer: Optimize memory consumption dialyzer: Reduce memory consumption during 'remote' phase dialyzer: Update code for finding parallelism compiler: Do not spawn process when dialyzing dialyzer: Reduce ETS usage during the typesig phase dialyzer: Optimize graph condensation dialyzer: Do not send full PLTs as messages
Diffstat (limited to 'lib/compiler/src/compile.erl')
-rw-r--r--lib/compiler/src/compile.erl30
1 files changed, 19 insertions, 11 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 434360d294..e37ca31704 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -173,17 +173,25 @@ env_default_opts() ->
do_compile(Input, Opts0) ->
Opts = expand_opts(Opts0),
- {Pid,Ref} =
- spawn_monitor(fun() ->
- exit(try
- internal(Input, Opts)
- catch
- error:Reason ->
- {error,Reason}
- end)
- end),
- receive
- {'DOWN',Ref,process,Pid,Rep} -> Rep
+ IntFun = fun() -> try
+ internal(Input, Opts)
+ catch
+ error:Reason ->
+ {error,Reason}
+ end
+ end,
+ %% Dialyzer has already spawned workers.
+ case lists:member(dialyzer, Opts) of
+ true ->
+ IntFun();
+ false ->
+ {Pid,Ref} =
+ spawn_monitor(fun() ->
+ exit(IntFun())
+ end),
+ receive
+ {'DOWN',Ref,process,Pid,Rep} -> Rep
+ end
end.
expand_opts(Opts0) ->