Integrated: 8286179: Node::find(int) should not traverse from new to old nodes
Emanuel Peter
duke at openjdk.java.net
Tue May 10 08:07:56 UTC 2022
On Fri, 6 May 2022 08:24:26 GMT, Emanuel Peter <duke at openjdk.java.net> wrote:
> **Problem:**
> `Node::find` traverses input and output edges of nodes during its BFS, and searches for nodes with a specific `idx`.
> However, if `ASSERT` is on, it also traverses `debug_orig`. This not only seems unnecessary. But Mach nodes (after matching) point back to the old IR nodes. This means we traverse from the new graph to the old graph, and potentially find multiple nodes matching the `idx`. Only the last found will be returned, sometimes this happens to be the new node, sometimes the old node. This is inconsistent and can be quite annoying during debugging.
>
> **Implemented Solution:**
> 1. Remove traversing `debug_orig`.
> 2. Instead, add debug only functions `old_root`, which finds the old root if it exists. Question: I now put a warning in if the `old_root` cannot be found. I think this is helpful for in the debugger. I could make it an assert if that is preferred.
> 3. `find_node` and `find_ctrl` only search in new nodes now (start BFS at new root).
> 4. Added `find_old_node` and `find_old_ctrl`, which search in new nodes (start BFS at old root).
>
> I hope this improves your debugging experience.
> Ran larger tests to see that `find_node` did not break anything, reran sanity test after implementing suggestions from reviewers.
This pull request has now been integrated.
Changeset: d478958e
Author: Emanuel Peter <emanuel.peter at oracle.com>
Committer: Christian Hagedorn <chagedorn at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/d478958eb2153199800689232d1d72e7f1ad7354
Stats: 36 lines in 1 file changed: 26 ins; 7 del; 3 mod
8286179: Node::find(int) should not traverse from new to old nodes
Reviewed-by: kvn, chagedorn, thartmann
-------------
PR: https://git.openjdk.java.net/jdk/pull/8567
More information about the hotspot-compiler-dev
mailing list