Port Julia to the GraalVM

The GraalVM allows to combine code written in JVM-based languages such as Java, Scala, and Kotlin, but also other programming languages such as JavaScript, Ruby, Python, and R. I would like to be able to use Julia as well.

We have a Java based codebase. I develop my algorithms in Julia and then convert them to Scala for our production system. I prefer to add my Julia code directly in our production code.

I use the great JavaCall package for testing but its overhead is too big for our realtime system.

GraalVM can run LLVM bitcode and Julia is based on LLVM so it seems a plausible project.

1 Like

Please keep us updated about your progress doing this.

2 Likes

Here is a cross link to the original GitHub issue which has a brief discussion: https://github.com/JuliaLang/julia/issues/34334

I was looking at the JavaCall issues and came across this.

It looks like the static implementation could be done by chaining existing tools together.

  1. Setup for static AOT Julia
  1. Emit LLVM bitcode from julia with --output-bc

  2. Run the LLVM bitcode with sulong: mx lli -Dpolyglot.llvm.libraryPath=lib -Dpolyglot.llvm.libraries=liba.so test.bc

  1. Compile the LLVM bitcode with optimizations
mx --dynamicimport /compiler --jdk jvmci lli test.bc

@mkitti The original post for 1. is a bit outdated. Does it still apply to Julia 1.x?