[kaffe] verifier and threads
Helmer Krämer
hkraemer@freenet.de
Mon Jan 20 05:02:01 2003
On Mon, 20 Jan 2003 02:12:53 -0500 (EST)
gonzo <Robert.N.Gonzalez@williams.edu> wrote:
Hi Rob,
> in the process of linking a class, which involves calls to verify2 and
> verify3, execution can begin on methods in the class, including unverified
> methods. this is particularly weird since at the beginning of verify3 i
> call jthread_disable_stop() which, unless i am mistaken, should not allow
> other code to be run until it calls jthread_enable_stop(). that is, with
> debugging enabled in my verifier i get half of verify3's output before the
> execution of a small main() method starts and ends.
>
> this is kinda weird for two reasons. first, no method in a class should
> be executed until the class is linked. second, if jthread_disable_stop()
> is doing its job a method's code certainly should not executed in the
> middle of verifying it.
>
> can any kaffe thread or class loader experts explain this behavior to me?
I ain't no real expert either but I thought I might
answer you anyway so the real experts can enlighten
me too ;)
AFAIK, jthread_disable_stop() (jthread_enable_stop())
won't disable (enable) execution of other code, they
just prevent the current thread from being stopped by
a call to jthread_stop () (i.e. to prevent the thread
from being stopped while it is the owner of some lock).
If you wanted to disable (enable) execution of all other
threads but the current one, you'd have to call
jthread_suspendall() (jthread_unsuspendall()).
I wouldn't do that in verify.c though, because calls
to verify2 and verify3 should already be protected by
the lock of the class that's being verified (it's
acquired in processClass (), so the thread executing
the verify2 and verify3 methods owns it). So if some
methods get executed while you're verifying them, there's
something else going wrong (unless I missed something).
Could you probably post the class you're using to test
the verifier or a diff of the changes you made in
classMethod.c (if any)? And what type of thread system
do you use? unix-jthreads?
> my other bug is also weird. in Verify3, if you:
> postExceptionMessage(einfo, JAVA_LANG(VerifyError), MSG);
> when the error's thrown it yields a ClassNotFoundException and not a
> VerifyError (though MSG is retained). however, ClassFormatError is found
> easily. i can't seem to figure out why this is.
>
> to reproduce this, simply post a VerifyError in verify2() or verify3().
Can't reproduce this one. If my verify3 () looks like this:
===========8<===========================
bool
verify3(Hjava_lang_Class* class, errorInfo *einfo)
{
postExceptionMessage (einfo, JAVA_LANG(VerifyError), "test, test");
return false;
...
}
===========>8===========================
I get
===========8<===========================
Couldn't find or load essential class `java/lang/Object' java.lang.VerifyError test, test
===========>8===========================
when trying to load a class.
Greetings,
Helmer