RFR: 8264842: IGV: different nodes sharing idx are treated as equal

Roberto Castañeda Lozano rcastanedalo at openjdk.java.net
Wed Apr 21 11:42:37 UTC 2021


On Tue, 20 Apr 2021 20:33:25 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

> This change replaces `Node::_idx` with a dedicated `Node::_igv_idx` as the internal node identifier for IGV. `_igv_idx` is unique across all phases in a compilation, which prevents IGV from wrongly treating unrelated nodes as if they were the same.`_igv_idx` is proposed instead of `Node::_debug_idx`, which is also unique across phases, for stability (the `_debug_idx` identifiers of a compilation are affected by the entire compilation history) and flexibility (future enhancements such as [JDK-8265587](https://bugs.openjdk.java.net/browse/JDK-8265587) require altering the node identifier in IGV-specific ways).
> 
> The following figure illustrates the effect of using `_igv_idx` instead of `_idx` as an internal node identifier. Using  `_idx` (left), node 54 is wrongly treated as created in two different phases (two green circles in the graph snapshot view), whereas using `_igv_idx` (right), node 54 is shown as created once, as expected:
> 
> ![before-after-fix](https://user-images.githubusercontent.com/8792647/115462349-d624e380-a22a-11eb-8d29-810a5ccbd09c.png)
> 
> At the IGV user interface level, this change encapsulates the internal node identifier by showing a "short node text" (configurable from `Tools -> Options`, defaulting to `[idx] [name]`) in all places where the internal identifier was exposed before: edge tooltips, slot tooltips, and the node search results. The code in [ViewPanel.form](https://github.com/openjdk/jdk/compare/master...robcasloz:JDK-8264842?expand=1#diff-9b4fd66fc1b7a93a40abcec79b8825db44bdef62f13fede745238c3b87a2ab90) and [ViewPanel.java](https://github.com/openjdk/jdk/compare/master...robcasloz:JDK-8264842?expand=1#diff-c8cfda144359ba8b317fd0d02988dc0798418dcd211eb5eb91c3ed94567684d3) is generated by NetBeans 12.3 by editing ViewPanel.java in "Design" mode.
> 
> #### Testing
> 
> - Regression-tested HotSpot changes on hs-tier1-3, windows-x64, linux-x64, linux-aarch64, and macosx-x64 (both release and debug).
> - Tested HotSpot graph generation and IGV graph loading and scheduling on tens of thousands of graphs by running `java -Xcomp -XX:-TieredCompilation -XX:PrintIdealGraphLevel=4 ...` on an instrumented IGV. Loading and scheduling are useful graph well-formedness tests, as they tend to fail for incorrect graphs, e.g. with repeated node identifiers.
> - Tested manually, for a few graphs, that nodes are treated as created exactly once by IGV (by selecting single nodes and checking that a single green circle appears in the graph snapshot view, as in the right screenshot above).
> - Tested manually that the new `Short Node Text` field in `Tools -> Options` is displayed and stored correctly, and that it is honored by edge tooltips, slot tooltips, and node search results (on Linux and Windows, for JDK 8, 11, and 15).

This change has a side benefit: nodes that are renumbered by C2 (by calling `Node::set_idx()`) keep the same internal `Node::_igv_idx` value, and get treated as if they were the same node by IGV. This is illustrated in the following screenshot, where the selection of a graph subset is kept between "Incremental Boxing Inline" and "Before beautify loops" despite all nodes in the selection being renumbered (by `PhaseRenumberLive::PhaseRenumberLive()`):

![before-after-renumbering](https://user-images.githubusercontent.com/8792647/115546708-a36c0100-a2a5-11eb-88bc-1f26c5029df3.png)

Preserving node equivalence in more complex transformations (matching) is proposed in a separate RFE ([JDK-8265587](https://bugs.openjdk.java.net/browse/JDK-8265587)).

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

PR: https://git.openjdk.java.net/jdk/pull/3593


More information about the hotspot-compiler-dev mailing list