8189941: Implementation JEP 312: Thread-local handshake

Introduce a way to execute a callback on threads without performing a global VM safepoint. Make it both possible and cheap to stop individual threads and not just all threads or none.

Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Erik Osterlund <erik.osterlund@oracle.com>
Reviewed-by: mdoerr, neliasso, acorn, aph, coleenp, dholmes
This commit is contained in:
Robbin Ehn 2017-08-31 10:00:28 +02:00
parent fdee542113
commit 104ecb2dd1
73 changed files with 1847 additions and 325 deletions

View file

@ -35,6 +35,7 @@
#include "runtime/objectMonitor.inline.hpp"
#include "runtime/orderAccess.inline.hpp"
#include "runtime/osThread.hpp"
#include "runtime/safepointMechanism.inline.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.inline.hpp"
#include "services/threadService.hpp"
@ -1282,7 +1283,7 @@ void ObjectMonitor::ExitEpilog(Thread * Self, ObjectWaiter * Wakee) {
OrderAccess::release_store(&_owner, (void*)NULL);
OrderAccess::fence(); // ST _owner vs LD in unpark()
if (SafepointSynchronize::do_call_back()) {
if (SafepointMechanism::poll(Self)) {
TEVENT(unpark before SAFEPOINT);
}
@ -1936,7 +1937,7 @@ int ObjectMonitor::TrySpin(Thread * Self) {
// This is in keeping with the "no loitering in runtime" rule.
// We periodically check to see if there's a safepoint pending.
if ((ctr & 0xFF) == 0) {
if (SafepointSynchronize::do_call_back()) {
if (SafepointMechanism::poll(Self)) {
TEVENT(Spin: safepoint);
goto Abort; // abrupt spin egress
}