Georgia Ingham Georgia is a Java Developer. She has spoken at lots of conferences. Her hobbies include reading, completing puzzle books and cycling.

Are you a Java Developer working with PDF files?

Find out why you should be using JPedal

Java 10’s Experimental JIT Compiler explained in 5 minutes

1 min read

This month’s theme is Java 10 to tie in with the release of the new Java version. Despite being only 6 months since Java 9, there are some really exciting new features. I am going to look at the experimental JIT compiler that is part of Project Graal.

What is Project Graal?

Project Graal was created by Oracle with the ultimate goal of improving JVM based languages performance to better match the performance levels that native languages enjoy. One part of this project involves implementing a high performance dynamic Java compiler and interpreter AKA a Just-In-Time (JIT) compiler. This feature is described further in JEP 317

What is a Just-In-Time Compiler?

JIT compilation is a form of dynamic compilation which combines the use of Ahead-Of-Time (AOT) compilation and interpretation, and thus has advantages and disadvantages from both technologies.

Ahead-Of-Time Compilation
An AOT compiler was added to the OpenJDK as part of the Java 9 release. The main goal was to improve the start-up time of Java applications with minimum impact to the application’s peak performance. Whilst not as fast as a warmed up JIT compilation AOT avoids incurring performance penalties from having to repeat interpreted invocations.

A process which interprets the code and performs the specified actions. There are different ways an interpreter can work: it can parse the code and execute it directly, turn the code into an intermediate representation and execute that, or it can execute code that has already been pre-compiled. Each of these different methods have their own advantages and disadvantages.

JIT compilation combines the start-up speed of AOT compiled code with the flexibility of interpretation to create a faster solution. The main difference between JIT and AOT is that instead of interpreting bytecode every time a method is invoked, a JIT compiler will compile the bytecode into the machine code instructions of the running machine, and then invoke this object code instead. Another difference is that AOT also turns the bytecode of a virtual machine into native machine code so the interpreted code can be executed.

How to use the experimental compiler

Unfortunately, this feature isn’t for everyone as it only works for Linux/x64 platforms at the moment.

It is very easy to enable the experimental JIT compiler though as it is already included as part of the JDK. You just have to set the following options when running Java from the command line:

-XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler

Then you can start testing it out. The JIT compiler itself is still in its testing phase though and it’s worth being aware that at this time this option is not being created/added to meet or beat the performance of the existing JIT compilers. It is there to investigate the feasibility of a Java-based JIT for the JDK.

And there you have it – an explanation of Java 10’s experimental JIT compiler.

Our software libraries allow you to

Convert PDF to HTML in Java
Convert PDF Forms to HTML5 in Java
Convert PDF Documents to an image in Java
Work with PDF Documents in Java
Read and Write AVIF, HEIC, WEBP and other image formats
Georgia Ingham Georgia is a Java Developer. She has spoken at lots of conferences. Her hobbies include reading, completing puzzle books and cycling.