Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 22097 invoked from network); 2 Jan 2006 01:56:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Jan 2006 01:56:40 -0000 Received: (qmail 13889 invoked by uid 500); 2 Jan 2006 01:56:39 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 13820 invoked by uid 500); 2 Jan 2006 01:56:38 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 13806 invoked by uid 99); 2 Jan 2006 01:56:38 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jan 2006 17:56:38 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 01 Jan 2006 17:56:37 -0800 Received: (qmail 21996 invoked by uid 65534); 2 Jan 2006 01:56:17 -0000 Message-ID: <20060102015617.21995.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r365275 - in /incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc: invoke.c resolve2.c Date: Mon, 02 Jan 2006 01:56:17 -0000 To: harmony-commits@incubator.apache.org From: archie@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: archie Date: Sun Jan 1 17:56:13 2006 New Revision: 365275 URL: http://svn.apache.org/viewcvs?rev=365275&view=rev Log: Small optimization: pre-compute # stack parameter words for all methods (including native ones). Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/invoke.c incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve2.c Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/invoke.c URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/invoke.c?rev=365275&r1=365274&r2=365275&view=diff ============================================================================== --- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/invoke.c (original) +++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/invoke.c Sun Jan 1 17:56:13 2006 @@ -398,19 +398,12 @@ const void *func, _jc_object *obj, va_list args, jboolean jni) { _jc_word *params; - int nwords; int pi; int i; - /* Count parameter words */ - nwords = method->num_parameters; - for (i = 0; i < method->num_parameters; i++) { - if (_jc_dword_type[method->param_ptypes[i]]) - nwords++; - } - /* Allocate array of _jc_word's to hold the parameters */ - if ((params = _JC_STACK_ALLOC(env, nwords * sizeof(*params))) == NULL) { + if ((params = _JC_STACK_ALLOC(env, + method->code.num_params2 * sizeof(*params))) == NULL) { _jc_post_exception_info(env); return JNI_ERR; } @@ -480,19 +473,12 @@ { _jc_word *params; _jc_object *this; - int nwords; int pi; int i; - /* Count parameter words */ - nwords = method->num_parameters; - for (i = 0; i < method->num_parameters; i++) { - if (_jc_dword_type[method->param_ptypes[i]]) - nwords++; - } - /* Allocate array of _jc_word's to hold the parameters */ - if ((params = _JC_STACK_ALLOC(env, nwords * sizeof(*params))) == NULL) { + if ((params = _JC_STACK_ALLOC(env, + method->code.num_params2 * sizeof(*params))) == NULL) { _jc_post_exception_info(env); return JNI_ERR; } @@ -735,19 +721,12 @@ { _jc_word *params; _jc_object *this; - int nwords; int pi; int i; - /* Count parameter words */ - nwords = method->num_parameters; - for (i = 0; i < method->num_parameters; i++) { - if (_jc_dword_type[method->param_ptypes[i]]) - nwords++; - } - /* Allocate array of _jc_word's to hold the parameters */ - if ((params = _JC_STACK_ALLOC(env, nwords * sizeof(*params))) == NULL) { + if ((params = _JC_STACK_ALLOC(env, + method->code.num_params2 * sizeof(*params))) == NULL) { _jc_post_exception_info(env); return JNI_ERR; } Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve2.c URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve2.c?rev=365275&r1=365274&r2=365275&view=diff ============================================================================== --- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve2.c (original) +++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve2.c Sun Jan 1 17:56:13 2006 @@ -324,6 +324,14 @@ return JNI_ERR; } + /* Determine parameter count with long/double counted twice */ + _JC_ASSERT(method->code.num_params2 == 0); + method->code.num_params2 = method->num_parameters; + for (j = 0; j < method->num_parameters; j++) { + if (_jc_dword_type[method->param_ptypes[j]]) + method->code.num_params2++; + } + /* Resolve exception types */ for (j = 0; j < method->num_exceptions; j++) { if ((method->exceptions[j] = _jc_load_type(env, loader, @@ -499,7 +507,6 @@ } /* Allocate resolved method info */ - memset(interp, 0, sizeof(*interp)); _JC_MUTEX_LOCK(env, loader->mutex); mutex_locked = JNI_TRUE; if ((interp->opcodes = _jc_cl_alloc(env, loader, @@ -531,14 +538,6 @@ linemap->index = clinemap->index; linemap->line = clinemap->line; - } - - /* Determine parameter count with long/double counted twice */ - _JC_ASSERT(interp->num_params2 == 0); - interp->num_params2 = method->num_parameters; - for (i = 0; i < method->num_parameters; i++) { - if (_jc_dword_type[method->param_ptypes[i]]) - interp->num_params2++; } /* Resolve and copy trap info */