diff c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotField.java @ 1941:79d04223b8a5

Added caching for resolved types and resolved fields. This is crucial, because the local load elimination will lead to wrong results, if field equality (of two RiField objects with the same object and the same RiType) is not given. The caching makes sure that the default equals implementation is sufficient.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Tue, 28 Dec 2010 18:33:26 +0100
parents 2c754f3a2722
children 3c0a889a176b
line wrap: on
line diff
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotField.java	Mon Dec 27 20:35:47 2010 +0100
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotField.java	Tue Dec 28 18:33:26 2010 +0100
@@ -67,6 +67,15 @@
     }
 
     @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof HotSpotField) {
+            HotSpotField other = (HotSpotField) obj;
+            return other.offset == offset && other.holder.equals(holder());
+        }
+        return false;
+    }
+
+    @Override
     public boolean isResolved() {
         return offset != -1;
     }