RFR: 8286179: Node::find(int) should not traverse from new to old nodes [v3]
limck599
duke at openjdk.java.net
Mon May 9 14:40:02 UTC 2022
On Mon, 9 May 2022 14:11:33 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.
>> [running sanity tests to see it doesn't break something]
>
> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
>
> converted nullptr asserts in nullptr returns
Marked as reviewed by limck599 at github.com (no known OpenJDK username).
-------------
PR: https://git.openjdk.java.net/jdk/pull/8567
More information about the hotspot-compiler-dev
mailing list