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

Jakob Praher jp at hapra.at
Wed Apr 19 10:36:10 PDT 2006

Tom Tromey wrote:
>>>>>> "Jakob" == Jakob Praher <jp at hapra.at> writes:
> Jakob> I would definitely like to look into it.
> I'll send it in private email.
Would be nice.

> 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 :-)
Okay that is because memory is not in SSA form?

> 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.
Yes I can imagine that.

> 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.

Okay. Which is the IR then? Is it LLVM bytecode?
I have to confess, that I don't know really much about the design, but
am very interested.

> 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).

Kewl. I also once looked at kprobes to trap into readonly text
segements, and be able to trap for instance hot traces (like loops) for
inlining and so on. DynInst API is interesting in this regard. Kprobes
can be used for userprocess instrumentation as well.

After I have finished my thesis, I want to add generating LLVM bytecode
from intel assembly. This would be interesting to instrument native code
as well :-)

-- Jakob
> Tom

More information about the llvm-dev mailing list