RFR: 8288897: Clean up node dump code

Emanuel Peter epeter at openjdk.org
Fri Jun 24 13:50:55 UTC 2022


On Fri, 24 Jun 2022 09:05:47 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> I recently did some work in the area of `Node::dump` and `Node::find`, see [JDK-8287647](https://bugs.openjdk.org/browse/JDK-8287647) and [JDK-8283775](https://bugs.openjdk.org/browse/JDK-8283775).
>> 
>> This change sets cleans up the code around, and tries to reduce code duplication.
>> 
>> Things I did:
>> - remove Node::related. It was added 7 years ago, with [JDK-8004073](https://bugs.openjdk.org/browse/JDK-8004073). However, it was not extended to many nodes, and hence it is incomplete, and nobody I know seems to use it.
>> - refactor `dump(int)` to use `dump_bfs` (reduce code duplication).
>> - redefine categories in `dump_bfs`, focusing on output types. Mixed type is now also control if it has control output, and memory if it has memory output, etc. Plus, a node is also in the control category if it `is_CFG`. This makes `dump_bfs` much more usable, to traverse control and memory flow.
>> - Other small cleanups, like replacing rarely used dump functions with dump, making removing dead code, make some functions private
>> - Adding `call from debugger` comment to VM functions that are useful in debugger
>
> src/hotspot/share/opto/node.cpp line 1658:
> 
>> 1656: }
>> 1657: 
>> 1658: void find_node_by_dump(Node* start, const char* pattern) {
> 
> Since we now only dump nodes, how about renaming this method to `dump_nodes_by_dump()` and only keep `find_node(s?)_by_dump()` to call it from the debugger? Same for the other changed `find*()` methods.

I did think about renaming it do `dump_...`. But then I also find it important that the name says that we do filter / search / find.

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

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


More information about the hotspot-compiler-dev mailing list