[erlang-patches] load native code for early modules

Björn Gustavsson <>
Wed Jul 28 09:03:08 CEST 2010

On Sun, Jul 11, 2010 at 8:00 PM, Paul Guyot <> wrote:
> The native chunks of modules loaded before the code server are never loaded, which makes it pretty pointless to natively compile them in the first place (with --enable-native-libs). A patch that loads them just after the code server is started can be found here:
> git fetch git://github.com/pguyot/otp.git pg/load-native-code-for-early-modules
> http://github.com/pguyot/otp/commit/2637b8a24e2d9ba3653e580f21a70976915dc201
> As a side effect, this patch will decrease the load time of dialyzer on installations configured with --enable-native-libs. Indeed, dialyzer natively recompiles modules including some that were loaded before the code server (such as lists, gb_trees, etc.).

Your added code is located in the code_server module,
but it is not executed in the code_server process.

This is confusing for both human readers and a test
case called code_SUITE:ext_mod_dep/1 which attempts
to find unsafe calls in the code_server process.

Therefore, I suggest that you move the code to the 'code'
module (putting the call to load_native_code_for_all_loaded/0
in the do_start/1 function).

Minor style nit: You don't need parenthesis around a catch
unless you want to assign the result to a variable.

Björn Gustavsson, Erlang/OTP, Ericsson AB

More information about the erlang-patches mailing list