diff options
author | Björn Gustavsson <[email protected]> | 2011-09-09 12:09:29 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2011-11-24 15:17:51 +0100 |
commit | 02c4d9a4a08ebb511833539e3937593fb956a6c9 (patch) | |
tree | e41815cc22093594c70d4df74c8e37f4cdf8d1cc /lib/compiler/src | |
parent | 70e44417259e47cc1b170f8c6758771c626ddc6b (diff) | |
download | otp-02c4d9a4a08ebb511833539e3937593fb956a6c9.tar.gz otp-02c4d9a4a08ebb511833539e3937593fb956a6c9.tar.bz2 otp-02c4d9a4a08ebb511833539e3937593fb956a6c9.zip |
compiler: Don't include {cwd,_} in module_info(compile)
The {cwd,Dir} option is always included if the module has been
compiled by erlc. Since its presence cannot be relied upon and it
wastes memory, get rid of it.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/compile.erl | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl index e737ead023..1d07672d81 100644 --- a/lib/compiler/src/compile.erl +++ b/lib/compiler/src/compile.erl @@ -1236,7 +1236,7 @@ beam_asm(#compile{ifile=File,code=Code0, Opts1 = lists:map(fun({debug_info_key,_}) -> {debug_info_key,'********'}; (Other) -> Other end, Opts0), - Opts2 = [O || O <- Opts1, is_informative_option(O)], + Opts2 = [O || O <- Opts1, effects_code_generation(O)], case beam_asm:module(Code0, Abst, Source, Opts2) of {ok,Code} -> {ok,St#compile{code=Code,abstract_code=[]}} end. @@ -1306,15 +1306,23 @@ embed_native_code(St, {Architecture,NativeCode}) -> {ok, BeamPlusNative} = beam_lib:build_module(Chunks), St#compile{code=BeamPlusNative}. -%% Returns true if the option is informative and therefore should be included -%% in the option list of the compiled module. - -is_informative_option(beam) -> false; -is_informative_option(report_warnings) -> false; -is_informative_option(report_errors) -> false; -is_informative_option(binary) -> false; -is_informative_option(verbose) -> false; -is_informative_option(_) -> true. +%% effects_code_generation(Option) -> true|false. +%% Determine whether the option could have any effect on the +%% generated code in the BEAM file (as opposed to how +%% errors will be reported). + +effects_code_generation(Option) -> + case Option of + beam -> false; + report_warnings -> false; + report_errors -> false; + return_errors-> false; + return_warnings-> false; + binary -> false; + verbose -> false; + {cwd,_} -> false; + _ -> true + end. save_binary(#compile{code=none}=St) -> {ok,St}; save_binary(#compile{module=Mod,ofile=Outfile, |