mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8366038: Thread::SpinRelease should use Atomic::release_store
Reviewed-by: dholmes, ayang
This commit is contained in:
parent
f4d73d2a3d
commit
4d1dfabcb4
@ -602,7 +602,6 @@ void Thread::SpinAcquire(volatile int * adr) {
|
||||
|
||||
void Thread::SpinRelease(volatile int * adr) {
|
||||
assert(*adr != 0, "invariant");
|
||||
OrderAccess::fence(); // guarantee at least release consistency.
|
||||
// Roach-motel semantics.
|
||||
// It's safe if subsequent LDs and STs float "up" into the critical section,
|
||||
// but prior LDs and STs within the critical section can't be allowed
|
||||
@ -610,8 +609,7 @@ void Thread::SpinRelease(volatile int * adr) {
|
||||
// Loads and stores in the critical section - which appear in program
|
||||
// order before the store that releases the lock - must also appear
|
||||
// before the store that releases the lock in memory visibility order.
|
||||
// Conceptually we need a #loadstore|#storestore "release" MEMBAR before
|
||||
// the ST of 0 into the lock-word which releases the lock, so fence
|
||||
// more than covers this on all platforms.
|
||||
*adr = 0;
|
||||
// So we need a #loadstore|#storestore "release" memory barrier before
|
||||
// the ST of 0 into the lock-word which releases the lock.
|
||||
Atomic::release_store(adr, 0);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user