8202080: Introduce ordering semantics for Atomic::add and other RMW atomics

Reviewed-by: lucy, rehn, dholmes
This commit is contained in:
Martin Doerr 2018-05-07 12:28:11 +02:00
parent 6869c08e6a
commit 71a38a4720
15 changed files with 354 additions and 268 deletions

View file

@ -59,7 +59,8 @@ class GlobalCounter::CounterThreadCheck : public ThreadClosure {
void GlobalCounter::write_synchronize() {
assert((*Thread::current()->get_rcu_counter() & COUNTER_ACTIVE) == 0x0, "must be outside a critcal section");
// Atomic::add must provide fence since we have storeload dependency.
volatile uintx gbl_cnt = Atomic::add((uintx)COUNTER_INCREMENT, &_global_counter._counter);
volatile uintx gbl_cnt = Atomic::add((uintx)COUNTER_INCREMENT, &_global_counter._counter,
memory_order_conservative);
// Do all RCU threads.
CounterThreadCheck ctc(gbl_cnt);
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {