changeset 14158:fd7fcd2d2072

replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
author Doug Simon <doug.simon@oracle.com>
date Wed, 12 Mar 2014 21:47:35 +0100
parents 8c4a3d9308a7
children f14fb79ab265
files graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationBlockState.java graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java
diffstat 27 files changed, 92 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java	Wed Mar 12 21:47:35 2014 +0100
@@ -64,7 +64,7 @@
         public boolean equals(Object obj) {
             if (obj instanceof NoFinalizableSubclass) {
                 NoFinalizableSubclass other = (NoFinalizableSubclass) obj;
-                return other.receiverType == receiverType;
+                return other.receiverType.equals(receiverType);
             }
             return false;
         }
@@ -112,7 +112,7 @@
         public boolean equals(Object obj) {
             if (obj instanceof ConcreteSubtype) {
                 ConcreteSubtype other = (ConcreteSubtype) obj;
-                return other.context == context && other.subtype == subtype;
+                return other.context.equals(context) && other.subtype.equals(subtype);
             }
             return false;
         }
@@ -166,7 +166,7 @@
         public boolean equals(Object obj) {
             if (obj instanceof ConcreteMethod) {
                 ConcreteMethod other = (ConcreteMethod) obj;
-                return other.method == method && other.context == context && other.impl == impl;
+                return other.method.equals(method) && other.context.equals(context) && other.impl.equals(impl);
             }
             return false;
         }
@@ -199,7 +199,7 @@
         public boolean equals(Object obj) {
             if (obj instanceof MethodContents) {
                 MethodContents other = (MethodContents) obj;
-                return other.method == method;
+                return other.method.equals(method);
             }
             return false;
         }
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java	Wed Mar 12 21:47:35 2014 +0100
@@ -185,11 +185,11 @@
         }
         if (o instanceof VirtualObject) {
             VirtualObject l = (VirtualObject) o;
-            if (l.type != type || l.values.length != values.length) {
+            if (!l.type.equals(type) || l.values.length != values.length) {
                 return false;
             }
             for (int i = 0; i < values.length; i++) {
-                if (values[i] != l.values[i]) {
+                if (!Objects.equals(values[i], l.values[i])) {
                     return false;
                 }
             }
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java	Wed Mar 12 21:47:35 2014 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.api.meta;
 
+import java.util.*;
+
 /**
  * Represents an exception handler within the bytecodes.
  */
@@ -104,10 +106,7 @@
         if (this.startBCI != that.startBCI || this.endBCI != that.endBCI || this.handlerBCI != that.handlerBCI || this.catchTypeCPI != that.catchTypeCPI) {
             return false;
         }
-        if (this.catchType == null || that.catchType == null) {
-            return this.catchType == that.catchType;
-        }
-        return this.catchType.equals(that.catchType);
+        return Objects.equals(this.catchType, that.catchType);
     }
 
     @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Wed Mar 12 21:47:35 2014 +0100
@@ -68,6 +68,23 @@
     }
 
     @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || !(obj instanceof HotSpotUnresolvedField)) {
+            return false;
+        }
+        HotSpotResolvedJavaField that = (HotSpotResolvedJavaField) obj;
+        return this.holder.equals(that.holder) && this.name.equals(that.name) && this.type.equals(that.type);
+    }
+
+    @Override
+    public int hashCode() {
+        return name.hashCode();
+    }
+
+    @Override
     public int getModifiers() {
         return modifiers & getReflectionFieldModifiers();
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Wed Mar 12 21:47:35 2014 +0100
@@ -128,6 +128,20 @@
         return unsafe.getAddress(metaspaceMethod + runtime().getConfig().methodConstMethodOffset);
     }
 
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof HotSpotResolvedJavaMethod) {
+            HotSpotResolvedJavaMethod that = (HotSpotResolvedJavaMethod) obj;
+            return that.metaspaceMethod == metaspaceMethod;
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return (int) metaspaceMethod;
+    }
+
     /**
      * Returns this method's constant method flags ({@code ConstMethod::_flags}).
      * 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java	Wed Mar 12 21:47:35 2014 +0100
@@ -44,4 +44,19 @@
     }
 
     public abstract Class<?> mirror();
+
+    @Override
+    public final boolean equals(Object obj) {
+        if (!(obj instanceof HotSpotResolvedJavaType)) {
+            return false;
+        }
+        HotSpotResolvedJavaType that = (HotSpotResolvedJavaType) obj;
+        return this.mirror().equals(that.mirror());
+    }
+
+    @Override
+    public final int hashCode() {
+        return getName().hashCode();
+    }
+
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java	Wed Mar 12 21:47:35 2014 +0100
@@ -593,7 +593,7 @@
         }
         if (!includeSuperclasses) {
             int myFieldsStart = 0;
-            while (myFieldsStart < instanceFields.length && instanceFields[myFieldsStart].getDeclaringClass() != this) {
+            while (myFieldsStart < instanceFields.length && !instanceFields[myFieldsStart].getDeclaringClass().equals(this)) {
                 myFieldsStart++;
             }
             if (myFieldsStart == 0) {
@@ -763,20 +763,6 @@
     }
 
     @Override
-    public boolean equals(Object obj) {
-        if (!(obj instanceof HotSpotResolvedObjectType)) {
-            return false;
-        }
-        HotSpotResolvedObjectType that = (HotSpotResolvedObjectType) obj;
-        return this.mirror() == that.mirror();
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode();
-    }
-
-    @Override
     public String toString() {
         String simpleName;
         if (isArray() || isInterface()) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java	Wed Mar 12 21:47:35 2014 +0100
@@ -154,7 +154,7 @@
     @Override
     public boolean isAssignableFrom(ResolvedJavaType other) {
         assert other != null;
-        return other == this;
+        return other.equals(this);
     }
 
     @Override
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Wed Mar 12 21:47:35 2014 +0100
@@ -146,7 +146,7 @@
     }
 
     public boolean isCompatibleWith(FrameStateBuilder other) {
-        assert method == other.method && graph == other.graph && localsSize() == other.localsSize() : "Can only compare frame states of the same method";
+        assert method.equals(other.method) && graph == other.graph && localsSize() == other.localsSize() : "Can only compare frame states of the same method";
         assert lockedObjects.length == monitorIds.length && other.lockedObjects.length == other.monitorIds.length : "mismatch between lockedObjects and monitorIds";
 
         if (stackSize() != other.stackSize()) {
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java	Wed Mar 12 21:47:35 2014 +0100
@@ -100,7 +100,7 @@
             }
         } else if (boxingTypes.contains(holder)) {
             return method.getName().equals("valueOf");
-        } else if (method.getDeclaringClass() == metaAccess.lookupJavaType(Class.class)) {
+        } else if (method.getDeclaringClass().equals(metaAccess.lookupJavaType(Class.class))) {
             return method.getName().equals("desiredAssertionStatus");
         } else if (method.getDeclaringClass().equals(declaringClass)) {
             return (method.getName().equals("$jacocoInit"));
@@ -113,7 +113,7 @@
         for (ValueNode node : graph.getNodes().filter(ValueNode.class)) {
             if (node instanceof StoreFieldNode) {
                 ResolvedJavaField field = ((StoreFieldNode) node).field();
-                verify(field.getDeclaringClass() == declaringClass, node, "store to field " + format("%H.%n", field));
+                verify(field.getDeclaringClass().equals(declaringClass), node, "store to field " + format("%H.%n", field));
                 verify(isStatic(field.getModifiers()), node, "store to field " + format("%H.%n", field));
                 if (optionValueType.isAssignableFrom((ResolvedJavaType) field.getType())) {
                     verify(isFinal(field.getModifiers()), node, "option field " + format("%H.%n", field) + " not final");
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java	Wed Mar 12 21:47:35 2014 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.nodes;
 
+import java.util.*;
+
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
@@ -102,7 +104,7 @@
                 Debug.log("Profile useless, there is enough static type information available.");
                 return object;
             }
-            if (type == lastCheckedType) {
+            if (Objects.equals(type, lastCheckedType)) {
                 // We have already incorporate the knowledge about this type => abort.
                 return this;
             }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java	Wed Mar 12 21:47:35 2014 +0100
@@ -117,7 +117,7 @@
             } else if (!xIdentity && !yIdentity) {
                 // both are virtual without identity: check contents
                 assert stateX.getVirtualObject().entryCount() == 1 && stateY.getVirtualObject().entryCount() == 1;
-                assert stateX.getVirtualObject().type() == stateY.getVirtualObject().type();
+                assert stateX.getVirtualObject().type().equals(stateY.getVirtualObject().type());
                 assert stateX.getVirtualObject().entryKind(0).getStackKind() == Kind.Int || stateX.getVirtualObject().entryKind(0) == Kind.Long;
                 IntegerEqualsNode equals = new IntegerEqualsNode(stateX.getEntry(0), stateY.getEntry(0));
                 tool.addNode(equals);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java	Wed Mar 12 21:47:35 2014 +0100
@@ -60,7 +60,7 @@
         if (state != null && state.getState() == EscapeState.Virtual) {
             ResolvedJavaType objectType = state.getVirtualObject().type();
             ResolvedJavaType expectedType = tool.getMetaAccessProvider().lookupJavaType(boxingKind.toBoxedJavaClass());
-            if (objectType == expectedType) {
+            if (objectType.equals(expectedType)) {
                 tool.replaceWithValue(state.getEntry(0));
             }
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Wed Mar 12 21:47:35 2014 +0100
@@ -165,7 +165,7 @@
         }
         if (tool.assumptions() != null && tool.assumptions().useOptimisticAssumptions()) {
             ResolvedJavaType exactType = type.findUniqueConcreteSubtype();
-            if (exactType != null && exactType != type) {
+            if (exactType != null && !exactType.equals(type)) {
                 // Propagate more precise type information to usages of the checkcast.
                 tool.assumptions().recordConcreteSubtype(type, exactType);
                 return graph().add(new CheckCastNode(exactType, object, profile, forStoreCheck));
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java	Wed Mar 12 21:47:35 2014 +0100
@@ -165,7 +165,7 @@
 
     public static MethodCallTargetNode find(StructuredGraph graph, ResolvedJavaMethod method) {
         for (MethodCallTargetNode target : graph.getNodes(MethodCallTargetNode.class)) {
-            if (target.targetMethod == method) {
+            if (target.targetMethod.equals(method)) {
                 return target;
             }
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java	Wed Mar 12 21:47:35 2014 +0100
@@ -119,14 +119,14 @@
             meetAlwaysNull = other.alwaysNull;
         } else {
             meetType = meetTypes(type(), other.type());
-            meetExactType = meetType == type && meetType == other.type && exactType && other.exactType;
+            meetExactType = Objects.equals(meetType, type) && Objects.equals(meetType, other.type) && exactType && other.exactType;
             meetNonNull = nonNull && other.nonNull;
             meetAlwaysNull = false;
         }
 
-        if (meetType == type && meetExactType == exactType && meetNonNull == nonNull && meetAlwaysNull == alwaysNull) {
+        if (Objects.equals(meetType, type) && meetExactType == exactType && meetNonNull == nonNull && meetAlwaysNull == alwaysNull) {
             return this;
-        } else if (meetType == other.type && meetExactType == other.exactType && meetNonNull == other.nonNull && meetAlwaysNull == other.alwaysNull) {
+        } else if (Objects.equals(meetType, other.type) && meetExactType == other.exactType && meetNonNull == other.nonNull && meetAlwaysNull == other.alwaysNull) {
             return other;
         } else {
             return new ObjectStamp(meetType, meetExactType, meetNonNull, meetAlwaysNull);
@@ -186,7 +186,7 @@
         boolean joinAlwaysNull = alwaysNull || other.alwaysNull;
         boolean joinNonNull = nonNull || other.nonNull;
         boolean joinExactType = exactType || other.exactType;
-        if (type == other.type) {
+        if (Objects.equals(type, other.type)) {
             joinType = type;
         } else if (type == null && other.type == null) {
             joinType = null;
@@ -230,9 +230,9 @@
         } else if (joinExactType && !isConcreteType(joinType)) {
             return StampFactory.illegal(Kind.Object);
         }
-        if (joinType == type && joinExactType == exactType && joinNonNull == nonNull && joinAlwaysNull == alwaysNull) {
+        if (Objects.equals(joinType, type) && joinExactType == exactType && joinNonNull == nonNull && joinAlwaysNull == alwaysNull) {
             return this;
-        } else if (joinType == other.type && joinExactType == other.exactType && joinNonNull == other.nonNull && joinAlwaysNull == other.alwaysNull) {
+        } else if (Objects.equals(joinType, other.type) && joinExactType == other.exactType && joinNonNull == other.nonNull && joinAlwaysNull == other.alwaysNull) {
             return other;
         } else {
             return new ObjectStamp(joinType, joinExactType, joinNonNull, joinAlwaysNull);
@@ -244,7 +244,7 @@
     }
 
     private static ResolvedJavaType meetTypes(ResolvedJavaType a, ResolvedJavaType b) {
-        if (a == b) {
+        if (Objects.equals(a, b)) {
             return a;
         } else if (a == null || b == null) {
             return null;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java	Wed Mar 12 21:47:35 2014 +0100
@@ -240,7 +240,7 @@
         assert type.getKind() == Kind.Object;
         ResolvedJavaType exact = type.asExactType();
         if (exact != null) {
-            assert !exactType || type == exact;
+            assert !exactType || type.equals(exact);
             return new ObjectStamp(exact, true, nonNull, false);
         } else {
             return new ObjectStamp(type, exactType, nonNull, false);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java	Wed Mar 12 21:47:35 2014 +0100
@@ -77,7 +77,7 @@
     public int fieldIndex(ResolvedJavaField field) {
         // on average fields.length == ~6, so a linear search is fast enough
         for (int i = 0; i < fields.length; i++) {
-            if (fields[i] == field) {
+            if (fields[i].equals(field)) {
                 return i;
             }
         }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java	Wed Mar 12 21:47:35 2014 +0100
@@ -253,7 +253,7 @@
             ResolvedJavaType knownType = getNodeType(original);
             ResolvedJavaType newType = tighten(type, knownType);
 
-            if (newType != knownType) {
+            if (!newType.equals(knownType)) {
                 knownTypes.put(original, newType);
                 metricTypeRegistered.increment();
             }
@@ -271,7 +271,7 @@
     public static ResolvedJavaType widen(ResolvedJavaType a, ResolvedJavaType b) {
         if (a == null || b == null) {
             return null;
-        } else if (a == b) {
+        } else if (a.equals(b)) {
             return a;
         } else {
             return a.findLeastCommonAncestor(b);
@@ -283,7 +283,7 @@
             return b;
         } else if (b == null) {
             return a;
-        } else if (a == b) {
+        } else if (a.equals(b)) {
             return a;
         } else if (a.isAssignableFrom(b)) {
             return b;
@@ -623,7 +623,7 @@
                     ValueNode receiver = callTarget.receiver();
                     if (receiver != null && (callTarget.invokeKind() == InvokeKind.Interface || callTarget.invokeKind() == InvokeKind.Virtual)) {
                         ResolvedJavaType type = state.getNodeType(receiver);
-                        if (type != ObjectStamp.typeOrNull(receiver)) {
+                        if (!Objects.equals(type, ObjectStamp.typeOrNull(receiver))) {
                             ResolvedJavaMethod method = type.resolveMethod(callTarget.targetMethod());
                             if (method != null) {
                                 if (Modifier.isFinal(method.getModifiers()) || Modifier.isFinal(type.getModifiers())) {
@@ -645,7 +645,7 @@
             for (Node n : value.usages()) {
                 if (n instanceof InstanceOfNode) {
                     InstanceOfNode instanceOfNode = (InstanceOfNode) n;
-                    if (instanceOfNode.type() == type && state.trueConditions.containsKey(instanceOfNode)) {
+                    if (instanceOfNode.type().equals(type) && state.trueConditions.containsKey(instanceOfNode)) {
                         ValueNode v = state.trueConditions.get(instanceOfNode);
                         if (v instanceof GuardingNode) {
                             return (GuardingNode) v;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Wed Mar 12 21:47:35 2014 +0100
@@ -1434,7 +1434,7 @@
                     } else {
                         // only handle the outermost frame states
                         if (frameState.outerFrameState() == null) {
-                            assert frameState.bci == FrameState.INVALID_FRAMESTATE_BCI || frameState.method() == inlineGraph.method();
+                            assert frameState.bci == FrameState.INVALID_FRAMESTATE_BCI || frameState.method().equals(inlineGraph.method());
                             if (outerFrameState == null) {
                                 outerFrameState = stateAfter.duplicateModified(invoke.bci(), stateAfter.rethrowException(), invokeNode.kind());
                                 outerFrameState.setDuringCall(true);
@@ -1545,7 +1545,7 @@
 
     public static FixedWithNextNode inlineMacroNode(Invoke invoke, ResolvedJavaMethod concrete, Class<? extends FixedWithNextNode> macroNodeClass) throws GraalInternalError {
         StructuredGraph graph = invoke.asNode().graph();
-        if (((MethodCallTargetNode) invoke.callTarget()).targetMethod() != concrete) {
+        if (!concrete.equals(((MethodCallTargetNode) invoke.callTarget()).targetMethod())) {
             assert ((MethodCallTargetNode) invoke.callTarget()).invokeKind() != InvokeKind.Static;
             InliningUtil.replaceInvokeCallTarget(invoke, graph, InvokeKind.Special, concrete);
         }
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Wed Mar 12 21:47:35 2014 +0100
@@ -202,7 +202,7 @@
         for (Object o : Debug.context()) {
             JavaMethod method = asJavaMethod(o);
             if (method != null) {
-                if (lastMethodOrGraph == null || asJavaMethod(lastMethodOrGraph) != method) {
+                if (lastMethodOrGraph == null || !asJavaMethod(lastMethodOrGraph).equals(method)) {
                     result.add(MetaUtil.format("%H::%n(%p)", method));
                 } else {
                     // This prevents multiple adjacent method context objects for the same method
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Wed Mar 12 21:47:35 2014 +0100
@@ -452,7 +452,7 @@
 
                 for (MethodCallTargetNode callTarget : graph.getNodes(MethodCallTargetNode.class)) {
                     ResolvedJavaMethod callee = callTarget.targetMethod();
-                    if (callee == recursiveEntry) {
+                    if (callee.equals(recursiveEntry)) {
                         if (isInlinableSnippet(substitutedMethod)) {
                             final StructuredGraph originalGraph = buildInitialGraph(substitutedMethod);
                             InliningUtil.inline(callTarget.invoke(), originalGraph, true);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Wed Mar 12 21:47:35 2014 +0100
@@ -340,7 +340,7 @@
                 return false;
             }
             CacheKey other = (CacheKey) obj;
-            if (method != other.method) {
+            if (!method.equals(other.method)) {
                 return false;
             }
             if (guardsStage != other.guardsStage || loweringStage != other.loweringStage) {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java	Wed Mar 12 21:47:35 2014 +0100
@@ -169,7 +169,7 @@
     protected void replaceSnippetInvokes(StructuredGraph snippetGraph) {
         for (MethodCallTargetNode call : snippetGraph.getNodes(MethodCallTargetNode.class)) {
             Invoke invoke = call.invoke();
-            if (call.targetMethod() != getTargetMethod()) {
+            if (!call.targetMethod().equals(getTargetMethod())) {
                 throw new GraalInternalError("unexpected invoke %s in snippet", getClass().getSimpleName());
             }
             assert invoke.stateAfter().bci == FrameState.AFTER_BCI;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java	Wed Mar 12 21:47:35 2014 +0100
@@ -247,6 +247,7 @@
     private boolean shouldInline(final MethodCallTargetNode methodCallTargetNode) {
         return (methodCallTargetNode.invokeKind() == InvokeKind.Special || methodCallTargetNode.invokeKind() == InvokeKind.Static) &&
                         !Modifier.isNative(methodCallTargetNode.targetMethod().getModifiers()) && methodCallTargetNode.targetMethod().getAnnotation(ExplodeLoop.class) == null &&
-                        methodCallTargetNode.targetMethod().getAnnotation(CompilerDirectives.SlowPath.class) == null && methodCallTargetNode.targetMethod().getDeclaringClass() != stringBuilderClass;
+                        methodCallTargetNode.targetMethod().getAnnotation(CompilerDirectives.SlowPath.class) == null &&
+                        !methodCallTargetNode.targetMethod().getDeclaringClass().equals(stringBuilderClass);
     }
 }
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationBlockState.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationBlockState.java	Wed Mar 12 21:47:35 2014 +0100
@@ -54,7 +54,7 @@
                 return false;
             }
             ReadCacheEntry other = (ReadCacheEntry) obj;
-            return identity == other.identity && object == other.object;
+            return identity.equals(other.identity) && object == other.object;
         }
 
         @Override
@@ -136,7 +136,7 @@
         Iterator<Map.Entry<ReadCacheEntry, ValueNode>> iter = readCache.entrySet().iterator();
         while (iter.hasNext()) {
             Map.Entry<ReadCacheEntry, ValueNode> entry = iter.next();
-            if (entry.getKey().identity == identity) {
+            if (entry.getKey().identity.equals(identity)) {
                 iter.remove();
             }
         }
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java	Wed Mar 12 12:40:45 2014 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java	Wed Mar 12 21:47:35 2014 +0100
@@ -579,7 +579,7 @@
                     for (int i = 0; i < objStates.length; i++) {
                         ObjectState obj = objStates[i];
                         boolean hasIdentity = obj.virtual.hasIdentity() && mergedVirtualObjects.contains(obj.virtual);
-                        if (hasIdentity || firstObj.virtual.type() != obj.virtual.type() || firstObj.virtual.entryCount() != obj.virtual.entryCount() || !firstObj.locksEqual(obj)) {
+                        if (hasIdentity || !firstObj.virtual.type().equals(obj.virtual.type()) || firstObj.virtual.entryCount() != obj.virtual.entryCount() || !firstObj.locksEqual(obj)) {
                             compatible = false;
                             break;
                         }