RFR: 8367298: ZGC: Enhance zaddress type system's assert messages [v2]

Stefan Karlsson stefank at openjdk.org
Thu Sep 11 06:13:21 UTC 2025


On Thu, 11 Sep 2025 05:18:14 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

>> ZGC uses a family of strongly type integral types to test and verify invariants for addresses, offset, indices and colored pointers within the heap. It is usually the first place we hit an assert if something goes wrong, and looking at the actual value is often enough to identify if it is memory corruption, a broken color invariant or a mistake in the use of the type system.
>> 
>> Unfortunately not all asserts print the value in the assert message, requiring more extensive investigation to even identify the nature of the problem.
>> 
>> I propose we enhance all our zaddress assert printing to always include the invariant breaking value.
>> 
>> _While I chose to print the max values in the assert message of the offset and indices checks, I did not print the colors in the zpointer checks. Both colors and the max values are easily available in the error report, so it would only really be a problem if a hs_err file is missing._ 
>> 
>> We should probably also see if we can enhance all the rest of our asserts in ZGC similarly. I do not think I have ever seen a failed invariant check and thought "Why are we printing the invariant breaking value", but often feel that it is unfortunate that we did not print the actual value.
>
> Axel Boldt-Christmas has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update src/hotspot/share/gc/z/zAddress.inline.hpp
>   
>   Co-authored-by: Stefan Karlsson <stefan.karlsson at oracle.com>

Marked as reviewed by stefank (Reviewer).

-------------

PR Review: https://git.openjdk.org/jdk/pull/27184#pullrequestreview-3209040274


More information about the hotspot-gc-dev mailing list