diff options
author | Erlang/OTP <[email protected]> | 2010-02-10 09:11:31 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-02-10 10:14:39 +0100 |
commit | 3241e0ad7b6c85372b1c7577a760c8695e648e85 (patch) | |
tree | 6740a2cbc79559db8a2c03c9bc94e46d2dcecf97 /lib/kernel/src/hipe_unified_loader.erl | |
parent | a32352f3e450dcf13ff6a191ae73327f5f93d41b (diff) | |
parent | 4a158f3110809b6edb393b3f0b558199f8c133d8 (diff) | |
download | otp-3241e0ad7b6c85372b1c7577a760c8695e648e85.tar.gz otp-3241e0ad7b6c85372b1c7577a760c8695e648e85.tar.bz2 otp-3241e0ad7b6c85372b1c7577a760c8695e648e85.zip |
Merge branch 'mp/hipe_unified_loader' into ccase/r13b04_dev
* mp/hipe_unified_loader:
hipe_unified_loader: only block SMP scheduling when necessary
Diffstat (limited to 'lib/kernel/src/hipe_unified_loader.erl')
-rw-r--r-- | lib/kernel/src/hipe_unified_loader.erl | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/lib/kernel/src/hipe_unified_loader.erl b/lib/kernel/src/hipe_unified_loader.erl index 42eab67478..f289b8110d 100644 --- a/lib/kernel/src/hipe_unified_loader.erl +++ b/lib/kernel/src/hipe_unified_loader.erl @@ -96,14 +96,6 @@ load_hipe_modules() -> %% code:load_file/1) and the atom `no_native' on failure. load_native_code(Mod, Bin) when is_atom(Mod), is_binary(Bin) -> - erlang:system_flag(multi_scheduling, block), - try - load_native_code_nosmp(Mod, Bin) - after - erlang:system_flag(multi_scheduling, unblock) - end. - -load_native_code_nosmp(Mod, Bin) -> Architecture = erlang:system_info(hipe_architecture), try chunk_name(Architecture) of ChunkTag -> @@ -111,10 +103,15 @@ load_native_code_nosmp(Mod, Bin) -> case code:get_chunk(Bin, ChunkTag) of undefined -> no_native; NativeCode when is_binary(NativeCode) -> - OldReferencesToPatch = patch_to_emu_step1(Mod), - case load_module(Mod, NativeCode, Bin, OldReferencesToPatch) of - bad_crc -> no_native; - Result -> Result + erlang:system_flag(multi_scheduling, block), + try + OldReferencesToPatch = patch_to_emu_step1(Mod), + case load_module(Mod, NativeCode, Bin, OldReferencesToPatch) of + bad_crc -> no_native; + Result -> Result + end + after + erlang:system_flag(multi_scheduling, unblock) end end catch @@ -128,17 +125,18 @@ load_native_code_nosmp(Mod, Bin) -> -spec post_beam_load(atom()) -> 'ok'. post_beam_load(Mod) when is_atom(Mod) -> - erlang:system_flag(multi_scheduling, block), - try - post_beam_load_nosmp(Mod) - after - erlang:system_flag(multi_scheduling, unblock) - end. - -post_beam_load_nosmp(Mod) -> Architecture = erlang:system_info(hipe_architecture), - try chunk_name(Architecture) of _ChunkTag -> patch_to_emu(Mod) - catch _:_ -> ok + try chunk_name(Architecture) of + _ChunkTag -> + erlang:system_flag(multi_scheduling, block), + try + patch_to_emu(Mod) + after + erlang:system_flag(multi_scheduling, unblock) + end + catch + _:_ -> + ok end. %%======================================================================== |