[erlang-questions] HiPE code from i386 linux portable to amd64 linux?

Mikael Pettersson mikpe@REDACTED
Fri Oct 31 19:29:20 CET 2008


Colm Dougan writes:
 > Hi,
 > 
 > If I compile using the +native option on a i386 Linux then should that
 > be portable to an AMD64 linux?

Not if the Erlang system runs in 64-bit mode.
If it runs in 32-bit mode then the native code should be compatible.

 >  I assumed that it wouldn't but I don't
 > see to get a warning when the module is loaded to indicate that it is
 > incompatible so I wasn't sure if that meant that the native code was
 > compatible with both or that it was silently falling back to
 > non-native code.

You don't get a load-time warning if the BEAM file lacks
native code for the current CPU type -- from the loader's
perspective that's equivalent to a BEAM file with no native
code at all.

You do get a warning (and a fallback to interpreted code)
if the BEAM file contains native code for the current CPU
type, but the code is deemed incompatible (there's a checksum
on a set of runtime system properties embedded in the object
file).

 >  Is there any way to tell if a given beam contains
 > native code that is incompatible.on a given erlang?

Not in any easy-to-use way no. You currently have to load the
module and observe any warnings, and observe if it executes
in native or interpreted mode. The latter you can do by calling
hipe_bifs:in_native/0 and checking its boolean return value.

/Mikael



More information about the erlang-questions mailing list