News and views from members of the Java team at Oracle
The OpenJDK Quality Group promotes the testing of FOSS projects with OpenJDK early-access builds as a way to improve the overall quality of the release. This heads-up is part of a Quality Outreach update sent to the projects involved. To learn more about the program and how to join, please check the Quality Outreach wiki page.
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.
The -UseCompressedClassPointers rarely provides any tangible benefit to Java users. Any historical connection with the -UseCompressedOops have long since been removed, and the net result of -UseCompressedClassPointers is simply increased memory overhead.
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).