Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

From what I've read, there is a llvm program that converts java bytecode to llvm's intermediate form called class2llvm. My question is, how do I access this. What front end do I have to install in order to access this.

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

like image 434
FeelTheBurns Avatar asked May 29 '12 17:05

FeelTheBurns


People also ask

Does LLVM support Java?

Status (December 2019) All translations from Java to LLVM IR are complete. This means that all Java 7 language features---expressions, control flow, exceptions, method dispatch, switch statements, try-with-resources, initializer blocks, implicit type conversions, etc.

Does JVM compile to machine code?

The JVM either interprets the byte code, i.e. it looks up the things to do on the hardware for each opcode in some internal data structure, or it compiles the byte code to real machine code and simply calls the compiled code when a Java routine is called.


2 Answers

The Java frontend 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

like image 87
Ashkan Avatar answered Sep 19 '22 00:09

Ashkan


You may take a look at dragonegg, which enables llvm to use gcc's frontends. As gcc already has a frontend for java, called gcj, perhaps llvm can use it to compile java code. But I'm not sure how well llvm interfaces with the gcc frontend, so this may not work.

like image 37
lei_z Avatar answered Sep 21 '22 00:09

lei_z