[erlang-questions] Threaded VM with llvm-gcc

Björn Gustavsson bgustavsson@REDACTED
Tue Sep 24 07:37:37 CEST 2013


On Sat, Sep 21, 2013 at 4:56 PM, Anthony Ramine <n.oxyde@REDACTED> wrote:

> Hello,
>
> I read in the installation guide [1] that it is recommended to use GCC 4.2
> to build Erlang because CLang and LLVM cannot use jump tables.
>
>
At least in the version of the installation guide you linked to,
it says nothing about jump tables being the reason for the
recommendation. It says that the performance will be worse
if GCC is not used, but it does not say why.

There is two problems with this:
>
> - This is not consistent with what the configure scripts actually do:
> CLang 3 and later use jump tables when compiling Erlang [2].
>

Yes, it is consistent since the installation guide only talks about
performance,
not jump tables.


> - There is no reason to not use LLVM 2.7 and later for beam_emu.c because
> it does compile jump tables efficiently [3].
>
>
It does compile jump tables efficiently, but it does a worse job
of register allocation, especially for huge function such as
process_main() in beam_emu.c. That said, code generation
has improved in each new version of clang, making it less
important to use a "real" GCC.



> Unfortunately I have no idea how to fix this, as there is no way to get
> the LLVM version from any preprocessor macro [4]. Should we just remove the
> LLVM check from the test and let the snippet of code fail to compile [5]?
>
>
What is the problem you want to fix? Have you observed
any situation where jump tables where not used when they
should be?

The test is where to protect against an old broken version
of llvm-gcc that did not handle jump tables correctly.
It will also make sure that Erlang/OTP can be compiled
on systems where no compiler that supports jump tables
can be found.

/Björn

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130924/d3bce7f0/attachment.htm>


More information about the erlang-questions mailing list