RFR: 8286179: Node::find(int) should not traverse from new to old nodes

Emanuel Peter duke at openjdk.java.net
Fri May 6 08:32:20 UTC 2022


**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.
[running sanity tests to see it doesn't break something]

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

Commit messages:
 - 8286179: Node::find(int) should not traverse from new to old nodes

Changes: https://git.openjdk.java.net/jdk/pull/8567/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8567&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8286179
  Stats: 34 lines in 1 file changed: 24 ins; 7 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8567.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8567/head:pull/8567

PR: https://git.openjdk.java.net/jdk/pull/8567


More information about the hotspot-compiler-dev mailing list