JNI patches

Marcus G. Daniels mgd@swarm.org
Sat Mar 31 18:07:00 GMT 2001


Attached are some patches I had to make in order to get my JNI app to work.

1. jni-class-localref:  Make localrefs for jclass values.

   In the second paragraph of the second sentence at:

     http://java.sun.com/j2se/1.3/docs/guide/jni/spec/design.doc.html#1242

   it says "All Java objects are returned by JNI functions are local
   references" and at:

     http://java.sun.com/j2se/1.3/docs/guide/jni/spec/types.doc.html#428

   ..it shows that jclass is a subclass of jobject.  So a function like
   GetObjectClass should return a localref that can be destroyed by
   DeleteLocalRef.

2. split local ref table from global ref table.  The handles should be 
   unique as I understand JNI.  The way it is now means that someone 
   can call DeleteGlobalRef on a local ref or vice-versa.  

   The first sentence of the first URL above says local and global
   refs are in different categories.

3. included in #2 is a patch to set env->locals to erase mention
   of dead frames.  This was causing the _Jv_JNI_PopLocalFrame to crash.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: jni-class-localref
Type: text/x-diff
Size: 389 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20010331/486c3d72/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jni-local-global
Type: text/x-c++
Size: 7354 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20010331/486c3d72/attachment-0001.bin>


More information about the Java mailing list