From 7d6a8045152c1a1a3721d76583701a15a5fb5ada Mon Sep 17 00:00:00 2001 From: Paul Guyot Date: Sun, 11 Jul 2010 19:24:04 +0200 Subject: 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. --- lib/hipe/main/hipe.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/hipe/main/hipe.erl') 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 -- cgit v1.2.3