Project Valhalla is an experimental
OpenJDK
OpenJDK (Open Java Development Kit) is a free and open-source implementation of the Java Platform, Standard Edition (Java SE). It is the result of an effort Sun Microsystems began in 2006. The implementation is licensed under the GPL-2.0-only ...
project to develop major new language features for
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
10 and beyond. The project was announced in July 2014 and is an experimental effort by
Oracle
An oracle is a person or agency considered to provide wise and insightful counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. As such, it is a form of divination.
Description
The wor ...
, led by engineer
Brian Goetz.
Planned features
Valhalla is incubating Java language features and enhancements in these areas:
*
Value Types; highly-efficient small 'objects' without inheritance.
*
Generic Specialization;
List
for example.
*
Reified Generics; retaining actual type at runtime.
* improved '
volatile' support.
These features will require both syntax and VM-level changes.
Project activity
The project is organized on the OpenJDK 'Project Valhalla' mailing list. Project Valhalla has begun in the experimental stages, with an inaugural announcement & early draft initial proposals.
Published as of January 2022:
Project Valhalla announcement
Experimental OpenJDK prototypes can also be built from the Mercurial repositories. These are starting to incorporate many specialization features. Note that these are Gnu Make/ C++ sources, and building the OpenJDK requires technical expertise. Se
for details.
Project Valhalla OpenJDK source repositories
Technical benefits and implications
Memory access performance and the efficiency of 'boxed' value access are a major area to be addressed by these features. 'Value Type' features and 'Generic specialization' (when applied to lists or collections) reduce memory usage, but more importantly avoid pointer indirection which typically causes a cache miss.
Instead of a list or array of object references, pointing to data values scattered throughout memory, Project Valhalla enhancements will enable list or array values to potentially be laid out linearly—without indirection—as a consecutive block of memory.
Value Types are envisaged as "Codes like a class, works like an int!"
[{{cite web, last1=Rose, first1=John, last2=Goetz, first2=Brian, last3=Steele, first3=Guy, title=State of the Values, url=http://cr.openjdk.java.net/~jrose/values/values-0.html, publisher=OpenJDK, accessdate=12 August 2014] Synchronization and inheritance would be excluded for Value Types. These would no longer require object identity and associated memory/ pointer overheads, though would be able to assume a 'boxed' form for compatibility.
See also
*
Generics in Java
Generics are a facility of generic programming that were added to the Java programming language in 2004 within version J2SE 5.0. They were designed to extend Java's type system to allow "a type or method to operate on objects of various types while ...
*
Generic programming
Generic programming is a style of computer programming in which algorithms are written in terms of types ''to-be-specified-later'' that are then ''instantiated'' when needed for specific types provided as parameters. This approach, pioneered b ...
*
Value type In computer programming, data types can be divided into two categories: value types (or by-value types) and reference types (or by-reference types). Value types are completely represented by their meaning, while reference types are references to ano ...
References
External links
Java incubator to explore technologies for Java 10 and beyond - JavaWorldValue Types & List coming for Java 10? - LiterateJava.comOpenJDK - Project Valhalla
Java (programming language)