RFR: 8370441: Remove unnecessary/confusing null check in Verifier::verify()
David Holmes
dholmes at openjdk.org
Tue Jan 20 11:39:38 UTC 2026
On Tue, 20 Jan 2026 09:33:11 GMT, Paul Hübner <phubner at openjdk.org> wrote:
> [JDK-8059924](https://bugs.openjdk.org/browse/JDK-8059924) introduced a nullcheck for a klass' Java mirror which runs during verification. However, in the modern VM, during verification time, the mirror is guaranteed to exist making the check unnecessary and misleading when reading the code. While implementing [JDK-8366488](https://bugs.openjdk.org/browse/JDK-8366488) it caused for quite some confusion. With this PR it is my intention to make sure that nobody gets side-tracked by this impossible condition.
>
> For an insight into previous discussion on this topic, please see the associated JBS issue.
>
> Testing: tiers 1-5 on Linux x64, AArch64, macOS x64, AArch64, Windows x64.
Changes requested by dholmes (Reviewer).
src/hotspot/share/classfile/verifier.cpp line 195:
> 193: if (klass->java_mirror() != nullptr) {
> 194: klass->java_mirror()->identity_hash();
> 195: }
You still need everything except the actual null check!
-------------
PR Review: https://git.openjdk.org/jdk/pull/29314#pullrequestreview-3681750220
PR Review Comment: https://git.openjdk.org/jdk/pull/29314#discussion_r2707977220
More information about the hotspot-runtime-dev
mailing list