diff src/share/vm/graal/graalCompilerToVM.cpp @ 9610:ae17e540c5d2

More asserts while getting vtable offsets Added check that methods have vtable entrys before using method dispatch instead of type dispatch
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 08 May 2013 16:34:30 +0200
parents ffbb0a365039
children dd62ccda1849
line wrap: on
line diff
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Wed May 08 13:42:14 2013 +0200
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Wed May 08 16:34:30 2013 +0200
@@ -1001,6 +1001,7 @@
   Method* method = asMethod(metaspace_method);
   assert(!InstanceKlass::cast(method->method_holder())->is_interface(), "vtableEntryOffset cannot be called for interface methods");
   assert(InstanceKlass::cast(method->method_holder())->is_linked(), "vtableEntryOffset cannot be called is holder is not linked");
+  assert(method->vtable_index() >= 0, "vtable entry offset should not be used");
 
   // get entry offset in words
   int vtable_entry_offset = InstanceKlass::vtable_start_offset() + method->vtable_index() * vtableEntry::size();
@@ -1010,6 +1011,11 @@
   return vtable_entry_offset;
 C2V_END
 
+C2V_VMENTRY(jboolean, hasVtableEntry, (JNIEnv *, jobject, jlong metaspace_method))
+  Method* method = asMethod(metaspace_method);
+  return method->vtable_index() >= 0;
+C2V_END
+
 C2V_VMENTRY(jobject, getDeoptedLeafGraphIds, (JNIEnv *, jobject))
 
   // the contract for this method is as follows:
@@ -1177,6 +1183,7 @@
   {CC"getInvocationCount",            CC"("METASPACE_METHOD")I",                                        FN_PTR(getInvocationCount)},
   {CC"getCompiledCodeSize",           CC"("METASPACE_METHOD")I",                                        FN_PTR(getCompiledCodeSize)},
   {CC"getVtableEntryOffset",          CC"("METASPACE_METHOD")I",                                        FN_PTR(getVtableEntryOffset)},
+  {CC"hasVtableEntry",                CC"("METASPACE_METHOD")Z",                                        FN_PTR(hasVtableEntry)},
   {CC"constantPoolLength",            CC"("HS_RESOLVED_TYPE")I",                                        FN_PTR(constantPoolLength)},
   {CC"lookupType",                    CC"("STRING HS_RESOLVED_TYPE"Z)"TYPE,                             FN_PTR(lookupType)},
   {CC"lookupConstantInPool",          CC"("HS_RESOLVED_TYPE"I)"OBJECT,                                  FN_PTR(lookupConstantInPool)},