changeset 9636:ff4e8218d3dd

Remove hasVtableEntry, use isInVirtualMethodTable instead
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 10 May 2013 12:55:34 +0200
parents dac93aca017b
children f38f746f4980
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java
diffstat 2 files changed, 9 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Fri May 10 13:18:51 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Fri May 10 12:55:34 2013 +0200
@@ -35,6 +35,7 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.meta.ProfilingInfo.TriState;
 import com.oracle.graal.bytecode.*;
+import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.debug.*;
 import com.oracle.graal.phases.*;
@@ -382,20 +383,20 @@
     }
 
     /**
-     * Returns the offset of this method into the v-table. If the holder is not initialized, returns
-     * -1. If it is initialized the method must have a v-table entry has indicated by
-     * {@link #hasVtableEntry()}.
+     * Returns the offset of this method into the v-table. The method must have a v-table entry has
+     * indicated by {@link #isInVirtualMethodTable()}, otherwise an exception is thrown.
      * 
      * @return the offset of this method into the v-table
      */
     public int vtableEntryOffset() {
-        if (!holder.isInitialized()) {
-            return -1;
+        if (!isInVirtualMethodTable() || !holder.isInitialized()) {
+            throw new GraalInternalError("%s does not have a vtable entry", this);
         }
         return graalRuntime().getCompilerToVM().getVtableEntryOffset(metaspaceMethod);
     }
 
-    public boolean hasVtableEntry() {
+    @Override
+    public boolean isInVirtualMethodTable() {
         return graalRuntime().getCompilerToVM().hasVtableEntry(metaspaceMethod);
     }
 
@@ -460,9 +461,4 @@
             throw new IllegalArgumentException(ex);
         }
     }
-
-    @Override
-    public boolean isInVirtualMethodTable() {
-        return hasVtableEntry();
-    }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri May 10 13:18:51 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri May 10 12:55:34 2013 +0200
@@ -772,7 +772,7 @@
 
                     HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) callTarget.targetMethod();
                     if (!hsMethod.getDeclaringClass().isInterface()) {
-                        if (hsMethod.hasVtableEntry()) {
+                        if (hsMethod.isInVirtualMethodTable()) {
                             int vtableEntryOffset = hsMethod.vtableEntryOffset();
                             assert vtableEntryOffset > 0;
                             ReadNode hub = this.createReadHub(tool, graph, wordKind, receiver);
@@ -1048,7 +1048,7 @@
     private static ReadNode createReadVirtualMethod(StructuredGraph graph, Kind wordKind, ValueNode hub, ResolvedJavaMethod method) {
         HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) method;
         assert !hsMethod.getDeclaringClass().isInterface();
-        assert hsMethod.hasVtableEntry();
+        assert hsMethod.isInVirtualMethodTable();
 
         int vtableEntryOffset = hsMethod.vtableEntryOffset();
         assert vtableEntryOffset > 0;