RFR: 8341328: Refactor initial Assertion Predicate creation into separate classes

Christian Hagedorn chagedorn at openjdk.org
Thu Oct 10 09:14:39 UTC 2024


This PR refactors the initial Assertion Predicate creation (i.e. when initially creating them, not when copy/copy-updating them from existing Template Assertion Predicates).

The patch includes the following changes:
- `PhaseIdealLoop::add_template_assertion_predicate()`, `add_range_check_elimination_assertion_predicate()`and the preparation code to call it, and `clone_template_assertion_predicate()` have similar code. I tried to share the common bits with new classes:
  -  `TemplateAssertionPredicateCreator`: Creates a new Template Assertion Predicate either with an UCT (done in Loop Predication) or a Halt node (done in Range Check Elimination).
  - `InitializedAssertionPredicateCreator`: Creates a new Initialized Assertion Predicate with a Halt Node. This is an existing class which provided a method to clone a Template Assertion Predicate expression and create a new Initialized Assertion Predicate with it. Now it's extended to create one without an existing template.
  - `AssertionPredicateIfCreator`: Used by both classes above and also by `clone_template_assertion_predicate()` (it clones the Assertion Predicate expression first and then just needs to create the `If`)
  - `AssertionPredicateExpressionCreator`: Create a new Assertion Predicate expression, either with an `Opaque4` (for Template Assertion Predicates) or an `OpaqueInitializedAssertionPredicate` (for Initialized Assertion Predicates).
- Some renaming to get more consistency (e.g. use `new_control` instead of `control` or `new_ctrl`)
- Adding new `AssertionPredicateType::FinalIv` which was missed to account for in [JDK-8335393](https://bugs.openjdk.org/browse/JDK-8335393) where a new Initialized Assertion Predicate was added for the final IV in Range Check Elimination for a special case when removing an empty main loop.

Thanks,
Christian

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

Commit messages:
 - 8341328: Refactor initial Assertion Predicate creation into separate classes

Changes: https://git.openjdk.org/jdk/pull/21446/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21446&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8341328
  Stats: 529 lines in 6 files changed: 302 ins; 118 del; 109 mod
  Patch: https://git.openjdk.org/jdk/pull/21446.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21446/head:pull/21446

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


More information about the hotspot-compiler-dev mailing list