From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16253 invoked by alias); 28 Sep 2009 12:13:22 -0000 Received: (qmail 16242 invoked by uid 22791); 28 Sep 2009 12:13:21 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Sep 2009 12:13:18 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8SCDGS3009836; Mon, 28 Sep 2009 08:13:16 -0400 Received: from zebedee.pink (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8SCDEAa018716; Mon, 28 Sep 2009 08:13:15 -0400 Message-ID: <4AC0A859.2070407@redhat.com> Date: Mon, 28 Sep 2009 12:13:00 -0000 From: Andrew Haley User-Agent: Thunderbird 2.0.0.17 (X11/20081009) MIME-Version: 1.0 To: Bryce McKinlay CC: Herman ten Brugge , java@gcc.gnu.org, Tom Tromey Subject: Re: very slow jni code callbacks References: <4ABF6753.20507@home.nl> <4AC0A614.2040108@redhat.com> <7230133d0909280510w1728ce99i1cda1b41fb8f17e5@mail.gmail.com> In-Reply-To: <7230133d0909280510w1728ce99i1cda1b41fb8f17e5@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg00034.txt.bz2 Bryce McKinlay wrote: > On Mon, Sep 28, 2009 at 1:03 PM, Andrew Haley 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.