RFR: 8367298: ZGC: Enhance zaddress type system's assert messages [v2]
Axel Boldt-Christmas
aboldtch at openjdk.org
Thu Sep 11 05:18:14 UTC 2025
> 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>
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/27184/files
- new: https://git.openjdk.org/jdk/pull/27184/files/45ea9f0b..e67ada3a
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=27184&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=27184&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/27184.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27184/head:pull/27184
PR: https://git.openjdk.org/jdk/pull/27184
More information about the hotspot-gc-dev
mailing list