src/hotspot/share/runtime/safepoint.cpp
changeset 50921 7f462e8383f6
parent 50429 83aec1d357d4
child 50966 f939a67fea30
equal deleted inserted replaced
50920:d9160a3c97c1 50921:7f462e8383f6
   241     _state            = _synchronizing;
   241     _state            = _synchronizing;
   242 
   242 
   243     if (SafepointMechanism::uses_thread_local_poll()) {
   243     if (SafepointMechanism::uses_thread_local_poll()) {
   244       // Arming the per thread poll while having _state != _not_synchronized means safepointing
   244       // Arming the per thread poll while having _state != _not_synchronized means safepointing
   245       log_trace(safepoint)("Setting thread local yield flag for threads");
   245       log_trace(safepoint)("Setting thread local yield flag for threads");
       
   246       OrderAccess::storestore(); // storestore, global state -> local state
   246       for (JavaThreadIteratorWithHandle jtiwh; JavaThread *cur = jtiwh.next(); ) {
   247       for (JavaThreadIteratorWithHandle jtiwh; JavaThread *cur = jtiwh.next(); ) {
   247         // Make sure the threads start polling, it is time to yield.
   248         // Make sure the threads start polling, it is time to yield.
   248         SafepointMechanism::arm_local_poll(cur); // release store, global state -> local state
   249         SafepointMechanism::arm_local_poll(cur);
   249       }
   250       }
   250     }
   251     }
   251     OrderAccess::fence(); // storestore|storeload, global state -> local state
   252     OrderAccess::fence(); // storestore|storeload, global state -> local state
   252 
   253 
   253     // Flush all thread states to memory
   254     // Flush all thread states to memory
   544         OrderAccess::storestore(); // global state -> local state
   545         OrderAccess::storestore(); // global state -> local state
   545         jtiwh.rewind();
   546         jtiwh.rewind();
   546         for (; JavaThread *current = jtiwh.next(); ) {
   547         for (; JavaThread *current = jtiwh.next(); ) {
   547           ThreadSafepointState* cur_state = current->safepoint_state();
   548           ThreadSafepointState* cur_state = current->safepoint_state();
   548           cur_state->restart(); // TSS _running
   549           cur_state->restart(); // TSS _running
   549           SafepointMechanism::disarm_local_poll(current); // release store, local state -> polling page
   550           SafepointMechanism::disarm_local_poll(current);
   550         }
   551         }
   551         log_info(safepoint)("Leaving safepoint region");
   552         log_info(safepoint)("Leaving safepoint region");
   552       } else {
   553       } else {
   553         // Set to not synchronized, so the threads will not go into the signal_thread_blocked method
   554         // Set to not synchronized, so the threads will not go into the signal_thread_blocked method
   554         // when they get restarted.
   555         // when they get restarted.