This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Fibonacci and performance
- To: Tom Tromey <tromey at redhat dot com>
- Subject: Re: Fibonacci and performance
- From: Jeff Sturm <jsturm at one-point dot com>
- Date: Tue, 1 May 2001 00:31:17 -0400 (EDT)
- cc: "Boehm, Hans" <hans_boehm at hp dot com>, "'green at redhat dot com'" <green at redhat dot com>, Java Discuss List <java at gcc dot gnu dot org>
On 30 Apr 2001, Tom Tromey wrote:
> But Hans is saying that in AG's scenario the check of the method-local
> flag could be reordered with respect to access to class variables,
> unless the flag is volatile.
Reordered by the compiler, or hardware?
> if (! method-local-flag) { _Jv_InitClass (...); m-l-f = true; }
>
> Will the compiler really pull a class variable access before this?
> I don't see how it could do that.
Me either. The compiler can't predict the side effects of the function
call, so it must reload global data following the call.
If _Jv_InitClass is properly synchronized, there is no danger here of
reordering by the processor. That's where we probably have a bug: the
short-circuit test isn't synchronized.
> Maybe we could introduce our own java-specific tree code representing
> class initialization, which is only expanded ("lowered") to generic
> tree codes later on.
That's what I was thinking. By using higher-level tree nodes during
parsing we could eliminate a lot of cruft anyway. Then run tree-based
optimizations before expanding. (Maybe we could even generate .class and
.s output in one pass with a little more rework.)
Jeff