[LLVMdev] LLVM-based JVM JIT for libgcj

Tom Tromey
2006-04-18T18:07:22Z

I recently wrote an LLVM-based JIT plugin for libgcj and I thought
it'd be worthwhile to mention it here.

It is in cvs on sourceforge, but afaics anonymous cvs there is pretty
broken at the moment... so if you want a copy, ask and I will email it
to you.


Basically I hacked libgcj to (optionally) dynamically load JIT module
at startup.  If a JIT is loaded then bytecode is passed to it rather
than to the libgcj bytecode interpreter.

The LLVM JIT is pretty raw at the moment.  It can run "hello world"
and a few microbenchmarks (empty loops, method calls, that sort of
thing).  I haven't tested it seriously yet.  On my little benchmarks
it is 5x-6x faster than our interpreter.

Exception handling definitely does not work, I didn't even try to
implement it yet.  I've been thinking about having some kind of simple
bridge between the LLVM and GCC worlds here -- very inefficient, but
at least I could get it working rather quickly.  Long term I'm hoping
someone else will be solving this problem... :-)


FWIW I actually did this work twice, once for libjit and once for
LLVM.  I'm happy to provide a comparison, from a jit-writing
perspective, if you're interested.

Thanks for writing LLVM.  It is awesome to be able to add a JIT to
libgcj this easily.

Tom