From: Tom Tromey Date: Fri, 15 Jun 2001 23:44:45 +0000 (+0000) Subject: * jni.cc (_Jv_JNI_NewLocalRef): Search other frames. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a5c30a8cff114ff9481bd778d2046f666963bd5f;p=gcc.git * jni.cc (_Jv_JNI_NewLocalRef): Search other frames. From-SVN: r43415 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 9d20d86d6ee..bb1463c4b86 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,7 @@ +2001-06-15 Tom Tromey + + * jni.cc (_Jv_JNI_NewLocalRef): Search other frames. + 2001-06-15 Tom Tromey * java/lang/natRuntime.cc (_Jv_FindSymbolInExecutable): Return diff --git a/libjava/jni.cc b/libjava/jni.cc index 15f69bcce70..3944b0e0bea 100644 --- a/libjava/jni.cc +++ b/libjava/jni.cc @@ -278,16 +278,23 @@ _Jv_JNI_NewLocalRef (JNIEnv *env, jobject obj) // Try to find an open slot somewhere in the topmost frame. _Jv_JNI_LocalFrame *frame = env->locals; bool done = false, set = false; - while (frame != NULL && ! done) + for (; frame != NULL && ! done; frame = frame->next) { for (int i = 0; i < frame->size; ++i) - if (frame->vec[i] == NULL) - { - set = true; - done = true; - frame->vec[i] = obj; - break; - } + { + if (frame->vec[i] == NULL) + { + set = true; + done = true; + frame->vec[i] = obj; + break; + } + } + + // If we found a slot, or if the frame we just searched is the + // mark frame, then we are done. + if (done || frame->marker != MARK_NONE) + break; } if (! set)