[kaffe] circular linking difficulties
rob at kaffe.org
rob at kaffe.org
Sun Jun 27 12:10:22 PDT 2004
It's been some time since I announced  that verifier was pretty much
done, and that turned out to be pretty premature ;). At this point, it is
functionally complete, but will remain off by default until kaffe can run
the usual bad boys--eclipse, ant, jython--with -verifyremote.
Unfortunately, kaffe -verifyremote is choking on most big programs now,
due to internal linking circularity problems. In brief, if class A
requires class B to be linked for verification, and class B requires A to
be linked, then it fails, because the verifier uses the built-in class
loading methods, and getClassFromSignature in particular, to load classes,
and they load a class to state CSTATE_LINKED by default.
I mentioned this last summer, and Helmer  and Tim  both had ideas
of how to fix it. I tried implementing Helmer's idea by creating methods
such as loadClassToState which allows you to choose to what state you want
your class loaded, and found that it didn't work very well, but that could
have been my implentation (in any event, I don't think that solution deals
with the problem when user class loaders are involved). Tim  said that
the only way he managed to solve the linking problem was by loading in a
new thread, which is not ideal.
My current idea is to save all the classes that are currently undergoing
verification in a static hash-table in the verifier. Thus when I need to
lookup a class using it's name/signature, I check the hash table to see if
I'm already working on it, and if not then I go through the normal
getClass() routines. Also not a particularly great solution.
Does anybody see a good way to deal with this problem? If it helps, I can
post a couple Java classes that display the error in the current CVS head
when it's run with -verifyremote as an option.
More information about the kaffe