[llvm-commits] [vmkit] r50626 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaClass.cpp JavaJIT.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sun May 4 13:03:54 PDT 2008


Author: geoffray
Date: Sun May  4 15:03:54 2008
New Revision: 50626

URL: http://llvm.org/viewvc/llvm-project?rev=50626&view=rev
Log:
Do a load when compiling exceptions read in the exception table. The compiledPtr()
method catches the exception to release the class lock and throw a NoClassDefFoundError.


Modified:
    vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp?rev=50626&r1=50625&r2=50626&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Sun May  4 15:03:54 2008
@@ -215,7 +215,20 @@
         if (isNative(access)) {
           llvmFunction = jit.nativeCompile();
         } else {
-          llvmFunction = jit.javaCompile();
+          JavaObject* exc = 0;
+          try {
+            llvmFunction = jit.javaCompile();
+          } catch(...) {
+            // Happens when it can not load an exception class
+            classDef->release();
+            exc = JavaThread::getJavaException();
+            assert(exc && "no exception?");
+            JavaThread::clearException();
+          }
+          if (exc) {
+            Jnjvm* vm = JavaThread::get()->isolate;
+            vm->errorWithExcp(Jnjvm::NoClassDefFoundError, exc);
+          }
         }
       }
       // We can compile it, since if we're here, it's for a  good reason

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=50626&r1=50625&r2=50626&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Sun May  4 15:03:54 2008
@@ -824,7 +824,7 @@
     ex->catche = reader->readU2();
 
     if (ex->catche) {
-      Class* cl = (Class*)(ctpInfo->getMethodClassIfLoaded(ex->catche));
+      Class* cl = (Class*)(ctpInfo->loadClass(ex->catche));
       ex->catchClass = cl;
     } else {
       ex->catchClass = Classpath::newThrowable;
@@ -919,10 +919,8 @@
     Module* M = compilingClass->isolate->module;
     Value* cl = 0;
     currentBlock = cur->realTest;
-    if (cur->catchClass)
-      cl = new LoadInst(cur->catchClass->llvmVar(M), "", currentBlock);
-    else
-      cl = getResolvedClass(cur->catche, false);
+    assert(cur->catchClass);
+    cl = new LoadInst(cur->catchClass->llvmVar(M), "", currentBlock);
     Value* cmp = llvm::CallInst::Create(compareExceptionLLVM, cl, "",
                                         currentBlock);
     llvm::BranchInst::Create(cur->handler, bbNext, cmp, currentBlock);





More information about the llvm-commits mailing list