RFR: 8346774: Use Predicate classes instead of Node classes
Emanuel Peter
epeter at openjdk.org
Mon Feb 3 09:44:53 UTC 2025
On Wed, 22 Jan 2025 13:10:37 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:
> This small cleanup PR replaces a lot of usages of `Node` pointers, to pass around either the head (i.e. `IfNode`) or the tail (i.e. a success projection) of predicates, with actual `Predicate` classes. This simplifies the usages, readability and the logical flow, and enables more simplifications in the future, especially once we replace Template Assertion Predicates with a dedicated node.
>
> I've also included some minor refactorings like adding `const` or fixing typos.
>
> There are no semantic changes involved. The return value optimization should take care to avoid a lot of copies when returning new objects from methods.
>
> Thanks,
> Christian
Looks reasonable, I have a few minor suggestions.
src/hotspot/share/opto/predicates.cpp line 187:
> 185: }
> 186:
> 187: // Clone this Template Assertion Predicate and replace the input of the OpaqueLoopInitNode with 'new_opaque_input'.
Looks like you now also create a `new OpaqueLoopInitNode`, so that is slightly inaccurate, right?
src/hotspot/share/opto/predicates.cpp line 813:
> 811: assertion_expression,
> 812: template_assertion_predicate->assertion_predicate_type());
> 813: return InitializedAssertionPredicate(success_proj);
Suggestion:
IfTrueNode* success_proj = create_control_nodes(new_control,
template_assertion_predicate->Opcode(),
assertion_expression,
template_assertion_predicate->assertion_predicate_type());
return InitializedAssertionPredicate(success_proj);
-------------
PR Review: https://git.openjdk.org/jdk/pull/23234#pullrequestreview-2589358721
PR Review Comment: https://git.openjdk.org/jdk/pull/23234#discussion_r1939059062
PR Review Comment: https://git.openjdk.org/jdk/pull/23234#discussion_r1939065861
More information about the hotspot-compiler-dev
mailing list