This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: java: suppress java.lang.Object constructor




On 17 Jul 2001, Tom Tromey wrote:
> Jeff> This patch prevents adding the implicit call to super's
> Jeff> constructor in classes derived from java.lang.Object.  It's a
> Jeff> simple and straightforward optimization since java.lang.Object's
> Jeff> constructor is an empty function.
> 
> Is it hard to do this in a general way?

Perhaps not.  For classes loaded from bytecode however, checking for the
existence of <init> isn't sufficient.  (If one is going to go to the
trouble, might as well write a tree inliner...)

> Another idea in this same area is to change what `new' does depending
> on whether the class has a finalizer.  We could even inline the class
> init call and then directly call into the GC for allocation when there
> is no finalizer.  Hans has mentioned this as a win several times.  In
> case you're interested...

That sounds good.  I see a disproportionate number of cache misses in
_Jv_AllocObject, ostensibly due to the finalizer check (java.lang.Object's
vtable is seldom used otherwise).

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]