RFR: JDK-8293480: IGV: Update Bytecode and ControlFlow Component immediately when opening a new graph

Roberto Castañeda Lozano rcastanedalo at openjdk.org
Thu Sep 8 11:55:45 UTC 2022


On Wed, 7 Sep 2022 09:36:02 GMT, Tobias Holenstein <tholenstein at openjdk.org> wrote:

> The `BytecodeViewTopComponent` and `ControlFlowTopComponent` represent information depending on what graph is open in `EditorTopComponent`. Previously, `BytecodeViewTopComponent` and `ControlFlowTopComponent` did not update its content immediately when a new graph from a different group is opened in `EditorTopComponent`. They also did not update when switching between two tabs of open graph. 
> 
> We missed to `fire()` a `diagramChangedEvent` in the constructor of `EditorTopComponent`. We also need to fire when `BytecodeViewTopComponent` and `ControlFlowTopComponent` are initially opened. 
> <img width="1291" alt="Update" src="https://user-images.githubusercontent.com/71546117/188860123-825a67fd-aab3-4500-8a47-8fa56eb9aeed.png">

Thanks for this UI improvement, Tobias, looks good to me! There is one more case where the Bytecode and Control Flow windows get out of sync: after removing all graphs and groups in the Outline, they still show the content of the graph that was last active:

![bytecode-and-cfg-leftovers](https://user-images.githubusercontent.com/8792647/189114719-770ba617-e94c-4492-a5ab-81047b8a0b98.png)

This problem existed before the changeset, so it might be addressed here or in a separate issue, whatever you think makes more sense.

src/utils/IdealGraphVisualizer/Bytecodes/src/main/java/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java line 176:

> 174:         SwingUtilities.invokeLater(new Runnable() {
> 175:             public void run() {
> 176:                 final InputGraphProvider provider = LookupHistory.getLast(InputGraphProvider.class);

Suggestion: use a multi-line lambda for conciseness, like so:

        SwingUtilities.invokeLater(() -> {
                final InputGraphProvider provider = LookupHistory.getLast(InputGraphProvider.class);

src/utils/IdealGraphVisualizer/ControlFlow/src/main/java/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java line 142:

> 140:         SwingUtilities.invokeLater(new Runnable() {
> 141:             public void run() {
> 142:                 final InputGraphProvider provider = LookupHistory.getLast(InputGraphProvider.class);

Same suggestion as above.

src/utils/IdealGraphVisualizer/Coordinator/src/main/java/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java line 153:

> 151:         SwingUtilities.invokeLater(new Runnable() {
> 152:             public void run() {
> 153:                 final InputGraphProvider provider = LookupHistory.getLast(InputGraphProvider.class);

Same suggestion as above.

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

Marked as reviewed by rcastanedalo (Reviewer).

PR: https://git.openjdk.org/jdk/pull/10196


More information about the hotspot-compiler-dev mailing list