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
This commit is contained in:
parent
a9b4f033dd
commit
273f8bdf5f
src/utils/IdealGraphVisualizer/ServerCompiler
@ -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.InputGraph;
|
||||
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 @@ public class ServerCompilerScheduler implements Scheduler {
|
||||
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 @@ public class ServerCompilerScheduler implements Scheduler {
|
||||
}
|
||||
}
|
||||
|
||||
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 class ServerCompilerScheduler implements Scheduler {
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user