[LLVMdev] Re: LLVM-based JVM JIT for libgcj

Tom Tromey
2006-04-18T23:34:02Z

>>>>> "Jakob" == Jakob Praher <jp at hapra.at>
writes:

Jakob> I would definitely like to look into it.

I'll send it in private email.

Jakob> Yes very much! How did you find writing it directly in
Jakob> SSA-form.

Actually I used what Chris called "the alloca trick"... the JIT
doesn't really generate SSA form but instead uses alloca to allocate
space for the stack and locals (and temporaries where needed) and then
emits explicit loads and stores everywhere.  On irc Chris showed me
how to invoke the LLVM pass to turn this back into something sane :-)

Jakob> What is the footprint of libjit compared to the more heavy LLVM
Jakob> jit? How about recompiling in libjit? Has it support for CFG,
Jakob> dataflow analysis?

Oh, libjit is much smaller.  I don't think it does much by way of
optimization.

libjit takes a very simple approach to recompilation.  There is a
function you can call to request recompilation for a method.  Then
(AIUI -- didn't implement this in the JIT yet) libjit will call your
build function again, to re-create the IR.  The docs talk a bit about
being able to run more optimizations, but I think that is just the
general idea, since I don't think there are actually other optimizers
available.

Even this amount of support is worthwhile in a JVM, fwiw.  You can
generate better code once constant pool entries have been resolved,
and this pretty much has to be done lazily (not what the VM spec says,
but important for actual compatibility).

Tom