diff -r c87fba18f2b9 -r 8bc79d2d1568 src/hotspot/share/runtime/handshake.cpp --- a/src/hotspot/share/runtime/handshake.cpp Sun May 20 22:08:25 2018 +0200 +++ b/src/hotspot/share/runtime/handshake.cpp Sun May 20 22:10:45 2018 +0200 @@ -29,7 +29,7 @@ #include "runtime/handshake.hpp" #include "runtime/interfaceSupport.inline.hpp" #include "runtime/osThread.hpp" -#include "runtime/semaphore.hpp" +#include "runtime/semaphore.inline.hpp" #include "runtime/task.hpp" #include "runtime/timerTrace.hpp" #include "runtime/thread.hpp" @@ -299,8 +299,7 @@ CautiouslyPreserveExceptionMark pem(thread); ThreadInVMForHandshake tivm(thread); if (!_semaphore.trywait()) { - ThreadBlockInVM tbivm(thread); - _semaphore.wait(); + _semaphore.wait_with_safepoint_check(thread); } if (has_operation()) { HandshakeOperation* op = _operation;