Search code examples
javajvmllvmjvm-hotspot

How to integrate LLVM to JVM Runtime


Is it possible to integrate LLVM with JVM Runtime. I am interested in this perf optimization Azul Zing already does that but is possible to do it with Oracle's JVM or OpenJDK ?


Solution

  • It is unlikely to be feasible for you to integrate LLVM with OpenJDK or Oracle JDK. (OpenJDK or Oracle JDK are pretty much the same thing anyway ... from a technical perspective.)

    You would need to repeat all of the development work that the Azul team have done to get their LLVM-based compilers to work with a JVM. That is unlikely to be practical for you.

    I am interested in this perf optimization Azul Zing already does that but is possible to do it with Oracle's JVM or OpenJDK ?

    It may be possible1 to implement those optimizations by modifying the existing OpenJDK code-base.

    GraalVM looks like another option. (What GhostCat didn't mention in his answer is that GraalVM supports LLVM-based compilers. So if you had an LLVM-based compiler for Java, you could use that as the basis for your optimizer work.)


    1 - It is not clear whether Azul took the LLVM approach for technical reasons, or for licensing reasons, or both. If they took the approach of modifying the OpenJDK JIT compiler, they would be obliged to publish their source code.