diff options
author | Sverker Eriksson <[email protected]> | 2013-02-20 15:57:22 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2013-02-20 15:58:05 +0100 |
commit | cff50efe0cd9dd3e70341142d52b1865a58ea41e (patch) | |
tree | 1cec87969b6cbaeb3c332b74a6e860795c854cab | |
parent | 973eecebb6ba42f44f44a9166cb861818b3f9265 (diff) | |
parent | a3158a1e6b7c5a0e6721dab3618b772068903fd4 (diff) | |
download | otp-cff50efe0cd9dd3e70341142d52b1865a58ea41e.tar.gz otp-cff50efe0cd9dd3e70341142d52b1865a58ea41e.tar.bz2 otp-cff50efe0cd9dd3e70341142d52b1865a58ea41e.zip |
Merge branch 'sverk/is_module_native-fix'
* sverk/is_module_native-fix:
erts: Fix code:is_module_native
OTP-10870
-rw-r--r-- | erts/emulator/beam/beam_bif_load.c | 16 | ||||
-rw-r--r-- | lib/kernel/test/code_SUITE.erl | 4 |
2 files changed, 17 insertions, 3 deletions
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c index 73264214ce..8a8239493a 100644 --- a/erts/emulator/beam/beam_bif_load.c +++ b/erts/emulator/beam/beam_bif_load.c @@ -1081,7 +1081,21 @@ beam_make_current_old(Process *c_p, ErtsProcLocks c_p_locks, Eterm module) static int is_native(BeamInstr* code) { - return ((Eterm *)code[MI_FUNCTIONS])[1] != 0; + Uint i, num_functions = code[MI_NUM_FUNCTIONS]; + + /* Check NativeAdress of first real function in module + */ + for (i=0; i<num_functions; i++) { + BeamInstr* func_info = (BeamInstr *) code[MI_FUNCTIONS+i]; + Eterm name = (Eterm) func_info[3]; + + if (is_atom(name)) { + return func_info[1] != 0; + } + else ASSERT(is_nil(name)); /* ignore BIF stubs */ + } + /* Not a single non-BIF function? */ + return 0; } diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl index 4c040f0a0e..b7015718e5 100644 --- a/lib/kernel/test/code_SUITE.erl +++ b/lib/kernel/test/code_SUITE.erl @@ -716,7 +716,7 @@ analyse([], [This={M,F,A}|Path], Visited, ErrCnt0) -> %% These modules should be loaded by code.erl before %% the code_server is started. OK = [erlang, os, prim_file, erl_prim_loader, init, ets, - code_server, lists, lists_sort, unicode, binary, filename, packages, + code_server, lists, lists_sort, unicode, binary, filename, gb_sets, gb_trees, hipe_unified_loader, hipe_bifs, prim_zip, zlib], ErrCnt1 = @@ -1590,7 +1590,7 @@ native_early_modules_1(Architecture) -> ?line true = lists:all(fun code:is_module_native/1, [ets,file,filename,gb_sets,gb_trees, %%hipe_unified_loader, no_native as workaround - lists,os,packages]), + lists,os]), ok end. |