RFR: 8354520: IGV: dump contextual information

Manuel Hässig duke at openjdk.org
Wed Apr 23 11:43:44 UTC 2025


On Thu, 17 Apr 2025 13:05:03 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

> This changeset extends the IGV graph dumps with additional properties that ease tracing the dumps back to the context in which they were produced. The changeset dumps, for every compilation, the following additional properties:
> 
> - JVM arguments
> - platform information
> - JVM version information
> - date and time
> - process ID
> - (compiler) thread ID
> 
> ![compilation-properties](https://github.com/user-attachments/assets/8ddc8fb9-c348-4761-8e19-c70633a1b59f)
> 
> Additionally, the changeset produce and dumps the C2 stack trace from which each graph is dumped:
> 
> ![c2-stack-trace](https://github.com/user-attachments/assets/085547ee-b0b3-4a38-86f1-9df79cf1cc01)
> 
> This should be particularly useful in an interactive context, where the user steps through C2 code using a debugger and dumps graphs at different points. To produce a stack trace in this context, the usual debugger-entry C2 functions (`igv_print`, `igv_append`, `Node::dump_bfs`, ...) are extended with extra arguments to specify the stack handling registers (stack pointer, frame pointer, and program counter):
> 
> ![c2-stack-trace-from-gdb](https://github.com/user-attachments/assets/29de2964-ee2d-4f5f-bcf7-d81e1bc6c8a6)
> 
> The inconvenience of manually specifying the stack handling registers can be addressed by hiding them in debugger user-defined commands, e.g.:
> 
> 
> define igv
>   p igv_print(true, $sp, $fp, $pc)
> end
> 
> define igv_node
>   p find_node($arg0)->dump_bfs(0, 0, "!", $sp, $fp, $pc)
> end
> 
> 
> Thanks to @TobiHartmann for providing useful feedback!
> 
> #### Testing
> 
>  - tier1 (windows-x64, linux-x64, linux-aarch64, macosx-x64, and macosx-aarch64; release and debug mode).
>  - Tested interactive usage manually via `gdb` and `rr` on linux-x64.
>  - Tested automatically that dumping thousands of graphs does not trigger any assertion failure.

Thank you for working on this and continually improving IGV!

I found two typos, but otherwise it looks good. I also tested printing to IGV from `rr` and the new features work as advertised.

Perhaps you could update the `dump_bfs` help with a comment about the new arguments?

src/utils/IdealGraphVisualizer/README.md line 57:

> 55: The JVM provides some entry functions to dump graphs from a debugger such as
> 56: `gdb` or `rr`, see the different variants of `igv_print` and `igv_append` in
> 57: `compile.cpp`. In combination with the IGV network interface, these functions

Suggestion:

[`compile.cpp`](src/hotspot/share/opto/compile.cpp). In combination with the
IGV network interface, these functions

src/utils/IdealGraphVisualizer/README.md line 79:

> 77: ```
> 78: 
> 79: Another way to dump graphs interactively is through the `Node::dump_dfs`

Suggestion:

Another way to dump graphs interactively is through the `Node::dump_bfs`

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

Marked as reviewed by mhaessig at github.com (no known OpenJDK username).

PR Review: https://git.openjdk.org/jdk/pull/24724#pullrequestreview-2786865298
PR Review Comment: https://git.openjdk.org/jdk/pull/24724#discussion_r2055786135
PR Review Comment: https://git.openjdk.org/jdk/pull/24724#discussion_r2055789155


More information about the hotspot-compiler-dev mailing list