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

@ -2190,10 +2190,6 @@ int os::signal_wait() {
static int page_size = -1;
// The mmap MAP_ALIGN flag is supported on Solaris 9 and later. init_2() will
// clear this var if support is not available.
static bool has_map_align = true;
int os::vm_page_size() {
assert(page_size != -1, "must call os::init");
return page_size;
@ -2560,7 +2556,7 @@ char* os::Solaris::anon_mmap(char* requested_addr, size_t bytes,
if (fixed) {
flags |= MAP_FIXED;
} else if (has_map_align && (alignment_hint > (size_t) vm_page_size())) {
} else if (alignment_hint > (size_t) vm_page_size()) {
flags |= MAP_ALIGN;
addr = (char*) alignment_hint;
}
@ -4222,28 +4218,6 @@ jint os::init_2(void) {
// try to enable extended file IO ASAP, see 6431278
os::Solaris::try_enable_extended_io();
// Allocate a single page and mark it as readable for safepoint polling. Also
// use this first mmap call to check support for MAP_ALIGN.
address polling_page = (address)Solaris::mmap_chunk((char*)page_size,
page_size,
MAP_PRIVATE | MAP_ALIGN,
PROT_READ);
if (polling_page == NULL) {
has_map_align = false;
polling_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE,
PROT_READ);
}
os::set_polling_page(polling_page);
log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page));
if (!UseMembar) {
address mem_serialize_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE);
guarantee(mem_serialize_page != NULL, "mmap Failed for memory serialize page");
os::set_memory_serialize_page(mem_serialize_page);
log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(mem_serialize_page));
}
// Check and sets minimum stack sizes against command line options
if (Posix::set_minimum_stack_sizes() == JNI_ERR) {
return JNI_ERR;