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/05 16:34:49 UTC
svn commit: r366202 - in
/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc:
exception.c interp.c
Author: archie
Date: Thu Jan 5 07:34:47 2006
New Revision: 366202
URL: http://svn.apache.org/viewcvs?rev=366202&view=rev
Log:
Small optimization: increase Java stack space in stack overflow case
when the exception is thrown, not in _jc_interp() where the additional
checking overhead is more costly.
Modified:
incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/exception.c
incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/interp.c
Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/exception.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/exception.c?rev=366202&r1=366201&r2=366202&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/exception.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/exception.c Thu Jan 5 07:34:47 2006
@@ -116,7 +116,7 @@
* one to avoid infinite recursion.
*/
void
-_jc_post_exception_params(_jc_env *env, int num, _jc_word *params)
+_jc_post_exception_params(_jc_env *env, const int num, _jc_word *params)
{
_jc_jvm *const vm = env->vm;
_jc_method *const cons = vm->boot.methods.vmex[num].init;
@@ -155,6 +155,12 @@
/* Enable recursion detection */
env->in_vmex |= (1 << num);
+ /* Release extra stack space during stack overflows */
+ if (num == _JC_StackOverflowError && env->stack_data != NULL) {
+ _JC_ASSERT(env->stack_data_end != NULL);
+ env->stack_data_end += _JC_JAVA_STACK_MARGIN;
+ }
+
/* Verbosity */
if ((env->vm->verbose_flags & (1 << _JC_VERBOSE_EXCEPTIONS)) != 0) {
char *buf = NULL;
@@ -193,6 +199,8 @@
done:
/* Clean up */
env->in_vmex &= ~(1 << num);
+ if (num == _JC_StackOverflowError && env->stack_data != NULL)
+ env->stack_data_end -= _JC_JAVA_STACK_MARGIN;
}
/*
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=366202&r1=366201&r2=366202&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 Thu Jan 5 07:34:47 2006
@@ -352,12 +352,8 @@
/* Check Java stack overflow; release secret space during exception */
if (_JC_UNLIKELY(env->sp + code->max_locals + code->max_stack
> env->stack_data_end)) {
- if ((env->in_vmex & (1 << _JC_StackOverflowError)) == 0
- || env->sp + code->max_locals + code->max_stack
- > env->stack_data_end + _JC_JAVA_STACK_MARGIN) {
- _jc_post_exception(env, _JC_StackOverflowError);
- return JNI_ERR;
- }
+ _jc_post_exception(env, _JC_StackOverflowError);
+ return JNI_ERR;
}
/* Is method abstract? */
@@ -1893,12 +1889,8 @@
/* Check Java stack overflow; release secret space during exception */
if (sp + 1 + method->code.num_params2 > env->stack_data_end) {
- if ((env->in_vmex & (1 << _JC_StackOverflowError)) == 0
- || sp + 1 + method->code.num_params2
- > env->stack_data_end + _JC_JAVA_STACK_MARGIN) {
- _jc_post_exception(env, _JC_StackOverflowError);
- _jc_throw_exception(env);
- }
+ _jc_post_exception(env, _JC_StackOverflowError);
+ _jc_throw_exception(env);
}
/* Push 'this' if method is non-static */