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 | |
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
-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 9d20d86d6ee..bb1463c4b86 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 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) |