changeset 19761:37969636e6f8

Merge.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 10 Mar 2015 15:52:16 +0100
parents dde8a89e7f92 (current diff) 39de568cbb02 (diff)
children 223e1d7b15b7
files
diffstat 3 files changed, 37 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java	Tue Mar 10 15:52:07 2015 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java	Tue Mar 10 15:52:16 2015 +0100
@@ -37,7 +37,9 @@
 
         @Override
         public boolean equals(Object other) {
-            return this == other;
+            // Due to de-serialization this object may exist multiple times. So we compare classes
+            // instead of the individual objects. (This anonymous class has always the same meaning)
+            return other != null && this.getClass() == other.getClass();
         }
     };
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardPhiNode.java	Tue Mar 10 15:52:07 2015 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardPhiNode.java	Tue Mar 10 15:52:16 2015 +0100
@@ -41,6 +41,11 @@
         this.values = new NodeInputList<>(this);
     }
 
+    public GuardPhiNode(AbstractMergeNode merge, ValueNode[] values) {
+        super(TYPE, StampFactory.forVoid(), merge);
+        this.values = new NodeInputList<>(this, values);
+    }
+
     @Override
     public NodeInputList<ValueNode> values() {
         return values;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java	Tue Mar 10 15:52:07 2015 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java	Tue Mar 10 15:52:16 2015 +0100
@@ -51,8 +51,25 @@
 
     private boolean canonicalizeReads = true;
     private boolean simplify = true;
+    private final CustomCanonicalizer customCanonicalizer;
+
+    public abstract static class CustomCanonicalizer {
+
+        public Node canonicalize(Node node) {
+            return node;
+        }
+
+        @SuppressWarnings("unused")
+        public void simplify(Node node, SimplifierTool tool) {
+        }
+    }
 
     public CanonicalizerPhase() {
+        this(null);
+    }
+
+    public CanonicalizerPhase(CustomCanonicalizer customCanonicalizer) {
+        this.customCanonicalizer = customCanonicalizer;
     }
 
     public void disableReadCanonicalization() {
@@ -227,6 +244,14 @@
         }
 
         public boolean tryCanonicalize(final Node node, NodeClass<?> nodeClass) {
+            if (customCanonicalizer != null) {
+                Node canonical = customCanonicalizer.canonicalize(node);
+                if (performReplacement(node, canonical)) {
+                    return true;
+                } else {
+                    customCanonicalizer.simplify(node, tool);
+                }
+            }
             if (nodeClass.isCanonicalizable()) {
                 METRIC_CANONICALIZATION_CONSIDERED_NODES.increment();
                 try (Scope s = Debug.scope("CanonicalizeNode", node)) {
@@ -397,4 +422,8 @@
             }
         }
     }
+
+    public boolean getCanonicalizeReads() {
+        return canonicalizeReads;
+    }
 }