[vmkit-commits] [vmkit] r103386 - in /vmkit/trunk/lib/J3: Compiler/JavaJIT.cpp VMCore/JavaClass.cpp VMCore/JavaClass.h VMCore/JavaRuntimeJIT.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sun May 9 11:35:29 PDT 2010


Author: geoffray
Date: Sun May  9 13:35:28 2010
New Revision: 103386

URL: http://llvm.org/viewvc/llvm-project?rev=103386&view=rev
Log:
Better diagnose missing methods.


Modified:
    vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
    vmkit/trunk/lib/J3/VMCore/JavaClass.cpp
    vmkit/trunk/lib/J3/VMCore/JavaClass.h
    vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp

Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=103386&r1=103385&r2=103386&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Sun May  9 13:35:28 2010
@@ -2263,7 +2263,7 @@
     Meth = TheCompiler->getMethodInClass(meth);
   } else {
     Meth = getConstantPoolAt(index, intrinsics->InterfaceLookupFunction,
-                             intrinsics->JavaMethodType, 0, false);
+                             intrinsics->JavaMethodType, 0, true);
   }
 
   BasicBlock* label_bb = createBasicBlock("bb");

Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.cpp?rev=103386&r1=103385&r2=103386&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaClass.cpp Sun May  9 13:35:28 2010
@@ -370,7 +370,8 @@
                                                 Class* current) {
   JavaMethod* meth = lookupMethodDontThrow(name, type, false, true, NULL);
 
-  if (isSuper(current->access) &&
+  if (meth &&
+      isSuper(current->access) &&
       current != meth->classDef &&
       meth->classDef->isAssignableFrom(current) &&
       !name->equals(classLoader->bootstrapLoader->initName)) {
@@ -432,6 +433,15 @@
   return res;
 }
 
+JavaMethod* Class::lookupInterfaceMethod(const UTF8* name, const UTF8* type) {
+  JavaMethod* res = lookupInterfaceMethodDontThrow(name, type);
+
+  if (!res) {
+    JavaThread::get()->getJVM()->noSuchMethodError(this, name);
+  }
+  return res;
+}
+
 JavaField*
 Class::lookupFieldDontThrow(const UTF8* name, const UTF8* type,
                                   bool isStatic, bool recurse,

Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.h?rev=103386&r1=103385&r2=103386&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaClass.h Sun May  9 13:35:28 2010
@@ -627,6 +627,12 @@
   JavaMethod* lookupMethod(const UTF8* name, const UTF8* type, bool isStatic,
                            bool recurse, Class** cl);
   
+  /// lookupInterfaceMethodDontThrow - Lookup a method in the interfaces of
+  /// this class.
+  /// Throws a MethodNotFoundError if the method can not ne found.
+  ///
+  JavaMethod* lookupInterfaceMethod(const UTF8* name, const UTF8* type);
+
   /// lookupFieldDontThrow - Lookup a field in the field map of this class. Do
   /// not throw if the field is not found.
   ///

Modified: vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=103386&r1=103385&r2=103386&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp Sun May  9 13:35:28 2010
@@ -40,9 +40,8 @@
   
     ctpInfo->resolveMethod(index, cl, utf8, sign);
     assert(cl->isClass() && isInterface(cl->access) && "Wrong type of method");
-    res = cl->asClass()->lookupInterfaceMethodDontThrow(utf8, sign->keyName);
+    res = cl->asClass()->lookupInterfaceMethod(utf8, sign->keyName);
     
-    assert(res && "Can not found method");
     ctpInfo->ctpRes[index] = (void*)res;
   }
   
@@ -726,7 +725,7 @@
     lookup->lookupSpecialMethodDontThrow(utf8, sign->keyName, caller->classDef);
   
   if (!callee) {
-    th->getJVM()->abstractMethodError(lookup, utf8);
+    th->getJVM()->noSuchMethodError(lookup, utf8);
   }
 
   // Compile the found method.





More information about the vmkit-commits mailing list