RFR: 8344213: Cleanup OpaqueLoop*Node verification code for Assertion Predicates [v4]

Christian Hagedorn chagedorn at openjdk.org
Mon Nov 25 13:55:53 UTC 2024


> This patch cleans up the `OpaqueLoop*Node` verification code that is called with `PhaseIdeaLoop::assertion_predicate_has_loop_opaque_node()`.
> 
> There are some places where the verification code is
> - missing
> - called twice in row with different methods
> - unnecessarily called
> 
> This patch cleans this up and moves the verification code inside the `TemplateAssertionPredicate` and the `InitializedAssertionPredicate` class.
> 
> #### Details of this Patch
> - Doing a simpler BFS similar to what `ReplaceOpaqueStrideInput::replace()` is doing.
> - Noticed that the new code looks very similar, so I decided to create a dedicated `DataNodeBFS` class which could be reused again in the future to perform a BFS on data nodes.
>   - One can implement the new `BFSActions` interface to define
>     - Whether a node's input should be further visited.
>     - Whether a node is a target node for this BFS.
>     - What action that should be performed with the target node.
>   - Updated `ReplaceOpaqueStrideInput` to use the new `DataNodeBFS/BFSActions` classes.
>   - Implemented a new `OpaqueLoopNodesVerifier` class using `DataNodeBFS/BFSActions` which does the `OpaqueLoop*Node` verification previously done with `assertion_predicate_has_loop_opaque_node()`:
>     - Verify Template Assertion Predicates:
>       - For init value: Only `OpaqueLoopInit`
>       - For last value: Both `OpaqueLoop*Nodes`
>     - Verify Initialized Assertion Predicates:
>       - No `OpaqueLoop*Nodes`
> 
> Thanks,
> Christian

Christian Hagedorn has updated the pull request incrementally with two additional commits since the last revision:

 - Fix local variable name
 - Revert "Generalize BFS"
   
   This reverts commit fbde591803ada158cacc11bc553e1b5061e59ae7.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/22136/files
  - new: https://git.openjdk.org/jdk/pull/22136/files/fbde5918..1c8af282

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=22136&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=22136&range=02-03

  Stats: 109 lines in 3 files changed: 15 ins; 84 del; 10 mod
  Patch: https://git.openjdk.org/jdk/pull/22136.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22136/head:pull/22136

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


More information about the hotspot-compiler-dev mailing list