src/hotspot/share/runtime/handshake.cpp
changeset 59273 9170826a3d76
parent 59247 56bf71d64d51
child 59290 97d13893ec3c
equal deleted inserted replaced
59270:d5a1c6545a2b 59273:9170826a3d76
   287 }
   287 }
   288 
   288 
   289 void HandshakeState::process_self_inner(JavaThread* thread) {
   289 void HandshakeState::process_self_inner(JavaThread* thread) {
   290   assert(Thread::current() == thread, "should call from thread");
   290   assert(Thread::current() == thread, "should call from thread");
   291   assert(!thread->is_terminated(), "should not be a terminated thread");
   291   assert(!thread->is_terminated(), "should not be a terminated thread");
   292 
   292   assert(thread->thread_state() != _thread_blocked, "should not be in a blocked state");
   293   ThreadInVMForHandshake tivm(thread);
   293   assert(thread->thread_state() != _thread_in_native, "should not be in native");
   294   if (!_semaphore.trywait()) {
   294 
   295     _semaphore.wait_with_safepoint_check(thread);
   295   do {
   296   }
   296     ThreadInVMForHandshake tivm(thread);
   297   HandshakeOperation* op = Atomic::load_acquire(&_operation);
   297     if (!_semaphore.trywait()) {
   298   if (op != NULL) {
   298       _semaphore.wait_with_safepoint_check(thread);
   299     HandleMark hm(thread);
   299     }
   300     CautiouslyPreserveExceptionMark pem(thread);
   300     HandshakeOperation* op = Atomic::load_acquire(&_operation);
   301     // Disarm before execute the operation
   301     if (op != NULL) {
   302     clear_handshake(thread);
   302       HandleMark hm(thread);
   303     op->do_handshake(thread);
   303       CautiouslyPreserveExceptionMark pem(thread);
   304   }
   304       // Disarm before execute the operation
   305   _semaphore.signal();
   305       clear_handshake(thread);
       
   306       op->do_handshake(thread);
       
   307     }
       
   308     _semaphore.signal();
       
   309   } while (has_operation());
   306 }
   310 }
   307 
   311 
   308 bool HandshakeState::vmthread_can_process_handshake(JavaThread* target) {
   312 bool HandshakeState::vmthread_can_process_handshake(JavaThread* target) {
   309   // handshake_safe may only be called with polls armed.
   313   // handshake_safe may only be called with polls armed.
   310   // VM thread controls this by first claiming the handshake via claim_handshake_for_vmthread.
   314   // VM thread controls this by first claiming the handshake via claim_handshake_for_vmthread.