I am a bit worried by Rasmus' mail.
There are some subtle issues relating to LLVM and 32/64 bit architectures. This turned up last year (when we were running LLVM 2.6) and for this I hoped to have tamed the problem by making you insert the "target datalayout" line in the beginning of each file. But now it seems that the problem may still be there in some form. As you see from Rasmus' mail, the error messages from lli are not very helpful. I would be very interested in knowing whether Rasmus can run his solution on the machines in the lab rooms. Since these are 64 bit machines, I am worried that this might not be the case.
I will look more into this later today, but for the moment I can only warn those of you who are working on extensions involving pointers that there might be some LLVM-related problem. (Of course, it is still quite possible that the problem is in your code.)
As for Rasmus' question about generating 64 bit code on the Mac, I believe there is a very simple solution: Just remove the "target datalayout" everywhere (including in lib/runtime.ll) and everything should work. Of course, I would also appreciate to get to know if this is so. If you want to see the assembly code generated at runtime by lli's JIT compiler (or just want to create an executable that does not depend on lli), you might do
llc a.out.bc
which generates x86_64 assembly in a.out.s. To get an executable from this, use gcc:
gcc a.out.s
Björn
- the problem only appears when you use pointers, so for basic
Javalette there are no problems.
- the problem only appears when you run your code on 64 bit machines (such as
our lab machines).
- the problem can be avoided by removing the target datalayout line in runtime.ll and also
not generating any such lines in your compiler (recommended solution).
- the problem can also be avoided by leaving these lines as they are and calling
llvm-ld with the command line option disable-opt, which avoids all optimization.
I have some more information and some examples that show how
optimization introduces a problem in the code having to do with alignments, but
for the moment I leave the explanation at this point. I am willing to
offer a credit for an analysis of the problem. Contact me if you are interested.