aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-10-20 15:57:45 +0200
committerSverker Eriksson <[email protected]>2016-10-20 15:57:45 +0200
commit616a4c1d925192b3559ddcad6fcda329ad706dab (patch)
tree8dc4cb2947a95c65ca641d097372ee82a28a2c13
parent4b6071c7454de80efaa27b92397a1467a2ddeddb (diff)
parenta79e2569f5a6d6a622bd78b04326a6ad976c0a4c (diff)
downloadotp-616a4c1d925192b3559ddcad6fcda329ad706dab.tar.gz
otp-616a4c1d925192b3559ddcad6fcda329ad706dab.tar.bz2
otp-616a4c1d925192b3559ddcad6fcda329ad706dab.zip
Merge branch 'kostis/hipe_bifs-add_ref/PR-1205'
-rw-r--r--erts/emulator/hipe/hipe_bif0.c2
-rw-r--r--lib/hipe/cerl/erl_bif_types.erl2
-rw-r--r--lib/kernel/src/hipe_unified_loader.erl32
3 files changed, 17 insertions, 19 deletions
diff --git a/erts/emulator/hipe/hipe_bif0.c b/erts/emulator/hipe/hipe_bif0.c
index 453a452590..57fbbd9403 100644
--- a/erts/emulator/hipe/hipe_bif0.c
+++ b/erts/emulator/hipe/hipe_bif0.c
@@ -1582,7 +1582,7 @@ BIF_RETTYPE hipe_bifs_add_ref_2(BIF_ALIST_2)
ref, callee.mod, callee.fun, callee.ari, ref->address);
DBG_TRACE_MFA(callee.mod, callee.fun, callee.ari, "add_ref at %p FROM %T:%T/%u (from %p)",
ref, caller.mod, caller.fun, caller.ari, ref->address);
- BIF_RET(NIL);
+ BIF_RET(am_ok);
badarg:
BIF_ERROR(BIF_P, BADARG);
diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl
index ae9650ba7d..9344eb33fe 100644
--- a/lib/hipe/cerl/erl_bif_types.erl
+++ b/lib/hipe/cerl/erl_bif_types.erl
@@ -1003,7 +1003,7 @@ type(erlang, tuple_to_list, 1, Xs, Opaques) ->
end, Opaques);
%%-- hipe_bifs ----------------------------------------------------------------
type(hipe_bifs, add_ref, 2, Xs, Opaques) ->
- strict(hipe_bifs, add_ref, 2, Xs, fun (_) -> t_nil() end, Opaques);
+ strict(hipe_bifs, add_ref, 2, Xs, fun (_) -> t_atom('ok') end, Opaques);
type(hipe_bifs, alloc_data, 3, Xs, Opaques) ->
strict(hipe_bifs, alloc_data, 3, Xs,
fun (_) -> t_integer() end, Opaques); % address
diff --git a/lib/kernel/src/hipe_unified_loader.erl b/lib/kernel/src/hipe_unified_loader.erl
index a7e30a048f..04ec1479cb 100644
--- a/lib/kernel/src/hipe_unified_loader.erl
+++ b/lib/kernel/src/hipe_unified_loader.erl
@@ -772,27 +772,27 @@ find_const(ConstNo, []) ->
add_ref(CalleeMFA, Address, FunDefs, RefType, Trampoline, RemoteOrLocal) ->
CallerMFA = address_to_mfa_lth(Address, FunDefs),
- _ = case RemoteOrLocal of
+ case RemoteOrLocal of
local ->
- %% just a sanity assertion
+ %% assert that the callee and caller are from the same module
{M,_,_} = CalleeMFA,
- {M,_,_} = CallerMFA;
+ {M,_,_} = CallerMFA,
+ ok;
remote ->
hipe_bifs:add_ref(CalleeMFA, {CallerMFA,Address,RefType,Trampoline,
get(hipe_loader_state)})
- end,
- ok.
+ end.
-% For FunDefs sorted from low to high addresses
+%% For FunDefs sorted from low to high addresses
address_to_mfa_lth(Address, FunDefs) ->
- case address_to_mfa_lth(Address, FunDefs, false) of
- false ->
- ?error_msg("Local adddress not found ~w\n",[Address]),
- exit({?MODULE, local_address_not_found});
- MFA ->
- MFA
- end.
-
+ case address_to_mfa_lth(Address, FunDefs, false) of
+ false ->
+ ?error_msg("Local adddress not found ~w\n",[Address]),
+ exit({?MODULE, local_address_not_found});
+ MFA ->
+ MFA
+ end.
+
address_to_mfa_lth(Address, [#fundef{address=Adr, mfa=MFA}|Rest], Prev) ->
if Address < Adr ->
Prev;
@@ -802,7 +802,7 @@ address_to_mfa_lth(Address, [#fundef{address=Adr, mfa=MFA}|Rest], Prev) ->
address_to_mfa_lth(_Address, [], Prev) ->
Prev.
-% For FunDefs sorted from high to low addresses
+%% For FunDefs sorted from high to low addresses
%% address_to_mfa_htl(Address, [#fundef{address=Adr, mfa=MFA}|_Rest]) when Address >= Adr -> MFA;
%% address_to_mfa_htl(Address, [_ | Rest]) -> address_to_mfa_htl(Address, Rest);
%% address_to_mfa_htl(Address, []) ->
@@ -868,8 +868,6 @@ assert_local_patch(Address) when is_integer(Address) ->
%% ____________________________________________________________________
%%
-%% Beam: nil() | binary() (used as a flag)
-
enter_code(CodeSize, CodeBinary, CalleeMFAs, LoaderState) ->
true = byte_size(CodeBinary) =:= CodeSize,
{CodeAddress,Trampolines} = hipe_bifs:enter_code(CodeBinary, CalleeMFAs,