[LLVMdev] Using LLVM to target the JVM

Chris Lattner sabre at nondot.org
Tue Mar 1 09:57:46 PST 2005

On Tue, 1 Mar 2005, Evan Jones wrote:

> On Mar 1, 2005, at 12:13, Chris Lattner wrote:
>> Interesting, do you know of any documentation that describes how this 
>> works?  Does it just map the memory image for the mips program onto a giant 
>> array of bytes?
> int32 values, actually. The best documentation I have found is the 
> description of mips2java. It seems to be down, so I've included a link via 
> google's cache
> http://www.xwt.org/mips2java/

Wow, they are very serious about this.

Okay, so I don't know exactly what your (Curt's) goals are, but here's my 
impression.  If you want to do a fully general LLVM->Java translator (not 
an interpreter) it should basically start as a system similar to 
MIPS->Java, including the whole memory mapping thing (but probably at a 
byte level, not int32 level).

The MIPS->Java implementation is really a mips interpreter written in 
Java.  If you cared about performance (again, I don't know what your 
motivation is), it would be straight-forward to statically compile LLVM 
code to Java bytecode (or, equivalently, java "assembly").  This would 
make the resultant code MUCH faster, and would allow you to do other nifty 
optimizations.  For example, you could do simple analysis and promote LLVM 
arrays to Java arrays, bypassing the whole memory mapping thing in some 
important common cases.  We also have some analyses that can tell you if 
memory is accessed in a type-safe way.  You might be able to use this to 
promote higher-level objects and structures to be real Java objects 
instead of dealing with the memory map.

Again, I'm not sure exactly what your motivations are, but this sort of 
thing is certainly doable, and I don't think anyone is working on it.  :)



More information about the llvm-dev mailing list