Skip to content
Permalink
Browse files
8263248: IGV: accept graphs without node categories
If the input graph does not contain node category information, emit a warning
message and proceed loading the graph, instead of failing.

Reviewed-by: neliasso, chagedorn, thartmann
  • Loading branch information
Roberto Castañeda Lozano committed Mar 11, 2021
1 parent a9b4f03 commit 273f8bdf5fe14e65e40d3d908f58dd682bb472ed
@@ -22,6 +22,14 @@
<specification-version>1.0</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>8.14.1</specification-version>
</run-dependency>
</dependency>
</module-dependencies>
<public-packages/>
</data>
@@ -30,6 +30,7 @@
import com.sun.hotspot.igv.data.InputNode;
import com.sun.hotspot.igv.data.services.Scheduler;
import java.util.*;
import org.openide.ErrorManager;

/**
*
@@ -213,6 +214,12 @@ private String getBlockName(InputNode n) {
inputNodeToNode = new HashMap<>(graph.getNodes().size());

this.graph = graph;
if (!hasCategoryInformation()) {
ErrorManager.getDefault().log(ErrorManager.WARNING,
"Cannot find node category information in the input graph. " +
"The control-flow graph will not be approximated.");
return null;
}
buildUpGraph();
markCFGNodes();
connectOrphansAndWidows();
@@ -589,6 +596,15 @@ private Node findRoot() {
}
}

public boolean hasCategoryInformation() {
for (InputNode n : graph.getNodes()) {
if (n.getProperties().get("category") == null) {
return false;
}
}
return true;
}

public void buildUpGraph() {

for (InputNode n : graph.getNodes()) {
@@ -640,9 +656,6 @@ public void buildUpGraph() {
public void markCFGNodes() {
for (Node n : nodes) {
String category = n.inputNode.getProperties().get("category");
assert category != null :
"Node category not found, please use input from a compatible " +
"compiler version";
if (category.equals("control") || category.equals("mixed")) {
// Example: If, IfTrue, CallStaticJava.
n.isCFG = true;

1 comment on commit 273f8bd

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 273f8bd Mar 11, 2021

Please sign in to comment.