diff options
author | Tom Tromey <tromey@redhat.com> | 2001-06-15 23:44:45 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2001-06-15 23:44:45 +0000 |
commit | a5c30a8cff114ff9481bd778d2046f666963bd5f (patch) | |
tree | 34be187e9779f50c059e965818d37043668fb597 /libjava | |
parent | 827a5be702b9cdc019373c545c39c580fa2aff0a (diff) | |
download | gcc-a5c30a8cff114ff9481bd778d2046f666963bd5f.zip gcc-a5c30a8cff114ff9481bd778d2046f666963bd5f.tar.gz gcc-a5c30a8cff114ff9481bd778d2046f666963bd5f.tar.bz2 |
* jni.cc (_Jv_JNI_NewLocalRef): Search other frames.
From-SVN: r43415
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 4 | ||||
-rw-r--r-- | libjava/jni.cc | 23 |
2 files changed, 19 insertions, 8 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 9d20d86..bb1463c 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,5 +1,9 @@ 2001-06-15 Tom Tromey <tromey@redhat.com> + * jni.cc (_Jv_JNI_NewLocalRef): Search other frames. + +2001-06-15 Tom Tromey <tromey@redhat.com> + * java/lang/natRuntime.cc (_Jv_FindSymbolInExecutable): Return NULL if no library on the list has the symbol. (init): Call add_library on the program itself. 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) |