File 0475-Remove-dead-code-from-code-module.patch of Package erlang
From 42d869e91450b6e7ccd2d35b2d7b3450e7072790 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Valim?= <jose.valim@dashbit.co>
Date: Wed, 25 Jan 2023 13:54:26 +0100
Subject: [PATCH] Remove dead code from code module
The functions load_native_* do not have a
respective implementation in the code_server,
which means they would always fail. They are
also not documented. We removed their
definitions and further dead from callers.
---
lib/kernel/src/code.erl | 35 +----------------------------------
1 file changed, 1 insertion(+), 34 deletions(-)
diff --git a/lib/kernel/src/code.erl b/lib/kernel/src/code.erl
index acf145d59f..c27cdf2859 100644
--- a/lib/kernel/src/code.erl
+++ b/lib/kernel/src/code.erl
@@ -35,8 +35,6 @@
load_abs/1,
load_abs/2,
load_binary/3,
- load_native_partial/2,
- load_native_sticky/3,
atomic_load/1,
prepare_loading/1,
finish_loading/1,
@@ -218,16 +216,6 @@ load_binary(Mod, File, Bin)
when is_atom(Mod), (is_list(File) orelse is_atom(File)), is_binary(Bin) ->
call({load_binary,Mod,File,Bin}).
--spec load_native_partial(Module :: module(), Binary :: binary()) -> load_ret().
-load_native_partial(Mod, Bin) when is_atom(Mod), is_binary(Bin) ->
- call({load_native_partial,Mod,Bin}).
-
--spec load_native_sticky(Module :: module(), Binary :: binary(), WholeModule :: 'false' | binary()) -> load_ret().
-load_native_sticky(Mod, Bin, WholeModule)
- when is_atom(Mod), is_binary(Bin),
- (is_binary(WholeModule) orelse WholeModule =:= false) ->
- call({load_native_sticky,Mod,Bin,WholeModule}).
-
-spec delete(Module) -> boolean() when
Module :: module().
delete(Mod) when is_atom(Mod) -> call({delete,Mod}).
@@ -602,28 +590,7 @@ verify_prepared(_) ->
finish_loading(Prepared0, EnsureLoaded) ->
Prepared = [{M,{Bin,File}} || {M,{Bin,File,_}} <- Prepared0],
- Native0 = [{M,Code} || {M,{_,_,Code}} <- Prepared0,
- Code =/= undefined],
- case call({finish_loading,Prepared,EnsureLoaded}) of
- ok ->
- finish_loading_native(Native0);
- {error,Errors}=E when EnsureLoaded ->
- S0 = sofs:relation(Errors),
- S1 = sofs:domain(S0),
- R0 = sofs:relation(Native0),
- R1 = sofs:drestriction(R0, S1),
- Native = sofs:to_external(R1),
- finish_loading_native(Native),
- E;
- {error,_}=E ->
- E
- end.
-
-finish_loading_native([{Mod,Code}|Ms]) ->
- _ = load_native_partial(Mod, Code),
- finish_loading_native(Ms);
-finish_loading_native([]) ->
- ok.
+ call({finish_loading,Prepared,EnsureLoaded}).
load_mods([]) ->
{[],[]};
--
2.35.3