changeset 17127:3db919d1c8d5

Add option to disable Graal graph verification (which takes very long for big graphs)
author Christian Wimmer <christian.wimmer@oracle.com>
date Tue, 16 Sep 2014 18:41:00 -0700
parents 7a0bff31df98
children 8ec6deb7d2eb
files graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java
diffstat 1 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Tue Sep 16 18:40:04 2014 -0700
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Tue Sep 16 18:41:00 2014 -0700
@@ -30,12 +30,18 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.Node.ValueNumberable;
 import com.oracle.graal.graph.iterators.*;
+import com.oracle.graal.options.*;
 
 /**
  * This class is a graph container, it contains the set of nodes that belong to this graph.
  */
 public class Graph {
 
+    static class Options {
+        @Option(help = "Verify graphs often during compilation when assertions are turned on")//
+        public static final OptionValue<Boolean> VerifyGraalGraphs = new OptionValue<>(true);
+    }
+
     public final String name;
 
     /**
@@ -566,7 +572,7 @@
      * mark}.
      */
     public NodeIterable<Node> getNewNodes(Mark mark) {
-        final int index = mark.getValue();
+        final int index = mark == null ? 0 : mark.getValue();
         return new NodeIterable<Node>() {
 
             @Override
@@ -752,17 +758,19 @@
     }
 
     public boolean verify() {
-        for (Node node : getNodes()) {
-            try {
+        if (Options.VerifyGraalGraphs.getValue()) {
+            for (Node node : getNodes()) {
                 try {
-                    assert node.verify();
-                } catch (AssertionError t) {
-                    throw new GraalInternalError(t);
-                } catch (RuntimeException t) {
-                    throw new GraalInternalError(t);
+                    try {
+                        assert node.verify();
+                    } catch (AssertionError t) {
+                        throw new GraalInternalError(t);
+                    } catch (RuntimeException t) {
+                        throw new GraalInternalError(t);
+                    }
+                } catch (GraalInternalError e) {
+                    throw GraalGraphInternalError.transformAndAddContext(e, node).addContext(this);
                 }
-            } catch (GraalInternalError e) {
-                throw GraalGraphInternalError.transformAndAddContext(e, node).addContext(this);
             }
         }
         return true;