OpenJDK Projects That We Anticipate
Transcript
The Java platform is in full bloom. There are many projects in the OpenJDK that aim to improve Java in some way. Some of them are already integrated or getting integrated such as Project Loom. Some of them are ripening, and their integration is just around the corner. Let’s look at four OpenJDK Projects that we all look forward to.
Leyden
Java applications can take several minutes to warm up and reach peak performance. Plus, they have a bigger CPU and memory footprint during the warm up. Project Leyden will improve these issues. The project aims to achieve this by shifting and constraining some computations from the production run to some earlier stage, for instance, to the training run. The shifting, constraining, and optimizing transformations will be applied in the form of condensers. A condenser transforms program code without breaking the compatibility with the Java Platform Specification. When the application runs in production, it reuses this already compiled code, and so the startup and warmup will be faster. Project Leyden will use Application Class Data Sharing, Ahead-of-time compilation, and additional techniques that will allow the transformation and reuse of the application code. Early-access builds of Project Leyden are already available! At this stage, the project observes application behavior during the trial run and performs certain computations. Then, it creates a CDS archive with class metadata, method profilers, and some compiled code. If you want to try Early-Access builds of Project Leyden with your application, I wrote a step-by-step guide on how to do that, the link is in the description.
Valhalla
Project Valhalla aims to improve the performance of Java applications by bridging the gap between the Java programming model and modern hardware capabilities. Java is based on the object-oriented model, so if there’s no available primitive type for some data, it is natural to use objects. But creating and fetching objects is costly. So, Project Valhalla will offer a solution in the form of value objects, primitive classes, and specialized generics. Value objects have a value and behavior just like all other Java objects, but they don’t have identity, which distinguishes one object from another and helps to create mutable objects and perform some identity-sensitive operations like comparing two objects for equality by reference. But identity requires that an object resides in one place and has a pointer. A value object without identity must be immutable, but in turn, the JVM can freely copy and re-encode it, which leads to optimized memory usage. Primitive classes combine the benefits of primitives and objects. Their objects can have fields and methods, but these objects are just sequences of non-static fields and behave like primitives at runtime. Generics specialization will enable the developers to use generics with primitive types and value objects without breaking backward compatibility. All these enhancements will enable the JVM to produce more memory-efficient data structures, bringing the performance of Java applications to a new level. Early-access builds are available for experiments.
Babylon
Babylon Project will help to transform Java code to foreign programming models such as GPUs, machine learning models, and so on. This will be done by improving Java reflection capabilities with so-called code reflection. Code reflection means developers can write code models in Java that can be accessed at compile time or at runtime. These models can be transformed by Java itself to fit some other programming model. For instance, a Java program can be transformed into a GPU kernel or emulate Language Integrated Queries (LINQ) of C#. Project Babylon is at the early stages of development, but you can explore project documentation.
Lilliput
Project Lilliput will reduce the size of Java object headers. All Java objects have headers, which consist of a header word and a class pointer. HotSpot JVM headers take up 128 bits on 64-bit architectures. This Project aims to reduce their size to 64 bits and eventually to 32 bits if possible. This will help to improve memory footprint and CPU usage of Java applications thanks to the reduced heap usage.