Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 35221 invoked from network); 21 Dec 2005 14:29:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Dec 2005 14:29:12 -0000 Received: (qmail 97900 invoked by uid 500); 21 Dec 2005 14:29:12 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 97825 invoked by uid 500); 21 Dec 2005 14:29:11 -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 97814 invoked by uid 99); 21 Dec 2005 14:29:10 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Dec 2005 06:29:10 -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; Wed, 21 Dec 2005 06:29:10 -0800 Received: (qmail 35103 invoked by uid 65534); 21 Dec 2005 14:28:49 -0000 Message-ID: <20051221142849.35102.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r358299 - /incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/interp.c Date: Wed, 21 Dec 2005 14:28:49 -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: Wed Dec 21 06:28:46 2005 New Revision: 358299 URL: http://svn.apache.org/viewcvs?rev=358299&view=rev Log: Simple optimization of stack pointer handling for a 2x speedup. Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/interp.c Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/interp.c URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/interp.c?rev=358299&r1=358298&r2=358299&view=diff ============================================================================== --- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/interp.c (original) +++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/interp.c Wed Dec 21 06:28:46 2005 @@ -34,9 +34,8 @@ #define JUMP(_pc) \ do { \ pc = (_pc); \ - _JC_ASSERT(env->sp >= locals + code->max_locals); \ - _JC_ASSERT(env->sp <= locals + code->max_locals \ - + code->max_stack); \ + _JC_ASSERT(sp >= locals + code->max_locals); \ + _JC_ASSERT(sp <= locals + code->max_locals + code->max_stack); \ _JC_ASSERT(pc >= 0 && pc < code->num_insns); \ _JC_ASSERT(actions[code->opcodes[pc]] != NULL); \ _JC_ASSERT(ticker > 0); \ @@ -64,23 +63,23 @@ #endif /* !NDEBUG */ -#define STACKI(i) (*(jint *)(env->sp + (i))) -#define STACKF(i) (*(jfloat *)(env->sp + (i))) -#define STACKJ(i) (*(jlong *)(env->sp + (i))) -#define STACKD(i) (*(jdouble *)(env->sp + (i))) -#define STACKL(i) (*(_jc_object **)(env->sp + (i))) +#define STACKI(i) (*(jint *)(sp + (i))) +#define STACKF(i) (*(jfloat *)(sp + (i))) +#define STACKJ(i) (*(jlong *)(sp + (i))) +#define STACKD(i) (*(jdouble *)(sp + (i))) +#define STACKL(i) (*(_jc_object **)(sp + (i))) #define LOCALI(i) (*(jint *)(locals + i)) #define LOCALF(i) (*(jfloat *)(locals + i)) #define LOCALJ(i) (*(jlong *)(locals + i)) #define LOCALD(i) (*(jdouble *)(locals + i)) #define LOCALL(i) (*(_jc_object **)(locals + i)) -#define PUSHI(v) do { STACKI(0) = (v); env->sp++; } while (0) -#define PUSHF(v) do { STACKF(0) = (v); env->sp++; } while (0) -#define PUSHJ(v) do { STACKJ(0) = (v); env->sp += 2; } while (0) -#define PUSHD(v) do { STACKD(0) = (v); env->sp += 2; } while (0) -#define PUSHL(v) do { STACKL(0) = (v); env->sp++; } while (0) -#define POP(i) (env->sp -= (i)) -#define POP2(i) (env->sp -= 2 * (i)) +#define PUSHI(v) do { STACKI(0) = (v); sp++; } while (0) +#define PUSHF(v) do { STACKF(0) = (v); sp++; } while (0) +#define PUSHJ(v) do { STACKJ(0) = (v); sp += 2; } while (0) +#define PUSHD(v) do { STACKD(0) = (v); sp += 2; } while (0) +#define PUSHL(v) do { STACKL(0) = (v); sp++; } while (0) +#define POP(i) (sp -= (i)) +#define POP2(i) (sp -= 2 * (i)) #define INFO(f) (code->info[pc].f) @@ -258,6 +257,7 @@ _jc_java_stack stack_frame; _jc_word *const locals = env->sp; _jc_object *lock = NULL; + _jc_word *sp; int pc = 0; /* Sanity check */ @@ -309,7 +309,8 @@ stack_frame.method = method; stack_frame.pcp = &pc; env->java_stack = &stack_frame; - env->sp += code->max_locals; + sp = locals + code->max_locals; + env->sp = sp + code->max_stack; /* Sanity check */ _JC_ASSERT(code->opcodes != NULL); @@ -1047,7 +1048,7 @@ /* Invoke native method */ status = _jc_invoke_native_method(env, - imethod, JNI_TRUE, env->sp - invoke->pop); + imethod, JNI_TRUE, sp - invoke->pop); /* Pop the stack */ POP(invoke->pop); @@ -1057,7 +1058,9 @@ POP(invoke->pop); /* Invoke the method */ + env->sp = sp; status = _jc_interp(env, imethod); + env->sp = locals + code->max_locals + code->max_stack; } /* Did method throw an exception? */ @@ -1190,7 +1193,7 @@ PUSHI(_JC_LCMP(STACKJ(0), STACKJ(2))); NEXT(); do_ldc: - memcpy(env->sp, &INFO(constant), sizeof(_jc_word)); + memcpy(sp, &INFO(constant), sizeof(_jc_word)); POP(-1); NEXT(); do_ldc_string: @@ -1223,7 +1226,7 @@ JUMP(pc); } do_ldc2_w: - memcpy(env->sp, &INFO(constant), 2 * sizeof(_jc_word)); + memcpy(sp, &INFO(constant), 2 * sizeof(_jc_word)); POP(-2); NEXT(); do_ldiv: @@ -1554,7 +1557,7 @@ } /* Clear stack, push exception, and proceed with handler */ - env->sp = locals + code->max_locals; + sp = locals + code->max_locals; PUSHL(e); JUMP(trap->target); }