src/hotspot/share/runtime/handshake.cpp
changeset 54033 07540197d0fd
parent 53775 5d20b085d893
child 54323 846bc643f4ef
--- a/src/hotspot/share/runtime/handshake.cpp	Fri Mar 08 12:01:43 2019 +0100
+++ b/src/hotspot/share/runtime/handshake.cpp	Fri Mar 08 12:51:36 2019 +0100
@@ -288,13 +288,14 @@
   assert(Thread::current() == thread, "should call from thread");
   assert(!thread->is_terminated(), "should not be a terminated thread");
 
-  CautiouslyPreserveExceptionMark pem(thread);
   ThreadInVMForHandshake tivm(thread);
   if (!_semaphore.trywait()) {
     _semaphore.wait_with_safepoint_check(thread);
   }
   HandshakeOperation* op = OrderAccess::load_acquire(&_operation);
   if (op != NULL) {
+    HandleMark hm(thread);
+    CautiouslyPreserveExceptionMark pem(thread);
     // Disarm before execute the operation
     clear_handshake(thread);
     op->do_handshake(thread);