changeset 17352:3457f147a24f

made selectability of using generated node functionality more fine grained
author Doug Simon <doug.simon@oracle.com>
date Mon, 06 Oct 2014 17:51:34 +0200
parents ea7b8c7a6e5c
children 825b349a55f9
files graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java
diffstat 2 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Mon Oct 06 17:32:55 2014 +0200
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Mon Oct 06 17:51:34 2014 +0200
@@ -107,7 +107,7 @@
 
         @Override
         public int hashCode() {
-            return Node.USE_GENERATED_NODES ? node.valueNumberLeaf() : node.getNodeClass().valueNumber(node);
+            return Node.USE_GENERATED_VALUE_NUMBER ? node.valueNumberLeaf() : node.getNodeClass().valueNumber(node);
         }
 
         @Override
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Mon Oct 06 17:32:55 2014 +0200
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Mon Oct 06 17:51:34 2014 +0200
@@ -59,8 +59,13 @@
 @NodeInfo
 public abstract class Node implements Cloneable, Formattable {
 
-    public final static boolean USE_GENERATED_NODES = Boolean.parseBoolean(System.getProperty("graal.useGeneratedNodes", "true"));
-    public final static boolean USE_UNSAFE_TO_CLONE = Boolean.parseBoolean(System.getProperty("graal.useUnsafeToClone", "true"));
+    public final static boolean USE_GENERATED_VALUE_NUMBER = Boolean.parseBoolean(System.getProperty("graal.node.useGeneratedValueNumber", "true"));
+
+    public final static boolean USE_GENERATED_VALUE_EQUALS = Boolean.parseBoolean(System.getProperty("graal.node.useGeneratedValueEquals", "false"));
+
+    public final static boolean USE_UNSAFE_TO_CLONE = Boolean.parseBoolean(System.getProperty("graal.node.useUnsafeToClone", "true"));
+
+    public final static boolean USE_GENERATED_NODES = USE_GENERATED_VALUE_NUMBER || USE_GENERATED_VALUE_EQUALS;
 
     static final int DELETED_ID_START = -1000000000;
     static final int INITIAL_ID = -1;
@@ -1032,14 +1037,17 @@
     }
 
     /**
-     * If this node is a {@linkplain NodeClass#isLeafNode() leaf} node, returns a hash for this node
-     * based on its {@linkplain NodeClass#getData() data} fields otherwise return 0.
+     * Gets a hash for this {@linkplain NodeClass#valueNumberable() value numberable}
+     * {@linkplain NodeClass#isLeafNode() leaf} node based on its {@linkplain NodeClass#getData()
+     * data} fields.
+     *
+     * This method must only be called if {@link #USE_GENERATED_VALUE_NUMBER} is true and this is a
+     * value numberable leaf node.
      *
      * Overridden by a method generated for leaf nodes.
      */
     public int valueNumberLeaf() {
-        assert !getNodeClass().isLeafNode();
-        return 0;
+        throw new GraalInternalError("Node is not a value numberable leaf", this);
     }
 
     /**
@@ -1062,6 +1070,6 @@
      * @return true if the data fields of this object and {@code other} are equal
      */
     public boolean valueEquals(Node other) {
-        return USE_GENERATED_NODES ? dataEquals(other) : getNodeClass().dataEquals(this, other);
+        return USE_GENERATED_VALUE_EQUALS ? dataEquals(other) : getNodeClass().dataEquals(this, other);
     }
 }