[kaffe] CVS kaffe (guilhem): Fixed exception dispatching for JNI calls in interpreter mode.
Kaffe CVS
cvs-commits at kaffe.org
Fri Apr 16 10:16:03 PDT 2004
PatchSet 4654
Date: 2004/04/16 17:12:05
Author: guilhem
Branch: HEAD
Tag: (none)
Log:
Fixed exception dispatching for JNI calls in interpreter mode.
* kaffe/kaffevm/support.c
(callMethodV, callMethodA): If the called method is a JNI, then
throw the waiting exception in exceptObj.
Members:
ChangeLog:1.2230->1.2231
kaffe/kaffevm/support.c:1.64->1.65
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2230 kaffe/ChangeLog:1.2231
--- kaffe/ChangeLog:1.2230 Fri Apr 16 16:26:37 2004
+++ kaffe/ChangeLog Fri Apr 16 17:12:05 2004
@@ -1,3 +1,9 @@
+2004-04-16 Guilhem Lavaux <guilhem at kaffe.org>
+
+ * kaffe/kaffevm/support.c
+ (callMethodV, callMethodA): If the called method is a JNI, then
+ throw the waiting exception in exceptObj.
+
2004-04-16 Riccardo Mottola <zuse at libero.it>
* config/m68k/openbsd2/jit.h:
Index: kaffe/kaffe/kaffevm/support.c
diff -u kaffe/kaffe/kaffevm/support.c:1.64 kaffe/kaffe/kaffevm/support.c:1.65
--- kaffe/kaffe/kaffevm/support.c:1.64 Mon Apr 5 17:43:38 2004
+++ kaffe/kaffe/kaffevm/support.c Fri Apr 16 17:12:07 2004
@@ -612,6 +612,7 @@
Hjava_lang_Object* syncobj = 0;
VmExceptHandler mjbuf;
threadData* thread_data = THREAD_DATA();
+ struct Hjava_lang_Throwable *save_except = NULL;
if (meth->accflags & ACC_SYNCHRONISED) {
if (meth->accflags & ACC_STATIC) {
@@ -625,6 +626,19 @@
setupExceptionHandling(&mjbuf, meth, syncobj, thread_data);
+ /* This exception has yet been handled by the VM creator.
+ * We are putting it in stand by until it is cleared. For
+ * that JNI call we're cleaning up the pointer and we will
+ * put it again to the value afterward.
+ */
+ if ((meth->accflags & ACC_JNI) != 0) {
+ if (thread_data->exceptObj != NULL)
+ save_except = thread_data->exceptObj;
+ else
+ save_except = NULL;
+ thread_data->exceptObj = NULL;
+ }
+
/* Make the call - system dependent */
sysdepCallMethod(&call);
@@ -632,7 +646,20 @@
unlockObject(syncobj);
}
+ /* If we have a pending exception and this is JNI, throw it */
+ if ((meth->accflags & ACC_JNI) != 0) {
+ struct Hjava_lang_Throwable *eobj;
+
+ eobj = thread_data->exceptObj;
+ if (eobj != 0) {
+ thread_data->exceptObj = 0;
+ throwExternalException(eobj);
+ }
+ thread_data->exceptObj = save_except;
+ }
+
cleanupExceptionHandling(&mjbuf, thread_data);
+
}
#endif
if (!promoted && call.retsize == 1) {
@@ -826,6 +853,7 @@
Hjava_lang_Object* syncobj = 0;
VmExceptHandler mjbuf;
threadData* thread_data = THREAD_DATA();
+ struct Hjava_lang_Throwable *save_except = NULL;
if (meth->accflags & ACC_SYNCHRONISED) {
if (meth->accflags & ACC_STATIC) {
@@ -839,11 +867,36 @@
setupExceptionHandling(&mjbuf, meth, syncobj, thread_data);
+ /* This exception has yet been handled by the VM creator.
+ * We are putting it in stand by until it is cleared. For
+ * that JNI call we're cleaning up the pointer and we will
+ * put it again to the value afterward.
+ */
+ if ((meth->accflags & ACC_JNI) != 0) {
+ if (thread_data->exceptObj != NULL)
+ save_except = thread_data->exceptObj;
+ else
+ save_except = NULL;
+ thread_data->exceptObj = NULL;
+ }
+
/* Make the call - system dependent */
sysdepCallMethod(&call);
if (syncobj != 0) {
unlockObject(syncobj);
+ }
+
+ /* If we have a pending exception and this is JNI, throw it */
+ if ((meth->accflags & ACC_JNI) != 0) {
+ struct Hjava_lang_Throwable *eobj;
+
+ eobj = thread_data->exceptObj;
+ if (eobj != 0) {
+ thread_data->exceptObj = 0;
+ throwExternalException(eobj);
+ }
+ thread_data->exceptObj = save_except;
}
cleanupExceptionHandling(&mjbuf, thread_data);
More information about the kaffe
mailing list