Overview
Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Explore the evolution and implementation challenges of heap flattening in Project Valhalla's JEP 401 through this 31-minute conference talk from the 2025 JVM Language Summit. Learn how the initial flattening approach in Project Valhalla has evolved from relying on four value type properties (lack of identity, immutability, null-freeness, and non-atomicity) to a more refined model where value class instances are defined as identity-less and mostly immutable. Discover how the removal of null-freeness as an inherent property and the exclusion of non-atomicity for the first Java release, combined with field inheritance through abstract value classes, created new JVM flattening challenges. Understand the multi-faceted nature of flattening problems, including the trade-offs between memory density improvements through object header removal and indirection pointer elimination versus higher access costs for maintaining nullability and atomicity guarantees. Examine how spatial locality benefits cache efficiency while complex encodings impact JVM code complexity and access costs. Analyze benchmark results showing significant performance boosts in flat arrays with C2 compiled code, the initially poor but ultimately beneficial field flattening performance when GC workload impact is measured, and the performance regression challenges faced by interpreter, runtime, and C1 components when handling flat values. Gain insights into the flattening policies and engineering decisions that balance memory efficiency, performance optimization, and startup time considerations in the JVM implementation of value classes.
Syllabus
Value Classes Heap Flattening - What to expect from JEP 401 #JVMLS
Taught by
Java