aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded
diff options
context:
space:
mode:
Diffstat (limited to 'erts/preloaded')
-rw-r--r--erts/preloaded/ebin/erlang.beambin102216 -> 102556 bytes
-rw-r--r--erts/preloaded/ebin/erts_code_purger.beambin9020 -> 8992 bytes
-rw-r--r--erts/preloaded/ebin/erts_internal.beambin6260 -> 6432 bytes
-rw-r--r--erts/preloaded/ebin/init.beambin44700 -> 44728 bytes
-rw-r--r--erts/preloaded/src/erlang.erl12
-rw-r--r--erts/preloaded/src/erts_code_purger.erl14
-rw-r--r--erts/preloaded/src/erts_internal.erl6
-rw-r--r--erts/preloaded/src/init.erl4
8 files changed, 21 insertions, 15 deletions
diff --git a/erts/preloaded/ebin/erlang.beam b/erts/preloaded/ebin/erlang.beam
index 68578c3a49..4353e115ca 100644
--- a/erts/preloaded/ebin/erlang.beam
+++ b/erts/preloaded/ebin/erlang.beam
Binary files differ
diff --git a/erts/preloaded/ebin/erts_code_purger.beam b/erts/preloaded/ebin/erts_code_purger.beam
index adfe298a44..553b34b105 100644
--- a/erts/preloaded/ebin/erts_code_purger.beam
+++ b/erts/preloaded/ebin/erts_code_purger.beam
Binary files differ
diff --git a/erts/preloaded/ebin/erts_internal.beam b/erts/preloaded/ebin/erts_internal.beam
index 4e1cb7f8a0..150e76505d 100644
--- a/erts/preloaded/ebin/erts_internal.beam
+++ b/erts/preloaded/ebin/erts_internal.beam
Binary files differ
diff --git a/erts/preloaded/ebin/init.beam b/erts/preloaded/ebin/init.beam
index a44b022931..b6d1df7bbc 100644
--- a/erts/preloaded/ebin/init.beam
+++ b/erts/preloaded/ebin/init.beam
Binary files differ
diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl
index d9dc9a1976..ab54d716cc 100644
--- a/erts/preloaded/src/erlang.erl
+++ b/erts/preloaded/src/erlang.erl
@@ -1471,8 +1471,16 @@ processes() ->
%% purge_module/1
-spec purge_module(Module) -> true when
Module :: atom().
-purge_module(_Module) ->
- erlang:nif_error(undefined).
+purge_module(Module) when erlang:is_atom(Module) ->
+ case erts_code_purger:purge(Module) of
+ {false, _} ->
+ erlang:error(badarg, [Module]);
+ {true, _} ->
+ true
+ end;
+purge_module(Arg) ->
+ erlang:error(badarg, [Arg]).
+
%% put/2
-spec put(Key, Val) -> term() when
diff --git a/erts/preloaded/src/erts_code_purger.erl b/erts/preloaded/src/erts_code_purger.erl
index 6bb6e4fcdc..880c86aad1 100644
--- a/erts/preloaded/src/erts_code_purger.erl
+++ b/erts/preloaded/src/erts_code_purger.erl
@@ -70,12 +70,8 @@ do_purge(Mod) ->
true = erlang:copy_literals(Mod, true),
DidKill = check_proc_code(erlang:processes(), Mod, true),
true = erlang:copy_literals(Mod, false),
- try
- erlang:purge_module(Mod)
- catch
- _:_ -> ignore
- end,
- {true, DidKill}
+ WasPurged = erts_internal:purge_module(Mod),
+ {WasPurged, DidKill}
end.
%% soft_purge(Module)
@@ -104,11 +100,7 @@ do_soft_purge(Mod) ->
false;
true ->
true = erlang:copy_literals(Mod, false),
- try
- erlang:purge_module(Mod)
- catch
- _:_ -> ignore
- end,
+ erts_internal:purge_module(Mod),
true
end
end.
diff --git a/erts/preloaded/src/erts_internal.erl b/erts/preloaded/src/erts_internal.erl
index 426749264f..6e649e8395 100644
--- a/erts/preloaded/src/erts_internal.erl
+++ b/erts/preloaded/src/erts_internal.erl
@@ -38,6 +38,7 @@
-export([request_system_task/3]).
-export([check_process_code/2]).
+-export([purge_module/1]).
-export([flush_monitor_messages/3]).
@@ -204,6 +205,11 @@ request_system_task(_Pid, _Prio, _Request) ->
check_process_code(_Module, _OptionList) ->
erlang:nif_error(undefined).
+-spec purge_module(Module) -> boolean() when
+ Module :: module().
+purge_module(_Module) ->
+ erlang:nif_error(undefined).
+
%% term compare where integer() < float() = true
-spec cmp_term(A,B) -> Result when
diff --git a/erts/preloaded/src/init.erl b/erts/preloaded/src/init.erl
index 383c4a1ec6..ed65c57c0d 100644
--- a/erts/preloaded/src/init.erl
+++ b/erts/preloaded/src/init.erl
@@ -636,9 +636,9 @@ unload(_) ->
do_unload(sub([heart|erlang:pre_loaded()],erlang:loaded())).
do_unload([M|Mods]) ->
- catch erlang:purge_module(M),
+ catch erts_internal:purge_module(M),
catch erlang:delete_module(M),
- catch erlang:purge_module(M),
+ catch erts_internal:purge_module(M),
do_unload(Mods);
do_unload([]) ->
purge_all_hipe_refs(),