diff options
author | Björn Gustavsson <[email protected]> | 2011-11-28 14:57:33 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2011-11-28 14:57:33 +0100 |
commit | b9ee5572792142332b976a1cb3205dcaf3cbaf88 (patch) | |
tree | b6a2ba900f978a73762f7cb5195ee63979659213 /lib | |
parent | 1d5104db02033144ec42fbf38becf496215cf39f (diff) | |
parent | 541c5040ceb8822b423f4362d7a8efad7d70a4e2 (diff) | |
download | otp-b9ee5572792142332b976a1cb3205dcaf3cbaf88.tar.gz otp-b9ee5572792142332b976a1cb3205dcaf3cbaf88.tar.bz2 otp-b9ee5572792142332b976a1cb3205dcaf3cbaf88.zip |
Merge branch 'bjorn/code-loading'
* bjorn/code-loading:
code: Clean up loading of code_server prerequisites
beam_load.c: Add init_iff_file() for verifying the IFF header
beam_code.c: Don't reinvent state initialization and deallocation
beam_load.c: Optimize code:get_chunk/2
beam_load.c: Eliminate memory leak in code:make_stub_module/3
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kernel/src/code.erl | 29 | ||||
-rw-r--r-- | lib/kernel/src/hipe_unified_loader.erl | 11 |
2 files changed, 20 insertions, 20 deletions
diff --git a/lib/kernel/src/code.erl b/lib/kernel/src/code.erl index 882e9625fe..b7fda69ce0 100644 --- a/lib/kernel/src/code.erl +++ b/lib/kernel/src/code.erl @@ -324,15 +324,7 @@ start_link(Flags) -> %%----------------------------------------------------------------- do_start(Flags) -> - %% The following module_info/1 calls are here to ensure - %% that these modules are loaded prior to their use elsewhere in - %% the code_server. - %% Otherwise a deadlock may occur when the code_server is starting. - code_server = code_server:module_info(module), - packages = packages:module_info(module), - catch hipe_unified_loader:load_hipe_modules(), - Modules2 = [gb_sets, gb_trees, ets, os, binary, unicode, filename, lists], - lists:foreach(fun (M) -> M = M:module_info(module) end, Modules2), + load_code_server_prerequisites(), Mode = get_mode(Flags), case init:get_argument(root) of @@ -360,6 +352,25 @@ do_start(Flags) -> {error, crash} end. +%% Make sure that all modules that the code_server process calls +%% (directly or indirectly) are loaded. Otherwise the code_server +%% process will deadlock. + +load_code_server_prerequisites() -> + %% Please keep the alphabetical order. + Needed = [binary, + ets, + filename, + gb_sets, + gb_trees, + hipe_unified_loader, + lists, + os, + packages, + unicode], + [M = M:module_info(module) || M <- Needed], + ok. + do_stick_dirs() -> do_s(compiler), do_s(stdlib), diff --git a/lib/kernel/src/hipe_unified_loader.erl b/lib/kernel/src/hipe_unified_loader.erl index 1d3eb926ca..8b3aa0286d 100644 --- a/lib/kernel/src/hipe_unified_loader.erl +++ b/lib/kernel/src/hipe_unified_loader.erl @@ -36,7 +36,6 @@ -export([chunk_name/1, %% Only the code and code_server modules may call the entries below! - load_hipe_modules/0, load_native_code/2, post_beam_load/1, load_module/3, @@ -78,16 +77,6 @@ chunk_name(Architecture) -> %%======================================================================== --spec load_hipe_modules() -> 'ok'. -%% @doc -%% Ensures HiPE's loader modules are loaded. -%% Called from code.erl at start-up. - -load_hipe_modules() -> - ok. - -%%======================================================================== - -spec load_native_code(Mod, binary()) -> 'no_native' | {'module', Mod} when is_subtype(Mod, atom()). %% @doc |