From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14664 invoked by alias); 28 Sep 2009 12:10:25 -0000 Received: (qmail 14634 invoked by uid 22791); 28 Sep 2009 12:10:24 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-bw0-f225.google.com (HELO mail-bw0-f225.google.com) (209.85.218.225) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Sep 2009 12:10:19 +0000 Received: by bwz25 with SMTP id 25so3276319bwz.8 for ; Mon, 28 Sep 2009 05:10:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.239.154.10 with SMTP id b10mr264460hbc.198.1254139817145; Mon, 28 Sep 2009 05:10:17 -0700 (PDT) In-Reply-To: <4AC0A614.2040108@redhat.com> References: <4ABF6753.20507@home.nl> <4AC0A614.2040108@redhat.com> Date: Mon, 28 Sep 2009 12:10:00 -0000 Message-ID: <7230133d0909280510w1728ce99i1cda1b41fb8f17e5@mail.gmail.com> Subject: Re: very slow jni code callbacks From: Bryce McKinlay To: Andrew Haley Cc: Herman ten Brugge , java@gcc.gnu.org, Tom Tromey Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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/msg00033.txt.bz2 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. =A0I'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. =A0There 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