Fibonacci and performance

Jeff Sturm jsturm@one-point.com
Mon Apr 30 21:26:00 GMT 2001


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


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /