This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Bugs for JNI on Solaris
- From: Martin Kahlert <martin dot kahlert at infineon dot com>
- To: java-patches at gcc dot gnu dot org
- Cc: java at gcc dot gnu dot org
- Date: Fri, 8 Feb 2002 13:04:42 +0100
- Subject: Bugs for JNI on Solaris
- Reply-to: martin dot kahlert at infineon dot com
Hi,
this patch makes my small buggy program work on Solaris.
(see http://gcc.gnu.org/ml/java/2002-02/msg00063.html).
The first was a short guess, what might go wrong in the example
It did not cause the error, but it is safe programming style :-)
The second patch cures the problem. If it is correct should be judged by
some more experienced people than me.
(The program calls FindClass after _Jv_JNI_AttachCurrentThread, which
leaves us with a rather information less frame)
Bye,
Martin.
2002-02-08 Martin Kahlert <martin.kahlert@infineon.com>
* jni.cc (_Jv_JNI_NewLocalRef): Make sure, that NULL frame is not derefeneced
* jni.cc (_Jv_JNI_AttachCurrentThread): Produce full featured env->locals frame
--- jni.cc.old Fri Feb 8 12:52:23 2002
+++ jni.cc Fri Feb 8 12:51:25 2002
@@ -325,7 +325,7 @@
// If we found a slot, or if the frame we just searched is the
// mark frame, then we are done.
- if (done || frame->marker != MARK_NONE)
+ if (done || frame == NULL || frame->marker != MARK_NONE)
break;
}
@@ -2131,6 +2131,11 @@
_Jv_Free (env);
return JNI_ERR;
}
+ env->locals->size = FRAME_SIZE;
+ env->locals->marker = MARK_SYSTEM;
+ env->locals->next = NULL;
+ memset (&env->locals->vec[0], 0, FRAME_SIZE * sizeof (jobject));
+
*penv = reinterpret_cast<void *> (env);
// This thread might already be a Java thread -- this function might
--
The early bird catches the worm. If you want something else for
breakfast, get up later.