This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
class initialization
- To: Java Discuss List <java-discuss at sourceware dot cygnus dot com>
- Subject: class initialization
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 28 Apr 2000 17:35:44 -0600
- Reply-To: tromey at cygnus dot com
A while back Anthony changed the compiler to keep track of whether a
class was already initialized in a given method. This lets us
eliminate some initializations statically, at least when optimization
is enabled.
Today it occurred to me that we currently initialize this local flag
as `0' while we could actually initialize it with `class.state >= 12'.
This is a load, a compare, and a branch per generated call to
_Jv_InitClass. Is this worth doing? When would it hurt?
We could also internally set things up to predict that all classes are
initialized (by using the equivalent of __builtin_expect). This would
make things faster in the case where the class was already
initialized. This one I see an unambiguously good. Making things a
little bit slower when the class needs to be initialized won't hurt.
Tom