Skip to content

8264842: IGV: different nodes sharing idx are treated as equal #3593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

robcasloz
Copy link
Contributor

@robcasloz robcasloz commented Apr 20, 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 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

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 and ViewPanel.java 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).

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8264842: IGV: different nodes sharing idx are treated as equal

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3593/head:pull/3593
$ git checkout pull/3593

Update a local copy of the PR:
$ git checkout pull/3593
$ git pull https://git.openjdk.java.net/jdk pull/3593/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3593

View PR using the GUI difftool:
$ git pr show -t 3593

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3593.diff

Encapsulate node identifiers by never showing them directly to the user.
Instead, introduce a 'Short Node Text' property that dictates which node
properties are shown in edge tooltips, slot tooltips, and node search bar.
'Short Node Text' has default value '[idx] [name]', and can be configured in
Tools -> Options. This encapsulation enables decoupling the C2 node identifiers
shown to the user (property 'idx') and internal node identifiers.
@bridgekeeper
Copy link

bridgekeeper bot commented Apr 20, 2021

👋 Welcome back rcastanedalo! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Apr 20, 2021

@robcasloz The following labels will be automatically applied to this pull request:

  • build
  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added build build-dev@openjdk.org hotspot-compiler hotspot-compiler-dev@openjdk.org labels Apr 20, 2021
@robcasloz
Copy link
Contributor Author

/label remove build

@openjdk openjdk bot removed the build build-dev@openjdk.org label Apr 20, 2021
@openjdk
Copy link

openjdk bot commented Apr 20, 2021

@robcasloz
The build label was successfully removed.

@robcasloz robcasloz marked this pull request as ready for review April 21, 2021 07:24
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 21, 2021
@mlbridge
Copy link

mlbridge bot commented Apr 21, 2021

Webrevs

@robcasloz
Copy link
Contributor Author

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

Preserving node equivalence in more complex transformations (matching) is proposed in a separate RFE (JDK-8265587).

Copy link
Contributor

@veresov veresov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openjdk
Copy link

openjdk bot commented Apr 22, 2021

@robcasloz This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

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

Introduce IGV-specific node identifier and encapsulate it in IGV by showing a
configurable 'short node text' string instead.

Reviewed-by: iveresov, kvn

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 67 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 22, 2021
@robcasloz
Copy link
Contributor Author

Thanks for reviewing, Igor and Vladimir!

@robcasloz
Copy link
Contributor Author

/summary
Introduce IGV-specific node identifier and encapsulate it in IGV by showing a
configurable 'short node text' string instead.

@openjdk
Copy link

openjdk bot commented Apr 23, 2021

@robcasloz Setting summary to:

Introduce IGV-specific node identifier and encapsulate it in IGV by showing a
configurable 'short node text' string instead.

@robcasloz
Copy link
Contributor Author

/integrate

@openjdk openjdk bot closed this Apr 23, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 23, 2021
@openjdk
Copy link

openjdk bot commented Apr 23, 2021

@robcasloz Since your change was applied there have been 67 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

Pushed as commit b3a319c.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants