changeset 17356:7ef8091e3542

ValuePosition: regenerate hashCode(), equals(), toString().
author Josef Eisl <josef.eisl@jku.at>
date Fri, 03 Oct 2014 15:38:39 +0200
parents e354b82355fc
children b1813910be78
files graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValuePosition.java
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValuePosition.java	Mon Oct 06 18:14:12 2014 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValuePosition.java	Fri Oct 03 15:38:39 2014 +0200
@@ -136,10 +136,11 @@
 
     @Override
     public String toString() {
-        if (outerPosition == ROOT_VALUE_POSITION) {
-            return values.getMode() + "(" + index + (subIndex < 0 ? "" : "/" + subIndex) + ")";
+        String str = "(" + index + (subIndex < 0 ? "" : "/" + subIndex) + ")";
+        if (isCompositePosition()) {
+            return outerPosition.toString() + "[" + str + "]";
         }
-        return outerPosition.toString() + "[" + values.getMode() + "(" + index + (subIndex < 0 ? "" : "/" + subIndex) + ")]";
+        return str;
     }
 
     @Override
@@ -147,9 +148,9 @@
         final int prime = 31;
         int result = 1;
         result = prime * result + index;
-        result = prime * result + ((values.getMode() == null) ? 0 : values.getMode().hashCode());
         result = prime * result + subIndex;
         result = prime * result + ((outerPosition == null) ? 0 : outerPosition.hashCode());
+        result = prime * result + ((values == null) ? 0 : values.hashCode());
         return result;
     }
 
@@ -168,9 +169,6 @@
         if (index != other.index) {
             return false;
         }
-        if (values.getMode() != other.values.getMode()) {
-            return false;
-        }
         if (subIndex != other.subIndex) {
             return false;
         }
@@ -181,6 +179,13 @@
         } else if (!outerPosition.equals(other.outerPosition)) {
             return false;
         }
+        if (values == null) {
+            if (other.values != null) {
+                return false;
+            }
+        } else if (!values.equals(other.values)) {
+            return false;
+        }
         return true;
     }