diff options
author | Sverker Eriksson <[email protected]> | 2013-02-18 18:34:54 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2013-02-18 18:45:55 +0100 |
commit | a3158a1e6b7c5a0e6721dab3618b772068903fd4 (patch) | |
tree | dd9566a10f0f5059bfc9e5aab0e1e2db0764183a /erts/emulator/beam/beam_bif_load.c | |
parent | 710cd8efa09ecb62af06f61402683bf2a13481fc (diff) | |
download | otp-a3158a1e6b7c5a0e6721dab3618b772068903fd4.tar.gz otp-a3158a1e6b7c5a0e6721dab3618b772068903fd4.tar.bz2 otp-a3158a1e6b7c5a0e6721dab3618b772068903fd4.zip |
erts: Fix code:is_module_native
code:is_module_native returned false for hipe compiled module if
the first function in the module was a BIF stub
Diffstat (limited to 'erts/emulator/beam/beam_bif_load.c')
-rw-r--r-- | erts/emulator/beam/beam_bif_load.c | 16 |
1 files changed, 15 insertions, 1 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; } |