diff options
author | Paul Guyot <[email protected]> | 2010-07-11 19:24:04 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2010-08-27 13:37:15 +0200 |
commit | 7d6a8045152c1a1a3721d76583701a15a5fb5ada (patch) | |
tree | 929354f4671661a818332cd5201eaf094e3d7699 /lib/hipe | |
parent | c4b4edaaf03ac12e12080cb4a3768edbb6ecf77d (diff) | |
download | otp-7d6a8045152c1a1a3721d76583701a15a5fb5ada.tar.gz otp-7d6a8045152c1a1a3721d76583701a15a5fb5ada.tar.bz2 otp-7d6a8045152c1a1a3721d76583701a15a5fb5ada.zip |
Fix hipe:load/1
hipe:load/1 (and unexported hipe:load/2) just did not work. Calling it
would fail with a badmatch because only the hipe chunk was passed to
do_load/3's third parameter called WholeModule. Since this parameter is
then passed to beam_lib:all_chunks/1 which accepts the whole module as a
binary as well as a path to the beam file, and since a path is exactly
what we have in load/2, the fix consists in letting do_load/3 accept a
path and passing it from load/2.
Diffstat (limited to 'lib/hipe')
-rw-r--r-- | lib/hipe/main/hipe.erl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/hipe/main/hipe.erl b/lib/hipe/main/hipe.erl index ed722fecba..c80fb6a0a2 100644 --- a/lib/hipe/main/hipe.erl +++ b/lib/hipe/main/hipe.erl @@ -274,7 +274,7 @@ load(Mod, BeamFileName) when is_list(BeamFileName) -> Architecture = erlang:system_info(hipe_architecture), ChunkName = hipe_unified_loader:chunk_name(Architecture), case beam_lib:chunks(BeamFileName, [ChunkName]) of - {ok,{_,[{_,Bin}]}} when is_binary(Bin) -> do_load(Mod, Bin, Bin); + {ok,{_,[{_,Bin}]}} when is_binary(Bin) -> do_load(Mod, Bin, BeamFileName); Error -> {error, Error} end. @@ -913,7 +913,7 @@ do_load(Mod, Bin, WholeModule) -> %% In this case, the emulated code for the module must be loaded. {module, Mod} = code:ensure_loaded(Mod), code:load_native_partial(Mod, Bin); - BinCode when is_binary(BinCode) -> + BeamBinOrPath when is_binary(BeamBinOrPath) orelse is_list(BeamBinOrPath) -> case code:is_sticky(Mod) of true -> %% We unpack and repack the Beam binary as a workaround to |