aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/code.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2010-07-29 12:08:01 +0200
committerBjörn Gustavsson <[email protected]>2010-07-29 12:15:38 +0200
commitfe1da36ded1ad4ece269d565ed8b389b7c553f57 (patch)
treeb3f3fac71330730e916a7e2f50c72e4cf05cf696 /lib/kernel/src/code.erl
parent1d484d1c96dd5111c45e656d20b58f1ae5c24f59 (diff)
parenta8b8ec5e858da86531933b545f752f436e411b58 (diff)
downloadotp-fe1da36ded1ad4ece269d565ed8b389b7c553f57.tar.gz
otp-fe1da36ded1ad4ece269d565ed8b389b7c553f57.tar.bz2
otp-fe1da36ded1ad4ece269d565ed8b389b7c553f57.zip
Merge branch 'pg/load-native-code-for-early-modules' into dev
OTP-8750
Diffstat (limited to 'lib/kernel/src/code.erl')
-rw-r--r--lib/kernel/src/code.erl18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/kernel/src/code.erl b/lib/kernel/src/code.erl
index 42d4818f08..ec256d5806 100644
--- a/lib/kernel/src/code.erl
+++ b/lib/kernel/src/code.erl
@@ -304,6 +304,8 @@ do_start(Flags) ->
true ->
ok
end,
+ % Quietly load the native code for all modules loaded so far.
+ catch load_native_code_for_all_loaded(),
Ok2;
Other ->
Other
@@ -496,3 +498,19 @@ has_ext(Ext, Extlen,File) ->
to_path(X) ->
filename:join(packages:split(X)).
+
+-spec load_native_code_for_all_loaded() -> ok.
+load_native_code_for_all_loaded() ->
+ Architecture = erlang:system_info(hipe_architecture),
+ ChunkName = hipe_unified_loader:chunk_name(Architecture),
+ lists:foreach(fun({Module, BeamFilename}) ->
+ case code:is_module_native(Module) of
+ false ->
+ case beam_lib:chunks(BeamFilename, [ChunkName]) of
+ {ok,{_,[{_,Bin}]}} when is_binary(Bin) ->
+ load_native_partial(Module, Bin);
+ {error, beam_lib, _} -> ok
+ end;
+ true -> ok
+ end
+ end, all_loaded()).