RFR: 8287647: VM debug support: find node by pattern in name or dump [v5]
Emanuel Peter
epeter at openjdk.java.net
Tue Jun 14 08:16:36 UTC 2022
> **Goal**
> Refactor `Node::find`, allow not just searching for `node->_idx`, but also matching for `node->Name()` and even `node->dump()`.
>
> **Proposal**
> Refactor `Node::find` into `visit_nodes`, which visits all nodes and calls a `callback` on them. This callback can be used to filter by `idx` (`find_node_by_idx`, `Node::find`, `find_node` etc.). It can also be used to match node names (`find_node_by_name`) and even node dump (`find_node_by_dump`).
>
> Thus, I present these additional functions:
> `Node* find_node_by_name(const char* name)`: find all nodes matching the `name` pattern.
> `Node* find_node_by_dump(const char* pattern)`: find all nodes matching the `pattern`.
> The nodes are sorted by node idx, and then dumped.
>
> Patterns can contain `*` characters to match any characters (eg. `Con*L` matches both `ConL` and `ConvI2L`)
>
> **Usecase**
> Find all `CastII` nodes. Find all `Loop` nodes. Use `find_node_by_name`.
>
> Find all all `CastII` nodes that depend on a rangecheck. Use `find_node_by_dump("CastII*range check dependency")`.
> Find all `Bool` nodes that perform a `[ne]` check. Use `find_node_by_dump("Bool*[ne]")`.
> Find all `Phi` nodes that are `tripcount`. Use `find_node_by_dump("Phi*tripcount")`.
>
> Find all `Load` nodes that are associated with line 301 in some file. Use `find_node_by_dump("Load*line 301")`.
>
> You can probably find more usecases yourself ;)
Emanuel Peter has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 14 additional commits since the last revision:
- remove duplicate node_idx_cmp after merge
- Merge branch 'master' into JDK-8287647
- adding resource marks, moving Unique_Mixed_Node_List to node.hpp
- fix header issues
- changes responding to review by Christian and Roberto
- style fixes, and implemented case insensitive strstr
- make matching case insensitive
- missing include
- ensure null termination
- guard against long pattern, and fix array/pointer issues
- ... and 4 more: https://git.openjdk.org/jdk/compare/b1999884...653a7cc3
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/8988/files
- new: https://git.openjdk.org/jdk/pull/8988/files/52dd9917..653a7cc3
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8988&range=04
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8988&range=03-04
Stats: 40004 lines in 1097 files changed: 30462 ins; 5792 del; 3750 mod
Patch: https://git.openjdk.org/jdk/pull/8988.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/8988/head:pull/8988
PR: https://git.openjdk.org/jdk/pull/8988
More information about the hotspot-compiler-dev
mailing list