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

Roberto Castañeda Lozano rcastanedalo at openjdk.java.net
Wed Apr 21 07:30:45 UTC 2021

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:


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).


Commit messages:
 - Update header
 - Fix spacing in tooltip text
 - Use custom IGV node identifier instead of Node::_idx
 - Encapsulate node identifiers

Changes: https://git.openjdk.java.net/jdk/pull/3593/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3593&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8264842
  Stats: 239 lines in 19 files changed: 132 ins; 57 del; 50 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3593.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3593/head:pull/3593

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

More information about the hotspot-compiler-dev mailing list