diff graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiAssumptions.java @ 4670:41034914e2ee

add MethodContents assumption to fix debbugging issue
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 22 Feb 2012 17:04:27 +0100
parents aaac4894175c
children 2f2c6347fce4
line wrap: on
line diff
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiAssumptions.java	Tue Feb 21 16:23:44 2012 -0800
+++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiAssumptions.java	Wed Feb 22 17:04:27 2012 +0100
@@ -34,16 +34,10 @@
  */
 public final class CiAssumptions implements Serializable, Iterable<CiAssumptions.Assumption> {
 
-    /**
-     *
-     */
     private static final long serialVersionUID = 5152062717588239131L;
 
     public abstract static class Assumption implements Serializable {
 
-        /**
-         *
-         */
         private static final long serialVersionUID = -1936652569665112915L;
     }
 
@@ -51,9 +45,7 @@
      * An assumption about a unique subtype of a given type.
      */
     public static final class ConcreteSubtype extends Assumption {
-        /**
-         *
-         */
+
         private static final long serialVersionUID = -1457173265437676252L;
 
         /**
@@ -95,9 +87,6 @@
      */
     public static final class ConcreteMethod extends Assumption {
 
-        /**
-         *
-         */
         private static final long serialVersionUID = -7636746737947390059L;
 
         /**
@@ -143,6 +132,37 @@
     }
 
     /**
+     * An assumption that specified that a method was used during the compilation.
+     */
+    public static final class MethodContents extends Assumption {
+
+        private static final long serialVersionUID = -4821594103928571659L;
+
+        public final RiResolvedMethod method;
+
+        public MethodContents(RiResolvedMethod method) {
+            this.method = method;
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + method.hashCode();
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof ConcreteMethod) {
+                ConcreteMethod other = (ConcreteMethod) obj;
+                return other.method == method;
+            }
+            return false;
+        }
+    }
+
+    /**
      * Array with the assumptions. This field is directly accessed from C++ code in the Graal/HotSpot implementation.
      */
     private Assumption[] list;
@@ -209,6 +229,15 @@
         record(new ConcreteMethod(method, context, impl));
     }
 
+    /**
+     * Records that {@code method} was used during the compilation.
+     *
+     * @param method a method whose contents were used
+     */
+    public void recordMethodContents(RiResolvedMethod method) {
+        record(new MethodContents(method));
+    }
+
     private void record(Assumption assumption) {
         if (list == null) {
             list = new Assumption[4];