RFR: 8330386: Replace Opaque4Node of Initialized Assertion Predicate with new OpaqueInitializedAssertionPredicateNode

Christian Hagedorn chagedorn at openjdk.org
Fri Apr 26 06:50:59 UTC 2024


This patch replaces the `Opaque4Node` of the `If` for Initialized Assertion Predicates with a new `OpaqueInitializedAsseritonPredicateNode`. This helps to simplify pattern matching for predicate code and to distinguish from the two other uses of `Opaque4` nodes:
1. Template Assertion Predicate: The goal is to get rid of its `Opaque4Node` as well by using a dedicated `TemplateAssertionPredicateNode` for the `IfNode`.
2. Non-null-checks with instrinsics and unsafe accesses: This will eventually be the only use left. Once we get there, we should rename the node accordingly to `OpaqueNonNullCheck` or something like that.

I went through all the uses of `Opaque4` nodes and did the following:
- Could the `Opaque4` node be part of an Initialized Assertion Predicate?
  - No: Added an assert that we are not dealing with an Initialized Assertion Predicate.
  - Yes:
    - Yes **and only** for Initialized Assertion Predicates? Added an assert that we are only expecting an `OpaqueInitializedAsseritonPredicateNode` if appropriate.
    - Yes but could also be something else: Added case for `OpaqueInitializedAsseritonPredicateNode` next to the `Opaque4` case.
- Is this `Opaque4` node only used for Template Assertion Predicates?
  - Yes: Added assert with call to `assertion_predicate_has_loop_opaque_node()` to check that we find its `OpaqueLoop*Nodes`.
 - I've added test cases where I was not sure about whether an `Opaque4` node could be part of a Template, an Initialized Assertion Predicate or a non-null-check. This was a little tricky but I think it was still worth to prevent future bugs (even though most of these special cases are quite rare).

This is another patch split off from the full fix for Assertion Predicates.

Thanks,
Christian

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

Commit messages:
 - Add more comments and asserts
 - Add more tests
 - 8330386: Replace Opaque4Node of Initialized Assertion Predicate with new OpaqueInitializedAssertionPredicateNode

Changes: https://git.openjdk.org/jdk/pull/18951/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18951&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8330386
  Stats: 550 lines in 15 files changed: 485 ins; 7 del; 58 mod
  Patch: https://git.openjdk.org/jdk/pull/18951.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18951/head:pull/18951

PR: https://git.openjdk.org/jdk/pull/18951


More information about the hotspot-compiler-dev mailing list