You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ar...@apache.org on 2006/01/02 02:56:17 UTC
svn commit: r365275 - in
/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc:
invoke.c resolve2.c
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 */