aarch64: C2 fast lock/unlock issues

Andrew Haley aph at redhat.com
Wed Sep 2 14:41:02 UTC 2015


On 09/02/2015 03:29 PM, Andrew Haley wrote:
> So any other thread waiting for the counter to hit a value would not
> see it.  And we do not see the writes of other threads.  This is
> wrong.
> 
> (It's also, IIRC, why I rejected this approach before.)

Mmmm, I posted that message too quickly before fully thinking
about it; sorry.

Any Java program which did something like that would be incorrect
because it would be accessing the field n outside the lock, and so
there would be no happens-before relationship between the threads, and
all bets would be off anyway.

But I'm still not happy with this.  At the very least it is rather
odd, and I think that it may be possible to get some surprising
(if not completely illegal) results with it.

Andrew.


More information about the hotspot-compiler-dev mailing list