[vmkit-commits] [vmkit] r103381 - in /vmkit/trunk/lib/J3: Classpath/ClasspathConstructor.inc Classpath/ClasspathMethod.inc VMCore/Jnjvm.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sun May 9 08:36:39 PDT 2010


Author: geoffray
Date: Sun May  9 10:36:39 2010
New Revision: 103381

URL: http://llvm.org/viewvc/llvm-project?rev=103381&view=rev
Log:
Don't return from a C++ exception handler.


Modified:
    vmkit/trunk/lib/J3/Classpath/ClasspathConstructor.inc
    vmkit/trunk/lib/J3/Classpath/ClasspathMethod.inc
    vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp

Modified: vmkit/trunk/lib/J3/Classpath/ClasspathConstructor.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathConstructor.inc?rev=103381&r1=103380&r2=103381&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Classpath/ClasspathConstructor.inc (original)
+++ vmkit/trunk/lib/J3/Classpath/ClasspathConstructor.inc Sun May  9 10:36:39 2010
@@ -121,6 +121,8 @@
         meth->invokeIntSpecialBuf(vm, cl, res, buf);
       } CATCH {
         excp = th->getJavaException();
+      } END_CATCH;
+      if (excp) {
         if (excp->getClass()->isAssignableFrom(vm->upcalls->newException)) {
           th->clearException();
           // If it's an exception, we encapsule it in an
@@ -131,8 +133,7 @@
           th->throwPendingException();
         }
         return NULL;
-      } END_CATCH;
-    
+      }
     } else {
       vm->illegalArgumentException("class is not a regular class");
     }

Modified: vmkit/trunk/lib/J3/Classpath/ClasspathMethod.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathMethod.inc?rev=103381&r1=103380&r2=103381&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Classpath/ClasspathMethod.inc (original)
+++ vmkit/trunk/lib/J3/Classpath/ClasspathMethod.inc Sun May  9 10:36:39 2010
@@ -151,28 +151,30 @@
     
     JavaThread* th = JavaThread::get();
 
-#define RUN_METH(TYPE, VAR) \
-    TRY { \
-      if (isVirtual(meth->access)) { \
-        if (isPublic(meth->access) && !isFinal(meth->access) && \
-            !isFinal(meth->classDef->access)) { \
-          VAR = meth->invoke##TYPE##VirtualBuf(vm, cl, obj, buf); \
-        } else { \
-          VAR = meth->invoke##TYPE##SpecialBuf(vm, cl, obj, buf); \
-        } \
-      } else { \
-        VAR = meth->invoke##TYPE##StaticBuf(vm, cl, buf); \
-      } \
-    } CATCH { \
-      exc = th->getJavaException(); \
-      if (exc->getClass()->isAssignableFrom(vm->upcalls->newException)) { \
-        th->clearException(); \
-        th->getJVM()->invocationTargetException(exc); \
-      } else { \
-        th->throwPendingException(); \
-      } \
-      return NULL; \
-    } END_CATCH; \
+#define RUN_METH(TYPE, VAR)                                                    \
+    TRY {                                                                      \
+      if (isVirtual(meth->access)) {                                           \
+        if (isPublic(meth->access) && !isFinal(meth->access) &&                \
+            !isFinal(meth->classDef->access)) {                                \
+          VAR = meth->invoke##TYPE##VirtualBuf(vm, cl, obj, buf);              \
+        } else {                                                               \
+          VAR = meth->invoke##TYPE##SpecialBuf(vm, cl, obj, buf);              \
+        }                                                                      \
+      } else {                                                                 \
+        VAR = meth->invoke##TYPE##StaticBuf(vm, cl, buf);                      \
+      }                                                                        \
+    } CATCH {                                                                  \
+      exc = th->getJavaException();                                            \
+    } END_CATCH;                                                               \
+    if (exc) {                                                                 \
+      if (exc->getClass()->isAssignableFrom(vm->upcalls->newException)) {      \
+        th->clearException();                                                  \
+        th->getJVM()->invocationTargetException(exc);                          \
+      } else {                                                                 \
+        th->throwPendingException();                                           \
+      }                                                                        \
+      return NULL;                                                             \
+    }
     
     Typedef* retType = sign->getReturnType();
     if (retType->isPrimitive()) {

Modified: vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp?rev=103381&r1=103380&r2=103381&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp Sun May  9 10:36:39 2010
@@ -150,9 +150,11 @@
         setOwnerClass(0);
         broadcastClass();
         release();
+      } END_CATCH;
+      if (self->pendingException != NULL) {
         self->throwPendingException();
         return;
-      } END_CATCH;
+      }
     }
  
     JavaObject* exc = 0;





More information about the vmkit-commits mailing list