Is there a llvm java front end that converts a java source to llvm intermediate form?

From what I read, there is an llvm program that converts java bytecode into an intermediate llvm form called class2llvm. My question is how do I access this. What interface do I need to install in order to access this.

VMkit is their implementation of the JVM, but I'm looking for how to compile java source code with llvm, and not how to run it.

+42
java bytecode llvm
May 29 '12 at 17:58
source share
4 answers

The Java interface translates Java bytecode (.class files) into LLVM bytecode. Take a look at this link:

https://llvm.org/svn/llvm-project/java/trunk/docs/java-frontend.txt

+25
Nov 29 '12 at 20:48
source share
β€” -

You can take a look at dragonegg , which allows llvm to use gcc interfaces. Since gcc already has an interface for java called gcj , maybe llvm can use it to compile java code. But I'm not sure how well llvm interacts with the gcc interface, so this may not work.

+5
May 30 '12 at 11:25
source share

I executed the java class using vmkit ( http://vmkit.llvm.org/ ) based on LLVM. It uses LLVM to compile and optimize high-level languages ​​for machine code. J3 is a JVM implementation with VMKit.

+3
Jan 16 '13 at 20:46
source share

[ NOTE: Since November 2015, it is no longer open source, so this hack is mostly useless. ]

RoboVM may be the solution you are looking for. It is open source and compiles JVM bytecode (.class files) into machine code.

I assume they do this using something like class2llvm.

Unfortunately, he is still in alpha. I just tested it on HelloWorld.java. This gave a 5x faster boot time running on a single core. (Most of the execution time is load time.)

echo Hello World! : <1 ms : 31K echo Hello World! : <1 ms : 31K (/ usr / bin / echo binary)

java HelloWorld : ~70 ms : 0.4K (JVM HelloWorld.class bytecode)

./HelloWorld : ~13 ms : 9.4MB (9.3MB binary + 57K robovm-rt.jar)

Note that java calls the 32MB file $ JAVA_HOME / lib / rt.jar (and possibly more). Searching in such a large file should be part of the reason java loads so slowly. If RoboVM gets smarter, maybe it can throw away most of the 9.3 MB binary for even faster downloads?

The site mentions iOS, but I think that since they are selling their additional user interface libraries. RoboVM has collected a fine for me for the taste of Ubuntu. Just be sure to do

$ sudo apt-get install g ++ - multilib

first (and maybe install libpthread-stubs0-dev and libpthread-workqueue0 ... I don't know if they mattered).

+2
Nov 15 '14 at 3:13
source share



All Articles