Skip to content

Commit 8f59422

Browse files
committed
8285558: IGV: scheduling crashes on control-unreachable CFG nodes
Reviewed-by: kvn, chagedorn
1 parent 8a9aeff commit 8f59422

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/utils/IdealGraphVisualizer/ServerCompiler/src/main/java/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ private static class Node {
5353
public static final String WARNING_NOT_MARKED_WITH_BLOCK_START = "Region not marked with is_block_start";
5454
public static final String WARNING_CFG_AND_INPUT_TO_PHI = "CFG node is a phi input";
5555
public static final String WARNING_PHI_NON_DOMINATING_INPUTS = "Phi input that does not dominate the phi's input block";
56+
public static final String WARNING_CONTROL_UNREACHABLE_CFG = "Control-unreachable CFG node";
5657

5758
public InputNode inputNode;
5859
public Set<Node> succs = new HashSet<>();
@@ -327,20 +328,6 @@ public Collection<InputBlock> schedule(InputGraph graph) {
327328
schedulePinned();
328329
buildDominators();
329330
scheduleLatest();
330-
331-
InputBlock noBlock = null;
332-
for (InputNode n : graph.getNodes()) {
333-
if (graph.getBlock(n) == null) {
334-
if (noBlock == null) {
335-
noBlock = graph.addArtificialBlock();
336-
blocks.add(noBlock);
337-
}
338-
339-
graph.setBlock(n, noBlock);
340-
}
341-
assert graph.getBlock(n) != null;
342-
}
343-
344331
scheduleLocal();
345332
check();
346333
reportWarnings();
@@ -632,6 +619,12 @@ public void schedulePinned() {
632619
block = controlSuccs.get(ctrlIn).get(0).block;
633620
}
634621
}
622+
if (block == null) {
623+
// This can happen for blockless CFG nodes that are not
624+
// control-reachable from the root even after connecting orphans
625+
// and widows (e.g. in disconnected control cycles).
626+
continue;
627+
}
635628
n.block = block;
636629
block.addNode(n.inputNode.getId());
637630
}
@@ -890,6 +883,9 @@ public void check() {
890883
if (isRegion(n) && !n.isBlockStart) {
891884
n.addWarning(Node.WARNING_NOT_MARKED_WITH_BLOCK_START);
892885
}
886+
if (n.isCFG && n.block == null) {
887+
n.addWarning(Node.WARNING_CONTROL_UNREACHABLE_CFG);
888+
}
893889
if (!isPhi(n)) {
894890
continue;
895891
}

0 commit comments

Comments
 (0)