This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Is this bugfix correct (jni.cc)?
- To: java at gcc dot gnu dot org
- Subject: Re: Is this bugfix correct (jni.cc)?
- From: Martin Kahlert <martin dot kahlert at infineon dot com>
- Date: Wed, 9 May 2001 08:43:28 +0200
- Cc: java-patches at gcc dot gnu dot org
- References: <20010508170407.A2474@keksy.muc.infineon.com>
- Reply-To: martin dot kahlert at infineon dot com
Hi!
Sorry to reply to my own mail, but i assume, that the previous patch is not
correct. I changed it to repeat the search on frame->next instead of giving
up.
Additionally i removed the variable done, since it has always the same value
as the variable set, so i used this one instead.
Bye,
Martin.
2001-05-09 Martin Kahlert <martin.kahlert@infineon.com>
* jni.cc (_Jv_JNI_NewLocalRef): Search next frame, if
we could not find free slot in this one. Fixes infinite loop.
*** jni.cc.orig Tue May 8 16:59:35 2001
--- jni.cc Wed May 9 08:38:38 2001
***************
*** 280,296 ****
{
// 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 (int i = 0; i < frame->size; ++i)
if (frame->vec[i] == NULL)
{
set = true;
- done = true;
frame->vec[i] = obj;
break;
}
}
if (! set)
--- 280,296 ----
{
// Try to find an open slot somewhere in the topmost frame.
_Jv_JNI_LocalFrame *frame = env->locals;
! bool set = false;
! while (frame != NULL && ! set)
{
for (int i = 0; i < frame->size; ++i)
if (frame->vec[i] == NULL)
{
set = true;
frame->vec[i] = obj;
break;
}
+ frame = frame->next;
}
if (! set)
--
The early bird gets the worm. If you want something else for
breakfast, get up later.