RFR: 8335257: Refactor code to create Initialized Assertion Predicates into separate class

Christian Hagedorn chagedorn at openjdk.org
Fri Jun 28 13:47:42 UTC 2024


On Fri, 28 Jun 2024 13:40:50 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

> This is the next patch for Assertion Predicates. It refactors the code to create an Initialized Assertion Predicate. Changes include:
> 
> - `clone_assertion_predicate_and_initialize()` currently does two things: Cloning a Template Assertion Predicate and creating an Initailized Assertion Predicate. I've split this method into two methods `clone_template_assertion_predicate()` and `create_initialized_assertion_predicate()`:
>   - `clone_template_assertion_predicate()`: Now only clones the template. I have not cleaned the code up further because I will soon replace the `If` node with a dedicated `TemplateAssertionPredicateNode`. 
>   - `create_initialized_assertion_predicate()`: I refactored the code for Initialized Assertion Predicate into a separate class `InitializedAssertionPredicate` which creates the complete Initialized Assertion Predicate `If` with a `HaltNode`. I could get rid of some of the arguments because they can be fetched inside the new class methods.
>   - Moved `assertion_predicate_has_loop_opaque_node()` asserts to both methods.
> - Renamed `AssertionPredicateType::Init_value` -> `AssertionPredicateType::InitValue` (same for last value).
> 
> Thanks,
> Christian

src/hotspot/share/opto/predicates.hpp line 204:

> 202:   None, // Not an Assertion Predicate
> 203:   InitValue,
> 204:   LastValue

Squeezed this in here for better code style.

src/hotspot/share/opto/predicates.hpp line 323:

> 321: };
> 322: 
> 323: // Class to represent a node being part of a Template Assertion Predicate Expression. Note that this is not an IR node.

Added a comment here to make it clearer - should have gone in earlier.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19940#discussion_r1658773819
PR Review Comment: https://git.openjdk.org/jdk/pull/19940#discussion_r1658774840


More information about the hotspot-compiler-dev mailing list