class initialization check overhead
Kresten Krab Thorup
krab@trifork.com
Thu Oct 24 01:21:00 GMT 2002
Adam Megacz wrote:
>> Or perhaps give gcj a list of classes that you know will be referenced
> eventually, and have it run those <clinit>s immediately upon startup.
> You'd have to have a way to figure out the dependency tree... is there
> enough information at runtime to do this? If not, this would either
> require modifications to the linker, which is probably a bad idea.
>
We have to be very careful in modifying the initialization code, since
JLS places some very specific requirements on the order of initialization.
Effectively, all <clinit> *must* run lazily, i.e. at the latest possible
time before the class is used. The reason for this is that <clinit>'s
may depend on one another, so it it not until runtime it can be
determined if there are cyclic problems, and how they should be resolved...
Kresten
More information about the Java
mailing list