aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src/init.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-08-16 15:51:01 +0200
committerSverker Eriksson <[email protected]>2012-08-21 19:24:46 +0200
commit439fe7b93743528782fbe1ff00dc65d08cb25a56 (patch)
tree66dd430694a1eeb56efac101c904452d3b1f9b02 /erts/preloaded/src/init.erl
parent77d6845c94e75b6da1f7f995e39a6ce455e86de6 (diff)
downloadotp-439fe7b93743528782fbe1ff00dc65d08cb25a56.tar.gz
otp-439fe7b93743528782fbe1ff00dc65d08cb25a56.tar.bz2
otp-439fe7b93743528782fbe1ff00dc65d08cb25a56.zip
Fix init:restart with hipelibs
This is a workaround for init:restart. The root problem is that delete/purge_module does not clean up internal hipe bookkeeping (hipe_mfa_info's) properly. Symptom: Execution of deallocated beam code.
Diffstat (limited to 'erts/preloaded/src/init.erl')
-rw-r--r--erts/preloaded/src/init.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/erts/preloaded/src/init.erl b/erts/preloaded/src/init.erl
index 708991e261..185b62a899 100644
--- a/erts/preloaded/src/init.erl
+++ b/erts/preloaded/src/init.erl
@@ -635,8 +635,16 @@ do_unload([M|Mods]) ->
catch erlang:purge_module(M),
do_unload(Mods);
do_unload([]) ->
+ purge_all_hipe_refs(),
ok.
+purge_all_hipe_refs() ->
+ case erlang:system_info(hipe_architecture) of
+ undefined -> ok;
+ _ -> hipe_bifs:remove_refs_from(all)
+ end.
+
+
sub([H|T],L) -> sub(T,del(H,L));
sub([],L) -> L.