This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Fix for the env->klass field value in _Jv_JNIMethod::call
On Sun, 2006-07-30 at 19:44 +0700, Ivan Dubrov wrote:
> Mark Wielaard wrote:
> > It is probably never correct. We were most likely just lucky that no JNI
> > library ever tried to load classes not found through the system class
> > loader. So we probably should just update env->klass inside
> > _Jv_GetJNIEnvNewFrame itself, just like we reset the pending exception.
> > _Jv_GetJNIEnvNewFrame already gets the defining class as argument.
> >
>
> And how about restoring the old value after the call? For example, when
> native method calls native method of other class. I think, in this case
> after the call to the second native method klass should be restored to
> the class of the first native method.
You are right. I had missed that.
Ideally this would have been taken care of by _Jv_JNI_PopSystemFrame,
but that doesn't actually have the knowledge of the native method/klass
call nesting. Maybe we need to add a prev_klass field to
_Jv_JNI_LocalFrame so it can be restored if needed?
This is getting hairy though, your patch to just unconditionally set and
restore the klass field in the env is much clearer.
Thanks,
Mark