public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: Bryce McKinlay <bmckinlay@gmail.com>
Cc: Herman ten Brugge <hermantenbrugge@home.nl>,
	java@gcc.gnu.org,         Tom Tromey <tromey@redhat.com>
Subject: Re: very slow jni code callbacks
Date: Mon, 28 Sep 2009 12:13:00 -0000	[thread overview]
Message-ID: <4AC0A859.2070407@redhat.com> (raw)
In-Reply-To: <7230133d0909280510w1728ce99i1cda1b41fb8f17e5@mail.gmail.com>

Bryce McKinlay wrote:
> 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.

Well, sure, but it seems to me like this is obvious and almost trivial,
so I don't understand what the problem is.  I'm guessing that it's simply
that no-one ever got around to doing it.

Andrew.

  reply	other threads:[~2009-09-28 12:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-27 13:23 Herman ten Brugge
2009-09-28 12:03 ` Andrew Haley
2009-09-28 12:10   ` Bryce McKinlay
2009-09-28 12:13     ` Andrew Haley [this message]
2009-09-28 19:01     ` Tom Tromey
2009-09-28 19:01   ` Tom Tromey
2009-09-28 19:47     ` Herman ten Brugge
2009-09-28 20:13       ` Andrew Haley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AC0A859.2070407@redhat.com \
    --to=aph@redhat.com \
    --cc=bmckinlay@gmail.com \
    --cc=hermantenbrugge@home.nl \
    --cc=java@gcc.gnu.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).