From a5c30a8cff114ff9481bd778d2046f666963bd5f Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 15 Jun 2001 23:44:45 +0000 Subject: * jni.cc (_Jv_JNI_NewLocalRef): Search other frames. From-SVN: r43415 --- libjava/jni.cc | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'libjava/jni.cc') diff --git a/libjava/jni.cc b/libjava/jni.cc index 15f69bc..3944b0e 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) -- cgit v1.1