aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-01-20 10:29:26 +0100
committerBjörn Gustavsson <[email protected]>2016-03-17 10:20:00 +0100
commit46aed30f8afbddd31f82e9b7a50a536a295f5eaa (patch)
tree4e449571a5d2fafeacdaa1809ab28dcf2d4c8b69 /lib/compiler/src
parent28f3bae60a4edb9432c29469f6a3c031e0859104 (diff)
downloadotp-46aed30f8afbddd31f82e9b7a50a536a295f5eaa.tar.gz
otp-46aed30f8afbddd31f82e9b7a50a536a295f5eaa.tar.bz2
otp-46aed30f8afbddd31f82e9b7a50a536a295f5eaa.zip
compile: Pre-load compiler modules when invoked from 'erlc'
Slightly speed up 'erlc' by pre-loading the modules used by the compiler. Write a test case to ensure that the correct set of modules are loaded.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/compile.erl44
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 46917905de..332bc0bdf9 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -1681,6 +1681,7 @@ help(_) ->
%% Compile entry point for erl_compile.
compile(File0, _OutFile, Options) ->
+ pre_load(),
File = shorten_filename(File0),
case file(File, make_erl_options(Options)) of
{ok,_Mod} -> ok;
@@ -1745,3 +1746,46 @@ make_erl_options(Opts) ->
end,
Options ++ [report_errors, {cwd, Cwd}, {outdir, Outdir}|
[{i, Dir} || Dir <- Includes]] ++ Specific.
+
+pre_load() ->
+ L = [beam_a,
+ beam_asm,
+ beam_block,
+ beam_bool,
+ beam_bs,
+ beam_bsm,
+ beam_clean,
+ beam_dead,
+ beam_dict,
+ beam_except,
+ beam_flatten,
+ beam_jump,
+ beam_opcodes,
+ beam_peep,
+ beam_receive,
+ beam_reorder,
+ beam_split,
+ beam_trim,
+ beam_type,
+ beam_utils,
+ beam_validator,
+ beam_z,
+ cerl,
+ cerl_clauses,
+ cerl_sets,
+ cerl_trees,
+ core_lib,
+ epp,
+ erl_bifs,
+ erl_expand_records,
+ erl_lint,
+ erl_parse,
+ erl_scan,
+ sys_core_dsetel,
+ sys_core_fold,
+ sys_pre_expand,
+ v3_codegen,
+ v3_core,
+ v3_kernel,
+ v3_life],
+ code:ensure_modules_loaded(L).