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

Roberto Castañeda Lozano rcastanedalo at openjdk.org
Wed Nov 12 16:04:49 UTC 2025


On Wed, 12 Nov 2025 14:17:45 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 eight additional commits since the last revision:
> 
>  - Review comments: fix coloring
>  - Review comments: general changes
>  - Review comments: minor IGV changes
>  - Review comment: update filter comment
>  - Review comments: restore removed line
>  - Review comments: small changes in idealGraphPrinter.cpp
>  - Review comments: add node to dumps, split phase, general readjustments
>  - Review comments: explicit null check

Thank you for addressing my suggestions, looks good now, modulo a couple of minor nits!

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

> 1333:     if (use->is_AddP()) {
> 1334:       reduce_phi_on_field_access(use, alloc_worklist);
> 1335:       _compile->print_method(PHASE_EA_AFTER_PHI_ADDPP_REDUCTION, 6, use);

Suggestion:

      _compile->print_method(PHASE_EA_AFTER_PHI_ADDP_REDUCTION, 6, use);

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

> 1338:       _compile->print_method(PHASE_EA_AFTER_PHI_CMP_REDUCTION, 6, use);
> 1339:     }
> 1340: 

Spurious new line?

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_ADDPP_REDUCTION,       "EA: 5. Phi -> AddPP Reduction") \

Suggestion:

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

src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/filters/showConnectionGraphNodesOnly.filter line 2:

> 1: // This filter shows only the nodes that are present in the escape analysis
> 2: // connection graph. This can be used to visualize the connection graph inside

Suggestion:

// connection graph. This can be used to approximate the connection graph inside

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_ADDPP_REDUCTION(      "EA: 5. Phi -> AddPP Reduction"),

Suggestion:

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

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

Marked as reviewed by rcastanedalo (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/28060#pullrequestreview-3454178920
PR Review Comment: https://git.openjdk.org/jdk/pull/28060#discussion_r2518886192
PR Review Comment: https://git.openjdk.org/jdk/pull/28060#discussion_r2518884324
PR Review Comment: https://git.openjdk.org/jdk/pull/28060#discussion_r2518862552
PR Review Comment: https://git.openjdk.org/jdk/pull/28060#discussion_r2518873582
PR Review Comment: https://git.openjdk.org/jdk/pull/28060#discussion_r2518864675


More information about the hotspot-compiler-dev mailing list