[LLVMdev] Introducing myself, and Java project.

Ramón García ramon.garcia.f+llvm at gmail.com
Sun Feb 3 19:09:55 PST 2008


I have just worked with this code. The architecture is fine, and I
think that this code should be reused,
It needs updating, however, because it does not compile with LLVM 2.1
(I prefer to use a stable version
to focus my work, and port to LLVM 2.2 later).

I have seen that one incompatibility is that this Java frontend
requires C++ with exceptions, but LLVM is compiled with
-fno-exceptions. For now, I am compiling with -fexceptions. Should
exceptions be removed from the code of the Java frontend?

Then, I have doubts about whether the changes for getting it built are
correct or not. I will make more questions later.

This could be a work plan:

* Getting the java frontend built.

* Implement exception handling (jsr/ret bytecodes)

* Implement garbage collection.

* Support JAR files.

This should get an usable Java implementation. But there is still very
hard work to be done. The difficult part is dynamic class loading,
reflection and creation of classloaders. This would enable to use LLVM
for Java server applications such as Tomcat or JBoss. I am not sure if
this work is possible without funding a full time position. Just some
questions to think about it. To what extent does LLVM support dynamic
code loading? Is it posible to get code loaded at runtime? Could this
break assumptions made by interprocedural optimization? (A function
may be called in unexpected ways)

Another difficult part is optimization. In order to get good
performance, references should be converted to values whenever
possible. Recent virtual machines support scape analysis, so that
local references can be converted into values, and be stored and
released in the stack. This should be generalized to references that
are class members.

Java code is particular hard to optimize because any function call is
a virtual function call. Is inlining posible? Only if one makes
assumptions about any code using some class, that no other class is
going to override the called method. Programmers could declare methods
final, but this is rarely done. Assumptions may be checked for all
loaded classes, but, for classes not yet loaded (and which may be
loaded dynamically), who nows?

But this is for very long term feature. For now, let us have fun
completing the doable parts.

Best regards,

Ramon



More information about the llvm-dev mailing list