Quality Outreach Heads-up - JDK 25: Proposal to Deprecate for Removal -UseCompressedClassPointers
Billy Korando on February 6, 2025
The OpenJDK Quality Group is promoting the testing of FOSS projects with OpenJDK builds as a way to improve the overall quality of the release. This heads-up is part of a regular communication sent to the projects involved. To learn more about the program, and how-to join, please check here.
Reducing Code and Test Complexity
Shortly after the adoption of 64-bit architectures the -XX:[-|+]UseCompressedClassPointers
and -XX:[-|+]UseCompressedOops
arguments were added to provide Java users the ability to enable using 32-bit references even when on a 64-bit architecture. This reduces memory overhead and help reduce cache misses. You can read more about this here.
Removing the -UseCompressedClassPointers
option would make +UseCompressedClassPointers
the default case and reduce the number of configurations that would need to be supported from three to two (+UseCompressedClassPointers
, +UseCompactObjectHeaders
). This would also significantly reduce code complexity as well as testing effort. Along with this, -UseCompressedClassPointers
does not work well in a 64-bit architecture as can be seen here, it’s suspected there are many more examples.
Minimal Benefit
The -UseCompressedClassPointers
rarely provides any tangible benefit to Java users. Any historical connection with the -UseCompresseedOops
have long since been removed, and the net result of -UseCompressedClassPointers
is simply increased memory overhead.
Reasons to Keep -UseCompressedClassPointers
There are currently two reasons to continue supporting -UseCompressedClassPointers
:
-UseCompressedClassPointers
works well in a 32-bit operating systems. However support for 32-bit operating systems is on its way out with JEP 479: Remove the Windows 32-bit x86 Port and JEP 501: Deprecate the 32-bit x86 Port for Removal both part of the forthcoming JDK 24 release.- In cases where more than 5 million classes are loaded. However such cases are rare, likely the result of programmer error, and would also mean loading likely tens of GBs of non-class data into metaspace as well.
For more on this topic see this thread in the hotspot-dev mailing list.
The engineers working on this are considering marking -UseCompressedClassPointers
as deprecated for removal in JDK 25 and are looking for feedback on the impact this could have. Please direct questions or feedback to the lilliput-dev mailing list (Registration needed).