JDK 19: The features targeted for Java 19

A vector API and a Linux/RISC-V port are officially targeted features for Java 19, a non-LTS release of standard Java due in September.

JDK 19: The features targeted for Java 19

Java Development Kit 19, due this September, now has a second feature officially proposed to target it: A vector API to express vector computations, which would undergo a fourth incubation in the next Java release. The other proposed feature is a port of the JDK to the open source Linux/RISC-V instruction set architecture (ISA).

JDK 19, or simply Java 19, potentially could host a vast number of features, ranging from universal generics to value objects, according to plans under way for enhancing Java. But so far, the vector API and the RISC-V port are the only officially proposed features to target JDK 19. JDK 19 would follow JDK 18, which arrived March 22. Standard Java is on a six-month release cadence.

The OpenJDK developers have published an official release schedule for JDK 19, which has it arriving September 20 as a production release, preceded by rampdown phases June 9 and July 21, and release candidates to be published August 11 and August 25.

The vector API would express vector computations that reliably compile at runtime to optimal vector instructions on supported CPU architectures. Developers using the API gain a way to write complex vector algorithms in Java, using the HotSpot auto-vectorizer but with a user model that makes vectorizations more predictable and robust. The vector API previously was incubated into JDK 16, JDK 17, and JDK 19.

Improvements to the API proposed for JDK 19 include enhancements to load and store vectors to and from MemorySegments as defined by the foreign function and memory API preview. JDK 19 would also add two cross-lane vector operations, compress and expand, together with a complementary vector mask compress operation. The compress vector operation maps lanes of a source vector, selected by a mask, to a destination vector in lane order while the expand operation does the inverse. The compress operation is useful in filtering query results.

In another addition to the vector API, bitwise integral lanewide operations would be expanded, including operations such counting the number of one bits, reversing the order of bits, and compressing and expanding bits. Goals of the API included being clear and concise, platform-agnostic, having reliable runtime and compilation performance on x64 and AArch64 architectures, and enabling “graceful” degradation, for situations in which a vector computation cannot be fully expressed at runtime as a sequence of vector operations.

With the Linux/RISC-V port, Java would gain support for a hardware instruction set that is already supported by a wide range of language toolchains. RISC-V actually is a family of related ISAs. The Linux/RISC-V port would only support the RV64GV configuration of RISC-V, a general purpose 64-bit ISA that includes vector instructions. The developers of Java may consider other RISC-V configurations in the future.

The port would support the following HotSpot VM options: the template interpreter, C1 (client) JIT compiler, C2 (server) JIT compiler, and all current mainline garbage collectors including ZGC and Shenandoah. The actual porting is nearly complete; the focus of the JDK Enhancement Proposal (JEP) is integration of the port into the JDK mainline repository.

Aside from the RISC-V port and the vector API, a preview of the foreign function and memory API, allowing Java programs to interoperate with code and data outside of the JVM runtime, also seems destined to being officially targeted to JDK 19, since the API proposal itself cites JDK 19 as a destination.

Like JDK 18, JDK 19 is due to be a short-term release, with only six months of top-level, Premier support.

The preceding release, JDK 17, was a Long Term Support (LTS) release, with several years of support. It arrived September 14, 2021.

Paul Krill is an editor at large at InfoWorld, whose coverage focuses on application development.

Copyright © 2022 IDG Communications, Inc.