OpenJDK’s Project Valhalla, which explores advanced Java language and JVM feature possibilities, is moving forward with a staged delivery of value objects, primitive objects, and unification of basic primitives.
Overall, the ambitious Valhalla project is intended to heal a rift between primitives and objects. The three key capabilities, cited in a December blog post, “The State of Valhalla” by Brian Goetz, Java language architect at Oracle, are described in JDK Enhancement Proposals (JEP) currently pending in the OpenJDK community. Those three capabilities are:
- Value objects that would enhance the Java object model with class instances that have only
finalinstance fields and lack object identity.
- Primitive objects that would enhance the Java object model with user-declared primitive objects.
- Unification of basic primitives and objects.
Begun in 2014, Valhalla has the goals of bringing more flexible, flattened data types to JVM-based languages in order to restore the alignment between the programming model and the performance characteristics of modern hardware.
- A generics plan that involves universal generics and specialized generics.
- Unification of primitives and objects so primitive-like types can be declared with classes while maintaining special runtime characteristics of primitives.
- Migration of many value-based classes in the JDK to value classes.
- Enabling data layouts better suited to the performance of current hardware by providing Java developers with an easier path to cache-efficient and dense memory layouts without compromising abstraction or type safety.
Valhalla is sponsored by the HotSpot Group, which is comprised of developers involved in the design, implementation, and maintenance of Java’s HotSpot virtual machine. The project already has delivered on warnings for value-based classes, provided in Java 16 in March 2021.