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: very slow jni code callbacks


On Mon, Sep 28, 2009 at 1:03 PM, Andrew Haley <aph@redhat.com> wrote:

>> When I use oprofile I see at lot of calls to execute_cfa_program
>> and _Unwind_IteratePhdrCallback.
>
> I think this is a bug. ?I've had a look at the code, and it's in
> jni.cc: _Jv_JNI_CallAnyVoidMethodV
>
> This calls _Jv_GetTypesFromSignature, which in turn iterates though
> all the class loaders looking up the types of all the arguments.
> But as far as I can see this is a pointless waste of time: the only
> use of the type of each argument is to determine whether it's a
> primitive type or not, and we could certainly have done that when
> we created the jmethodID. ?There is a field in the method struct called
> ffi_arg_types, but I think it isn't used when calling C to Java via JNI.

I think the underlying issue is that jMethodID is typedef'ed to
libgcj's internal _Jv_Method. It really needs to use something more
like the interpreter's _Jv_ResolvedMethod or _Jv_JNIMethod so that the
arg types and return type (and, in fact, the ffi_cif itself) can be
resolved once and reused.

Bryce


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