OpenJDK has proposed a project, Galahad, which aims to merge some parts of the GraalVM Community Edition codebase into OpenJDK.
This is the latest development in a years-long effort to provide the ability to compile Java applications into machine code prior to program execution. And although such an idea might seem strange, one of the first things a new Java developer learns is that “Java doesn’t compile to machine code, it compiles to JVM bytecode”.
The Java platform relies on a powerful dynamic runtime, the JVM, for execution. This runtime enables dynamic techniques, such as class loading and reflection, that are unparalleled in compiled-ahead-of-time (AOT) languages. This is the starting point for many of Java’s strengths.
Two of the few Java Enhancement Proposals (JEPs) that relate to GraalVM are: JEP 243 and JEP 295. Both of these JEPs arrived in Java 9 and, together, they introduced the Graal compiler into the OpenJDK codebase.
What we need to know is that the Graal compiler is one of the main components of GraalVM – it is a compiler that works with Java bytecode and creates machine code. It can run in either JIT or AOT mode.
Galahad will be managed as a subproject of OpenJDK and will support a separate repo that will periodically overwrite the main repo. And when the features are ready, they will be transferred to the main repo. This is the same model that has been successfully used by long-running projects like Lambda.
Project Galahad would start with a clone of the current JDK mainline release, JDK 20, and track mainline releases going forward. The plans call for incrementally merging the Java-related GraalVM technologies from the Graal repository into the JDK 20 clone. This might include side repositories for experimentation. Project Galahad will be delivered over time in a series of Java enhancement proposals that likely will span multiple feature releases.
It is important to know that not the entire GraalVM codebase will be handed over, but only the core JIT and AOT components, as well as the Native Image toolkit. Oracle’s proprietary features present in GraalVM Enterprise Edition are not expected to be passed on to the project.
Most influential members of this community welcomed the idea of Galahad and described it as another important step forward in Java’s quest to remain at the forefront of Cloud Native technology stacks.