RFR: 8371419: IGV: Add view to visualise dominator tree and dominator information

Roberto Castañeda Lozano rcastanedalo at openjdk.org
Wed Nov 26 11:46:50 UTC 2025


On Wed, 19 Nov 2025 09:58:59 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

>> This change introduces a dominator tree view in IGV’s CFG panel, enabling users to toggle between the control flow graph and the dominator tree. This makes dominator relationships easier to inspect than the current stdout-based output (`-XX:+PrintDominators`).
>> 
>> ## Motivation
>> * Today, dominator information is difficult to access (e.g. via `-XX:+PrintDominators`, which is hard to read and correlate with the graph).
>> * IGV already computes dominators for some phases but does not visualize them.
>> * Comparing dominator trees across graphs/phases was not supported.
>>  
>> ## What’s New
>> 1. Toggle in the CFG view (toolbar button (<img width="34" height="30" alt="image" src="https://github.com/user-attachments/assets/d215d018-dbb6-4ef0-8129-2fab60999acf" />) to switch between:
>>    * Control Flow Graph (CFG)
>>    * Dominator Tree
>> 2. Dominator edge coloring to indicate provenance:
>>    * Blue: dominator info provided by C2 (from GCM phase onward for now, a follow RFE will handle loop optimization dominator information)
>>    * Red: dominator info computed by IGV (pre-GCM)
>> 3. Graph comparison enhancements:
>>    * Compare dominator trees between graphs (new)
>>    * Compare CFG differences between graphs (previously missing)
>> 4. Node annotations:
>>    * `idom`: immediate dominator
>>    * `dom_depth`: dominator depth
>>    * `block`: numeric block ID for all nodes in a block
>>  
>> The resulting main view looks like this:
>> <img width="1415" height="1051" alt="Screenshot 2025-11-13 at 15 04 12" src="https://github.com/user-attachments/assets/2aedca80-45d6-40ba-8726-50d5b8fd68df" />
>> 
>> ## Testing
>> * Tier 1-3
>> * Manual testing in IGV
>
> Thank you for this work Damon, this looks very useful! I have a few high-level comments:
> 
> - I agree with @dlunde's comment, as a user I think the dominator tree should be a separate view and not a "mode" of the CFG view. If you do that, please do not forget to extend the combo box in the Options window with the option to select the dominator tree view by default.
> - Would it be possible to avoid dumping dominator information as node properties, to reduce the size of the graph dump? The block property information that you already dump should be enough for your purposes, no? If you want to show dominator information as node properties, you can instead propagate the information from blocks to their nodes in `ServerCompilerPreProcessor::preProcess()`, similarly to how it is done for liveness information.
> - I like the idea of distinguishing visually when control-flow information originates from HotSpot and when it is approximated by IGV, currently we just rely on the user implicitly knowing this, which is confusing and error-prone. However, there is an issue with your proposal: once the graph is saved into a file (from IGV) the information is lost, and when the graph is re-opened all dominator trees are shown as originating from HotSpot (blue edges). If we want to do this, I think we need to explicitly reflect in the serialized XML format whether control-flow information is approximated or not. Further, the representation of HotSpot/IGV origin should be consistent between the CFG and dominator tree views. In short, I think this is a great and much-needed IGV feature, but one that would require substantial work to get right, so my suggestion would be leaving it out of the scope of this RFE and creating a separate RFE just for it. What do you think?

> I'm not sure I understand what you mean @robcasloz: if there is a separate view for the dominator tree, there is no need for a dominator tree option.

I'm referring to the option to select a default view (`Default View`) when a graph is opened in the `Options` window, see screenshot below. The list of options will have to be extended so that the new dominator tree view can be chosen as well (unlikely choice perhaps, but it's good to list all of the views for completeness).

<img width="770" height="694" alt="options" src="https://github.com/user-attachments/assets/fbed3f9f-013b-4b2b-9be5-3b386810dd5b" />

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

PR Comment: https://git.openjdk.org/jdk/pull/28293#issuecomment-3580934230


More information about the hotspot-compiler-dev mailing list