[LLVMdev] Java project, and introducing myself.

Ramón García ramon.garcia.f+llvm at gmail.com
Sat Feb 2 17:55:24 PST 2008


Hello, I am Ramon Garcia Fernandez. My interest in LLVM is to develop
an interface for Java virtual machine bytecodes, so that Java programs
can be run under LLVM.

You may ask why not using the Java virtual machine. Although it may be
improved, there are some misfeatures in it. This is what I have
learned. It makes the communication with native code too expensive.
Passing an array from native to the virtual machine or vice versa
requires a copy of the data. Why? you may ask. Because Java uses
garbage collectors based on copying. Thus the position of an object
may be moved by the virtual machine. The implementation of
generational garbage collection in Java uses areas of memory for each
generation, so that when an object changes from the young generation
to the old its storage must be moved. This may give some performance
advantage, by making young objects close in memory, but with the cost
of making exchange of data with native code expensive. In particular,
data copying is required for reading and writing files, sending or
receiving data from the network, or drawing. Since Java is not often
used for numerical analysis or tasks that require little data exchange
with the outside world, I disagree that the implementation with a
copying collector is good for most applications.

A more obvious problem is, of course, that it is not possible to
compile Java code statically and save the result in the disk.

So I am starting to write a compiler of Java bytecode to LLVM
bytecode. For now I am designing, dealing with things such as how to
assign stack positions to the operands of each instruction.

My target is to deliver something simple. Operations such as
classloader creation and dynamic class loading will not be supported.

Hoping that this is the start of a long term cooperation,

   Ramon



More information about the llvm-dev mailing list