[erlang-bugs] Minor issue: dialyzer on ARM: Compiling some key modules to native code => Illegal instruction (core dumped)

Kostis Sagonas kostis@REDACTED
Mon Dec 1 14:58:58 CET 2014


On 12/01/2014 10:42 AM, Mikael Pettersson wrote:
> Background: ARM processors typically support two related but different
> instruction sets and execution modes: ARM (the ordinary one) and Thumb
> (an alternative one which offers higher code density at the expense of
> lower performance).  With ARMv7, the Thumb mode has been improved and
> some environments make it the default.
> ...
> It's possible to work around this problem by forcing the VM to be
> compiled in ARM mode (by adding "-marm" to CFLAGS).  I prepared a
> patch to do that, and it fixed the problem on Mattias' system.
>
> Since changing the compilation mode may or may not be what the
> user or system builder intended, I'm reluctant to do this silently.
> Therefore I'm considering removing the auto-enable of HiPE on ARM.
> Users will have to explicitly enable HiPE, and accept that BEAM will
> be in ARM mode not Thumb.

I do not have a strong opinion but, from what you are describing and 
from some googling on ARM vs thumb on the internet, it seems to me that 
adding -marm to the CFLAGS will result in BEAM itself executing faster 
(or at least not slower than with thumb), and the main advantage of the 
Thumb mode is in better memory (i-cache?) utilization.  I am not sure 
why some (recent?) C compilers make Thumb the default, but I guess it's 
because the ARM processors are often used in embedded applications and 
they primarily want to optimize for code size rather than speed.  Not 
sure this is the primary goal of Erlang developers who download and 
install Erlang/OTP and e.g. want to run dialyzer (as Mattias) on that 
machine.

So my current vote would go to add the -marm option anyway when building 
BEAM, and leave HiPE enabled by default on that platform too.  Erlang 
developers who are primarily interested in the memory benefits of the 
Thumb mode can explicitly enable it with an appropriate flag which would 
also disable HiPE then, at least until the following is fixed.

It would be nice to investigate where the incorrect mode switch between 
HiPE and BEAM is and eliminate this if it's not too much work.

Kostis



More information about the erlang-bugs mailing list