locks on X86

Jeff Sturm jsturm@one-point.com
Wed Mar 14 16:17:00 GMT 2001


On 2001年3月14日, Bryce McKinlay wrote:
> Couldn't we change the calling convention so that synchronization happens
> _before_ making a synchronized call?

What about C++ code that invokes a synchronized Java method?
> This wont help for code which uses a
> synchronized block inside the method rather than the synchronized modifier, but
> presumably the modifier is a common case. There is a speed-size tradeoff of
> course, but synchronizing first gives a lot more opportunity for optimizations
> without inlining (synchronizing once for consecutive calls to the same object,
> moving synchronization out of a loop, etc).

Method inlining would also give opportunities to merge synchronization,
or even elminate it if the compiler can prove that an object is not shared
with other threads. I'm not sure if either is a legal optimization
though.
Jeff


More information about the Java mailing list

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