# HG changeset patch # User Tom Rodriguez # Date 1426812528 25200 # Node ID 8964b0b777b7b088ab874974ed953767139f2fbb # Parent 9bd252b8e3adc6c9a6a5471806912eb0ea03cd7d Reduce amount of work done by Node.verify by default diff -r 9bd252b8e3ad -r 8964b0b777b7 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java Thu Mar 19 17:25:16 2015 -0700 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java Thu Mar 19 17:48:48 2015 -0700 @@ -37,9 +37,11 @@ */ public class Graph { - static class Options { + public static class Options { @Option(help = "Verify graphs often during compilation when assertions are turned on", type = OptionType.Debug)// public static final OptionValue VerifyGraalGraphs = new OptionValue<>(true); + @Option(help = "Perform expensive verification of graph inputs, usages, successors and predecessors", type = OptionType.Debug)// + public static final OptionValue VerifyGraalGraphEdges = new OptionValue<>(false); } public final String name; diff -r 9bd252b8e3ad -r 8964b0b777b7 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Thu Mar 19 17:25:16 2015 -0700 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Thu Mar 19 17:48:48 2015 -0700 @@ -851,7 +851,6 @@ for (Node input : inputs()) { assertFalse(input.isDeleted(), "input was deleted"); assertTrue(input.isAlive(), "input is not alive yet, i.e., it was not yet added to the graph"); - assertTrue(input.usages().contains(this), "missing usage in input %s", input); } return true; } @@ -859,7 +858,22 @@ public boolean verify() { assertTrue(isAlive(), "cannot verify inactive nodes (id=%d)", id); assertTrue(graph() != null, "null graph"); + if (Options.VerifyGraalGraphEdges.getValue()) { + verifyEdges(); + } + return true; + } + + /** + * Perform expensive verification of inputs, usages, predecessors and successors. + * + * @return true + */ + public boolean verifyEdges() { verifyInputs(); + for (Node input : inputs()) { + assertTrue(input.usages().contains(this), "missing usage in input %s", input); + } for (Node successor : successors()) { assertTrue(successor.predecessor() == this, "missing predecessor in %s (actual: %s)", successor, successor.predecessor()); assertTrue(successor.graph() == graph(), "mismatching graph in successor %s", successor);