ELSEIF
Your brief EB
511 stories from 219 feeds 1271 clusters Refreshed 6 minutes ago next pull 06:16

LANGUAGES Signal 142

JDK 28 previews value classes where flattening depends on field mutability and size

Illustration only Photo by Kristian Strand on Unsplash

JEP 401 value classes are a preview feature in JDK 28, but their performance benefit from flattening depends on immutability and size constraints that not all code will satisfy.

WHY IT MATTERS

Engineers adopting value classes cannot assume they always improve performance over ordinary classes. The JVM must sometimes convert between flattened and reference representations when methods with different preferences interact, and mutable fields containing large values force reference layouts to prevent torn reads during data races.

Written by elseif from the cluster below · every claim links back to a source

The three things worth knowing

01

JEP 401 value classes are a preview feature in JDK 28 that give up identity to enable flattening and scalarization optimizations.

02

JEP 539 strict field initialization allows the JVM to use non-atomic flattened layouts for final fields, since they cannot be updated after initialization.

03

Mutable fields containing values too large for atomic flattened updates force the JVM to use reference layouts to guarantee tear-free assignment under the Java Memory Model.

THE CLUSTER

Same story, 1 feed.

ORDERED BY FIRST SEEN
johan-sjolen.github.io via Hacker News Value Classes Still Need Compiler Sympathy Open ↗