< prev index next >
src/hotspot/share/runtime/safepoint.cpp
Print this page
rev 50878 : 8206003: SafepointSynchronize with TLH: StoreStore barriers should be moved out of the loop
Reviewed-by:
*** 241,253 ****
_state = _synchronizing;
if (SafepointMechanism::uses_thread_local_poll()) {
// Arming the per thread poll while having _state != _not_synchronized means safepointing
log_trace(safepoint)("Setting thread local yield flag for threads");
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *cur = jtiwh.next(); ) {
// Make sure the threads start polling, it is time to yield.
! SafepointMechanism::arm_local_poll(cur); // release store, global state -> local state
}
}
OrderAccess::fence(); // storestore|storeload, global state -> local state
// Flush all thread states to memory
--- 241,254 ----
_state = _synchronizing;
if (SafepointMechanism::uses_thread_local_poll()) {
// Arming the per thread poll while having _state != _not_synchronized means safepointing
log_trace(safepoint)("Setting thread local yield flag for threads");
+ OrderAccess::storestore(); // storestore, global state -> local state
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *cur = jtiwh.next(); ) {
// Make sure the threads start polling, it is time to yield.
! SafepointMechanism::arm_local_poll_no_release(cur);
}
}
OrderAccess::fence(); // storestore|storeload, global state -> local state
// Flush all thread states to memory
*** 544,554 ****
OrderAccess::storestore(); // global state -> local state
jtiwh.rewind();
for (; JavaThread *current = jtiwh.next(); ) {
ThreadSafepointState* cur_state = current->safepoint_state();
cur_state->restart(); // TSS _running
! SafepointMechanism::disarm_local_poll(current); // release store, local state -> polling page
}
log_info(safepoint)("Leaving safepoint region");
} else {
// Set to not synchronized, so the threads will not go into the signal_thread_blocked method
// when they get restarted.
--- 545,555 ----
OrderAccess::storestore(); // global state -> local state
jtiwh.rewind();
for (; JavaThread *current = jtiwh.next(); ) {
ThreadSafepointState* cur_state = current->safepoint_state();
cur_state->restart(); // TSS _running
! SafepointMechanism::disarm_local_poll_no_release(current);
}
log_info(safepoint)("Leaving safepoint region");
} else {
// Set to not synchronized, so the threads will not go into the signal_thread_blocked method
// when they get restarted.
< prev index next >