src/hotspot/share/runtime/thread.cpp
changeset 54495 941db9c0b5b5
parent 54439 d9b46b7de028
child 54623 1126f0607c70
child 57335 e90b4960bcd6
equal deleted inserted replaced
54494:1bbce3048d20 54495:941db9c0b5b5
  1835 
  1835 
  1836   this->cache_global_variables();
  1836   this->cache_global_variables();
  1837 
  1837 
  1838   // Thread is now sufficiently initialized to be handled by the safepoint code as being
  1838   // Thread is now sufficiently initialized to be handled by the safepoint code as being
  1839   // in the VM. Change thread state from _thread_new to _thread_in_vm
  1839   // in the VM. Change thread state from _thread_new to _thread_in_vm
  1840   ThreadStateTransition::transition_and_fence(this, _thread_new, _thread_in_vm);
  1840   ThreadStateTransition::transition(this, _thread_new, _thread_in_vm);
  1841   // Before a thread is on the threads list it is always safe, so after leaving the
  1841   // Before a thread is on the threads list it is always safe, so after leaving the
  1842   // _thread_new we should emit a instruction barrier. The distance to modified code
  1842   // _thread_new we should emit a instruction barrier. The distance to modified code
  1843   // from here is probably far enough, but this is consistent and safe.
  1843   // from here is probably far enough, but this is consistent and safe.
  1844   OrderAccess::cross_modify_fence();
  1844   OrderAccess::cross_modify_fence();
  1845 
  1845 
  2473 void JavaThread::java_suspend_self_with_safepoint_check() {
  2473 void JavaThread::java_suspend_self_with_safepoint_check() {
  2474   assert(this == Thread::current(), "invariant");
  2474   assert(this == Thread::current(), "invariant");
  2475   JavaThreadState state = thread_state();
  2475   JavaThreadState state = thread_state();
  2476   set_thread_state(_thread_blocked);
  2476   set_thread_state(_thread_blocked);
  2477   java_suspend_self();
  2477   java_suspend_self();
  2478   set_thread_state(state);
  2478   set_thread_state_fence(state);
  2479   // Since we are not using a regular thread-state transition helper here,
  2479   // Since we are not using a regular thread-state transition helper here,
  2480   // we must manually emit the instruction barrier after leaving a safe state.
  2480   // we must manually emit the instruction barrier after leaving a safe state.
  2481   OrderAccess::cross_modify_fence();
  2481   OrderAccess::cross_modify_fence();
  2482   InterfaceSupport::serialize_thread_state_with_handler(this);
       
  2483   if (state != _thread_in_native) {
  2482   if (state != _thread_in_native) {
  2484     SafepointMechanism::block_if_requested(this);
  2483     SafepointMechanism::block_if_requested(this);
  2485   }
  2484   }
  2486 }
  2485 }
  2487 
  2486