This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: JNI in GCJ 3.2 for Win32


>>>>> "Ranjit" == Ranjit Mathew <rmathew@hotmail.com> writes:

Ranjit> I can probably add another argument to _Jv_LookupJNIMethod( )
Ranjit> passing it the value of "args_raw_size" of the _Jv_JNIMethod
Ranjit> object "_this" in _Jv_JNIMethod::call( ).

Ranjit> Would that be acceptable?

I misspoke earlier: _Jv_JNIMethod::call is used as the JNI stub for
interpreted classes.

In compiled classes, the compiler itself generates a call to
_Jv_LookupJNIMethod and then directly calls the returned method.

Now, the _Jv_LookupJNIMethod API is already wrong in some cases :-(.
In particular the compiler-generated stubs aren't thread safe.

I think your idea makes sense.  You'll just need to update the
compiler as well.  The function you want is build_jni_stub in
gcc/java/expr.c.

If we're going to change _Jv_LookupJNIMethod, let's solve the other
problem at the same time.  I think it could look like this:

void _Jv_LookupJNIMethod (jclass klass, _Jv_Utf8Const *name,
                          _Jv_Utf8Const *signature,
                          void (**function) (), int arg_size);

The new implementation would synchronize on something, and would fill
in *FUNCTION with the pointer to the function it found.

If you do this you'll also need to change the declaration of
_Jv_LookupJNIMethod in decl.c (to change the return type).

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]