PowerPC JIT available for testing

Hi everyone,

This is just a note to mention that the PowerPC JIT is now operational and
begging for testing in mainline CVS. There is one known problem (below),
but otherwise it works as well as the static PowerPC backend on the test
suite.

The known problem is that the JIT seems unable to resolve calls to
external functions that start with "__", such as __eprintf, __moddi3, etc.
This appears to be something funny in the darwin implementation of dlsym
(returning null for symbols that are valid if they start with __). If
anyone has any ideas of how to make this work, we would love to hear them.
:slight_smile:

-Chris

Well, one of these days we'll be using libltdl (libtool's dynamic
library support) to make the interface to dynamic libraries consistent,
somewhat portable, and to get rid of system specific differences like
this.

Reid.

FYI .. if you want to see how this works, check out
lib/System/DynamicLibrary.cpp and platform versions of it.

Reid.

Le Sun, Nov 28, 2004 at 12:00:03PM -0600, Chris Lattner écrivait/wrote:

This is just a note to mention that the PowerPC JIT is now operational and
begging for testing in mainline CVS. There is one known problem (below),
but otherwise it works as well as the static PowerPC backend on the test
suite. [....]

I'll be delighted to test it, but so fare I was not able to compile
LLVM, even on x86 (without the llvmgcc which I don't use).

Are there precise build & use instructions for newbies wanting to test
LLVM *in JIT mode only* (I did not found any)?

Again, I do not xant to use any llvmgcc stuff... I don't need it (and
if it where absolutely needed for JIT use of LLVM I would give up
using LLVM for JIT...)

Regards.

Le Sun, Nov 28, 2004 at 12:00:03PM -0600, Chris Lattner écrivait/wrote:
>
>
> This is just a note to mention that the PowerPC JIT is now operational and
> begging for testing in mainline CVS. There is one known problem (below),
> but otherwise it works as well as the static PowerPC backend on the test
> suite. [....]

I'll be delighted to test it, but so fare I was not able to compile
LLVM, even on x86 (without the llvmgcc which I don't use).

You don't need llvmgcc to get the basic LLVM compiled. Just build with
"make tools-only".

Are there precise build & use instructions for newbies wanting to test
LLVM *in JIT mode only* (I did not found any)?

Not specifically for "JIT mode only" but you should review:

http://llvm.cs.uiuc.edu/docs/GettingStarted.html

Again, I do not xant to use any llvmgcc stuff... I don't need it (and
if it where absolutely needed for JIT use of LLVM I would give up
using LLVM for JIT...)

Should be fine, just don't build the runtime stuff.

FYI .. if you want to see how this works, check out
lib/System/DynamicLibrary.cpp and platform versions of it.

Is it an option to use this interface now? How does libtool implement
dlsym on darwin if not through the obvious interface? Can we just use
whatever it uses?

-Chris

The DynamicLibrary.cpp code is written and I believe it to be complete,
but it hasn't been tested much (at all). llvm-ld uses it to load its
plug-in optimization module. The implementation will use ltdl library
if its available, otherwise it tries to use dlopen/dlsym if they are
available, otherwise you get a compile time warning and (void*)0 if you
try to look up a symbol.

I'm not sure about the libtool implementation but it does more than just
accommodate the platform differences for the interface function names.
It also makes sure that platform requirements for initialization of the
loaded module, etc. are taken into account (e.g. static initialization
of data in the shared object). I don't think we want to re-invent this,
its nasty stuff. As for whether it solves the lookup of symbols
starting with __, I'm unsure. You'd have to look at the ltdl
implementation.

Reid.

> This is just a note to mention that the PowerPC JIT is now operational and
> begging for testing in mainline CVS. There is one known problem (below),
> but otherwise it works as well as the static PowerPC backend on the test
> suite. [....]

I'll be delighted to test it, but so fare I was not able to compile
LLVM, even on x86 (without the llvmgcc which I don't use).

Sure, just follow the getting started guide, which will show you have to
build LLVM.

Are there precise build & use instructions for newbies wanting to test
LLVM *in JIT mode only* (I did not found any)?

Without the CFE, there are not a whole lot of ways to get LLVM bytecode to
test, but the llvm/examples directory contains several example programs
that build LLVM code on the fly and JIT it, that should do the job.

-Chris

The DynamicLibrary.cpp code is written and I believe it to be complete,
but it hasn't been tested much (at all). llvm-ld uses it to load its
plug-in optimization module. The implementation will use ltdl library
if its available, otherwise it tries to use dlopen/dlsym if they are
available, otherwise you get a compile time warning and (void*)0 if you
try to look up a symbol.

Okay, interesting. How hard would it be to replace the DynamicLinker.cpp
functionality with your code?

I'm not sure about the libtool implementation but it does more than just
accommodate the platform differences for the interface function names.
It also makes sure that platform requirements for initialization of the
loaded module, etc. are taken into account (e.g. static initialization
of data in the shared object). I don't think we want to re-invent this,
its nasty stuff. As for whether it solves the lookup of symbols
starting with __, I'm unsure. You'd have to look at the ltdl
implementation.

It looks like it uses the darwin dylib interfaces directly instead of
going through the dlsym compatibility layer darwin provides. This might
do exactly what we want.

-Chris

Okay, interesting. How hard would it be to replace the DynamicLinker.cpp
functionality with your code?

Not hard. That's just one of the many lib/System things on my plate for
1.5. If you want to do it now, that would be fine. There's only a few
places DynamicLinker.cpp is used.

It looks like it uses the darwin dylib interfaces directly instead of
going through the dlsym compatibility layer darwin provides. This might
do exactly what we want.

I expect so. libltdl was designed to address exactly the problem we're
having.

Reid.

Le Sun, Nov 28, 2004 at 10:32:32AM -0800, Reid Spencer écrivait/wrote:

> Le Sun, Nov 28, 2004 at 12:00:03PM -0600, Chris Lattner écrivait/wrote:
> >
> >
> > This is just a note to mention that the PowerPC JIT is now operational and
> > begging for testing in mainline CVS. There is one known problem (below),
> > but otherwise it works as well as the static PowerPC backend on the test
> > suite. [....]
>
> I'll be delighted to test it, but so fare I was not able to compile
> LLVM, even on x86 (without the llvmgcc which I don't use).

You don't need llvmgcc to get the basic LLVM compiled. Just build with
"make tools-only".

Ok. Then how do I install, and how do I run the JIT tests?

> Are there precise build & use instructions for newbies wanting to test
> LLVM *in JIT mode only* (I did not found any)?

Not specifically for "JIT mode only" but you should review:

http://llvm.cs.uiuc.edu/docs/GettingStarted.html

I did read several times this page, and I find it very disappointing
for JIT users (like I want to be). More specifically, it says:

  4 Install the GCC front end:

     1. cd where-you-want-the-C-front-end-to-live
     2. gunzip --stdout cfrontend.platform.tar.gz | tar -xvf -

which is exactly the step I want to avoid.

Sorry for pointing it out, but I did found the GNU lightning
documentation, installation procedures, and use much much
easier. Nothing comparable yet in LLVM *for JIT use*

Regards.