This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: Gcj
- To: krab@venus.is.s.u-tokyo.ac.jp
- Subject: Re: Gcj
- From: Anthony Green <green@cygnus.com>
- Date: Mon, 26 Jul 1999 23:46:43 -0700 (PDT)
- CC: java-discuss@sourceware.cygnus.com
Kresten wrote:
> Since I started using gcj for this verifier I'm writing, it has
> started to annoy me that it is so expensive to use static methods.
> But maybe it would be worth it to compile
> static method calls using an indirection, and then flip that
> indirection pointer the first time it is used?
> And it would also bring gcj closer to spec; the initialization is
> supposed to happen *at* the first real use.
Hmmm.. I'm pretty sure we implement correct semantics - but your
quality of implementation issues are valid.
The indirect call scheme might be reasonable in some cases.
For many classes, however, the main function of initialization is to
intern string constants. There are some linker tricks we could
implement that might eliminate this step. Another simple trick I'd
like to see implemented looks like this...
In a method M, for each class C requiring initialization, have the
compiler declare a new local called Ci. Instead of unconditional
calls to the initialization routine, emit them as:
if (! Ci)
{
_Jv_InitClass (C);
Ci = 1;
}
The compiler will then magically eliminate redundant calls to
_Jv_InitClass within methods via simple constant propagation. This
shows up a lot.
AG
--
Anthony Green Cygnus Solutions
Sunnyvale, California
- References:
- Re: Gcj
- From: Kresten Krab Thorup <krab@yl.is.s.u-tokyo.ac.jp>