--- old/src/hotspot/share/runtime/globals.hpp 2017-10-23 17:10:24.540123033 +0200 +++ new/src/hotspot/share/runtime/globals.hpp 2017-10-23 17:10:24.090108244 +0200 @@ -605,7 +605,7 @@ "Clean the chunk pool asynchronously") \ \ product(bool, ThreadLocalHandshakes, false, \ - "Enable use of thread local handshake operations") \ + "Use thread-local polls instead of global poll for safepoints.") \ constraint(ThreadLocalHandshakesConstraintFunc,AfterErgo) \ \ diagnostic(uint, HandshakeTimeout, 0, \ --- old/src/hotspot/share/runtime/handshake.cpp 2017-10-23 17:10:26.644192178 +0200 +++ new/src/hotspot/share/runtime/handshake.cpp 2017-10-23 17:10:26.220178244 +0200 @@ -75,6 +75,9 @@ target->set_handshake_operation(_op); } + // This method returns true for threads completed their operation + // and true for threads canceled their operation. + // A cancellation can happen if the thread is exiting. bool poll_for_completed_thread() { return _op->thread_has_completed(); } bool handshake_has_timed_out(jlong start_time); --- old/src/hotspot/share/runtime/safepointMechanism.inline.hpp 2017-10-23 17:10:28.406250084 +0200 +++ new/src/hotspot/share/runtime/safepointMechanism.inline.hpp 2017-10-23 17:10:27.996236610 +0200 @@ -39,11 +39,10 @@ } bool SafepointMechanism::local_poll(Thread* thread) { - // Mutexes can be taken but none JavaThread. These cannot have handshakes - // operation but they must stop for safepoints. if (thread->is_Java_thread()) { return local_poll_armed((JavaThread*)thread); } else { + // If the poll is on a non-java thread we can only check the global state. return global_poll(); } }