Compiling Java ahead-of-time with GraalVM

Day 2 /  / Track 3  /  RU

GraalVM is a high-performance virtual machine for different programming languages. It supports many popular languages: Java, Kotlin, Scala, JavaScript, Python, Ruby, R, even the likes of С и С++. GraalVM has an interesting feature: it can compile JVM bytecode into machine code ahead-of-time, creating images of the common Java programs, which do not depend on JVM, can be launched in milliseconds and require less memory. This can be done on the special virtual machine — SubstrateVM, which is written on Java and offers its own implementations for garbage collecting, code cash, flow control, and other JVM components.

We'll talk about configuration of SubstrateVM, special aspects of its approach to code compiling and its limitations. We'll take a look at the internal analysis of Java programs and at what exactly happens when the image is being created (at this moment you might experience mixed feelings for static initializers in the code and for rarely updated libraries). We'll figure out how and why we should configure the use of Reflection API, access to resource files, JNI, Unsafe, and all the other little things of the common Java applications. We'll show how to use profile-guided optimizations for creating quick images which do not lose information about potential profile of using the code. We'll discuss which programs might and should be compiled ahead-of-time, look at applications already working and their performance.

P. S. We're not going to consult assembler, maybe just to check the box.


Download presentation
Oleg Šelajev
Oracle

Oleg Šelajev is a developer advocate for the GraalVM project at Oracle Labs, which aims to make programs run faster and developers more productive. He helps to organize VirtualJUG, the online Java User Group, and a GDG chapter in Tartu, Estonia. Became a Java Champion in 2017. Loves pizza and playing chess. Favorite languages: Java, JavaScript, and Clojure.

Speaker's previous talks