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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,7 @@
#include "runtime/commandLineFlagConstraintsRuntime.hpp"
#include "runtime/commandLineFlagRangeList.hpp"
#include "runtime/globals.hpp"
#include "runtime/safepointMechanism.hpp"
#include "runtime/task.hpp"
#include "utilities/defaultStream.hpp"
@ -130,3 +131,17 @@ Flag::Error PerfDataSamplingIntervalFunc(intx value, bool verbose) {
return Flag::SUCCESS;
}
}
Flag::Error ThreadLocalHandshakesConstraintFunc(bool value, bool verbose) {
if (value) {
if (!SafepointMechanism::supports_thread_local_poll()) {
CommandLineError::print(verbose, "ThreadLocalHandshakes not yet supported on this platform\n");
return Flag::VIOLATES_CONSTRAINT;
}
if (UseAOT JVMCI_ONLY(|| EnableJVMCI || UseJVMCICompiler)) {
CommandLineError::print(verbose, "ThreadLocalHandshakes not yet supported in combination with AOT or JVMCI\n");
return Flag::VIOLATES_CONSTRAINT;
}
}
return Flag::SUCCESS;
}