diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-15 23:44:45 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-15 23:44:45 +0000 |
commit | 01310292e9a9d53ceb1ee12d2611bce634ef1ea1 (patch) | |
tree | 34be187e9779f50c059e965818d37043668fb597 /libjava/jni.cc | |
parent | c2c69f3bcb396cba7503e6bb01db18eee7430dcd (diff) | |
download | gcc-01310292e9a9d53ceb1ee12d2611bce634ef1ea1.tar.gz |
* jni.cc (_Jv_JNI_NewLocalRef): Search other frames.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43415 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/jni.cc')
-rw-r--r-- | libjava/jni.cc | 23 |
1 files changed, 15 insertions, 8 deletions
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) |