class initialization check overhead

Andrew Haley aph@redhat.com
Sun Dec 15 05:06:00 GMT 2002


Jeff Sturm writes:
 > On 25 Nov 2002, Tom Tromey wrote:
 > > Jeff> Come to think of it... what if compiled classes were prepared
 > > Jeff> early instead of at initialization time?  In my application of
 > > Jeff> 191 classes, only 36 have a <clinit>.  If the frontend knows
 > > Jeff> that a class invokes no <clinit> method (directly or in a
 > > Jeff> superclass), could the _Jv_InitClass be dropped entirely?
 > >
 > > Yes, with caveats.
 > >
 > > I think there are two cases to consider.
 > >
 > > First, the general case.  Once we have the full binary compatibility
 > > code in place, we won't be able to omit class initialization calls.
 > 
 > I agree.  For full binary compatibility, I'd eventually like
 > -fno-assume-compiled and -findirect-dispatch to work together.  Entire
 > packages could be compiled to native code with direct references to
 > classes in the same package, while assuming nothing about other packages.
 > 
 > I think that could yield a good compromise of optimization and
 > compatibility.

Absolutely right.  Sorry to post a "me too" message, but this is the
way I've been thinking gcj should go.

Andrew.



More information about the Java mailing list