RFR: 8356761: IGV: dump escape analysis information [v3]

Christian Hagedorn chagedorn at openjdk.org
Thu Nov 13 08:45:38 UTC 2025


On Wed, 12 Nov 2025 16:23:27 GMT, Anton Seoane Ampudia <aseoane at openjdk.org> wrote:

>> This PR introduces new IGV dumps, property fields and filters related to escape analysis information.
>> 
>> The C2 escape analysis algorithm is carried out in six primary steps, of which many have interesting sub-steps (e.g. `split_unique_types`) or present an iterative nature where access to intermediate results can aid debugging and analysis. Additionally, escape analysis relies on an "intermediate structure" called the _connection graph_, which is also particularly valuable for deeper investigations.
>> 
>> With this changeset, escape analysis information is now dumped at key points throughout the algorithm, with a degree of granularity (from only the basic steps to in-detail iterative dumping). The dumps include several property fields, such as:
>> 
>> - Node escape “level”.
>> - Scalar replaceability.
>> - Node type within the connection graph (per [C2 Escape Analysis connection graph](https://wiki.openjdk.org/display/HotSpot/EscapeAnalysis)).
>> 
>> This is achieved by passing the `ConnectionGraph` in use to the `IdealGraphPrinter` during escape analysis, so that these properties can be dumped. After escape analysis, remaining interesting information that is left until macro elimination (and consequent elimination of non-escaping, replaceable allocations) is also dumped.
>> 
>> Additionally, two filters are provided: one for displaying the connection node type in the IGV node box, and another one for color-scaling nodes based on their escaping/scalar status.
>> 
>> **Testing:** passes tiers 1-3, manual testing in IGV
>
> Anton Seoane Ampudia has updated the pull request incrementally with three additional commits since the last revision:
> 
>  - Review comments: remove spurious new line
>  - Review comments: update header
>    
>    Co-authored-by: Roberto Castañeda Lozano <robcasloz at users.noreply.github.com>
>  - Review comments: AddP misspell
>    
>    Co-authored-by: Roberto Castañeda Lozano <robcasloz at users.noreply.github.com>

Nice work! That could indeed be helpful when studying/debugging EA related issues. I have some minor code comments and two general comments but otherwise, looks good to me, too.

Two things I've noticed:
- When I tried to enable the "Color by escape analysis state" filter, I was confused because colors were not changing. I then found out that I need to disable the "Color by category" filter first. My guess was that it's because the new filter appears above the "Color by category" filter:

<img width="235" height="42" alt="Image" src="https://github.com/user-attachments/assets/d934f2ed-e17e-4c26-8fd4-247814d24ac7" />

And indeed: Creating the same filter further down and then enabling both will result in the later one overriding the earlier one. Additional benefit: The non-colored nodes by "Color by escape analysis state" are still colored by the "Color by category" which could be helpful (if not, one can still disable the category coloring).
- All the new filters appear at the top. But I would not consider them the most important one and thus, I would suggest to move them all further down in the list.

src/hotspot/share/opto/escape.cpp line 2515:

> 2513: bool ConnectionGraph::find_non_escaped_objects(GrowableArray<PointsToNode*>& ptnodes_worklist,
> 2514:                                                GrowableArray<JavaObjectNode*>& non_escaped_allocs_worklist,
> 2515:                                                bool verify) {

`verify` suggests to actually do some verification. But it seems like it's only a toggle for dumping a graph. Could we rename it to `dump_for_igv` or something like that?

src/hotspot/share/opto/idealGraphPrinter.cpp line 759:

> 757:     }
> 758: 
> 759:     if (_congraph && node->_idx < _congraph->nodes_size()) {

We should explicitly check for null:

Suggestion:

    if (_congraph != nullptr && node->_idx < _congraph->nodes_size()) {

src/hotspot/share/opto/phasetype.hpp line 68:

> 66:   flags(EA_BEFORE_PHI_REDUCTION,            "EA: 5. Before Phi Reduction") \
> 67:   flags(EA_AFTER_PHI_CASTPP_REDUCTION,      "EA: 5. Phi -> CastPP Reduction") \
> 68:   flags(EA_AFTER_PHI_ADDP_REDUCTION,       "EA: 5. Phi -> AddP Reduction") \

Suggestion:

  flags(EA_AFTER_PHI_ADDP_REDUCTION,        "EA: 5. Phi -> AddP Reduction") \

test/hotspot/jtreg/compiler/lib/ir_framework/CompilePhase.java line 78:

> 76:     EA_BEFORE_PHI_REDUCTION(           "EA: 5. Before Phi Reduction"),
> 77:     EA_AFTER_PHI_CASTPP_REDUCTION(     "EA: 5. Phi -> CastPP Reduction"),
> 78:     EA_AFTER_PHI_ADDP_REDUCTION(      "EA: 5. Phi -> AddP Reduction"),

Suggestion:

    EA_AFTER_PHI_ADDP_REDUCTION(       "EA: 5. Phi -> AddP Reduction"),

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

PR Review: https://git.openjdk.org/jdk/pull/28060#pullrequestreview-3458280695
PR Review Comment: https://git.openjdk.org/jdk/pull/28060#discussion_r2522252769
PR Review Comment: https://git.openjdk.org/jdk/pull/28060#discussion_r2522234139
PR Review Comment: https://git.openjdk.org/jdk/pull/28060#discussion_r2522224752
PR Review Comment: https://git.openjdk.org/jdk/pull/28060#discussion_r2522226181


More information about the hotspot-compiler-dev mailing list