--- old/src/os/solaris/vm/jvm_solaris.h 2017-03-16 08:34:40.513372837 -0400 +++ new/src/os/solaris/vm/jvm_solaris.h 2017-03-16 08:34:38.537258536 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -85,7 +85,7 @@ /* Signal definitions */ #define BREAK_SIGNAL SIGQUIT /* Thread dumping support. */ -#define ASYNC_SIGNAL SIGUSR2 /* Watcher & async err support. */ +#define ASYNC_SIGNAL SIGJVM2 /* Event-based suspend/resume support */ #define SHUTDOWN1_SIGNAL SIGHUP /* Shutdown Hooks support. */ #define SHUTDOWN2_SIGNAL SIGINT #define SHUTDOWN3_SIGNAL SIGTERM --- old/src/os/solaris/vm/os_solaris.cpp 2017-03-16 08:34:46.509719671 -0400 +++ new/src/os/solaris/vm/os_solaris.cpp 2017-03-16 08:34:44.537605602 -0400 @@ -1013,21 +1013,9 @@ return true; } -// defined for >= Solaris 10. This allows builds on earlier versions -// of Solaris to take advantage of the newly reserved Solaris JVM signals. -// With SIGJVM1, SIGJVM2, ASYNC_SIGNAL is SIGJVM2. Previously INTERRUPT_SIGNAL -// was SIGJVM1. -// -#if !defined(SIGJVM1) - #define SIGJVM1 39 - #define SIGJVM2 40 -#endif - debug_only(static bool signal_sets_initialized = false); static sigset_t unblocked_sigs, vm_sigs, allowdebug_blocked_sigs; -int os::Solaris::_SIGasync = ASYNC_SIGNAL; - bool os::Solaris::is_sig_ignored(int sig) { struct sigaction oact; sigaction(sig, (struct sigaction*)NULL, &oact); @@ -1040,12 +1028,6 @@ } } -// Note: SIGRTMIN is a macro that calls sysconf() so it will -// dynamically detect SIGRTMIN value for the system at runtime, not buildtime -static bool isJVM1available() { - return SIGJVM1 < SIGRTMIN; -} - void os::Solaris::signal_sets_init() { // Should also have an assertion stating we are still single-threaded. assert(!signal_sets_initialized, "Already initialized"); @@ -1068,12 +1050,7 @@ sigaddset(&unblocked_sigs, SIGSEGV); sigaddset(&unblocked_sigs, SIGBUS); sigaddset(&unblocked_sigs, SIGFPE); - - // Always true on Solaris 10+ - guarantee(isJVM1available(), "SIGJVM1/2 missing!"); - os::Solaris::set_SIGasync(SIGJVM2); - - sigaddset(&unblocked_sigs, os::Solaris::SIGasync()); + sigaddset(&unblocked_sigs, ASYNC_SIGNAL); if (!ReduceSignalUsage) { if (!os::Solaris::is_sig_ignored(SHUTDOWN1_SIGNAL)) { @@ -1918,7 +1895,6 @@ // Moved from whole group, because we need them here for diagnostic // prints. -#define OLDMAXSIGNUM 32 static int Maxsignum = 0; static int *ourSigFlags = NULL; @@ -2011,7 +1987,6 @@ print_signal_handler(st, SHUTDOWN1_SIGNAL , buf, buflen); print_signal_handler(st, SHUTDOWN2_SIGNAL , buf, buflen); print_signal_handler(st, SHUTDOWN3_SIGNAL, buf, buflen); - print_signal_handler(st, os::Solaris::SIGasync(), buf, buflen); } static char saved_jvm_path[MAXPATHLEN] = { 0 }; @@ -2179,14 +2154,12 @@ // a counter for each possible signal value static int Sigexit = 0; -static int Maxlibjsigsigs; static jint *pending_signals = NULL; static int *preinstalled_sigs = NULL; static struct sigaction *chainedsigactions = NULL; static sema_t sig_sem; typedef int (*version_getting_t)(); version_getting_t os::Solaris::get_libjsig_version = NULL; -static int libjsigversion = NULL; int os::sigexitnum_pd() { assert(Sigexit > 0, "signal memory not yet initialized"); @@ -2199,8 +2172,6 @@ Sigexit = Maxsignum+1; assert(Maxsignum >0, "Unable to obtain max signal number"); - Maxlibjsigsigs = Maxsignum; - // pending_signals has one int per signal // The additional signal is for SIGEXIT - exit signal to signal_thread pending_signals = (jint *)os::malloc(sizeof(jint) * (Sigexit+1), mtInternal); @@ -3564,7 +3535,7 @@ // get current set of blocked signals and unblock resume signal pthread_sigmask(SIG_BLOCK, NULL, &suspend_set); - sigdelset(&suspend_set, os::Solaris::SIGasync()); + sigdelset(&suspend_set, ASYNC_SIGNAL); sr_semaphore.signal(); // wait here until we are resumed @@ -3619,7 +3590,7 @@ } static int sr_notify(OSThread* osthread) { - int status = thr_kill(osthread->thread_id(), os::Solaris::SIGasync()); + int status = thr_kill(osthread->thread_id(), ASYNC_SIGNAL); assert_status(status == 0, status, "thr_kill"); return status; } @@ -3764,7 +3735,7 @@ // // This routine may recognize any of the following kinds of signals: // SIGBUS, SIGSEGV, SIGILL, SIGFPE, BREAK_SIGNAL, SIGPIPE, SIGXFSZ, -// os::Solaris::SIGasync +// ASYNC_SIGNAL. // It should be consulted by handlers for any of those signals. // // The caller of this routine must pass in the three arguments supplied @@ -3799,7 +3770,7 @@ struct sigaction* os::Solaris::get_chained_signal_action(int sig) { struct sigaction *actp = NULL; - if ((libjsig_is_loaded) && (sig <= Maxlibjsigsigs)) { + if ((libjsig_is_loaded) && (sig <= Maxsignum)) { // Retrieve the old signal handler from libjsig actp = (*get_signal_action)(sig); } @@ -3974,8 +3945,7 @@ DO_SIGNAL_CHECK(BREAK_SIGNAL); } - // See comments above for using JVM1/JVM2 - DO_SIGNAL_CHECK(os::Solaris::SIGasync()); + DO_SIGNAL_CHECK(ASYNC_SIGNAL); } @@ -4008,6 +3978,7 @@ case SIGPIPE: case SIGXFSZ: case SIGILL: + case ASYNC_SIGNAL: jvmHandler = CAST_FROM_FN_PTR(address, signalHandler); break; @@ -4019,17 +3990,9 @@ break; default: - int asynsig = os::Solaris::SIGasync(); - - if (sig == asynsig) { - jvmHandler = CAST_FROM_FN_PTR(address, signalHandler); - } else { return; - } - break; } - if (thisHandler != jvmHandler) { tty->print("Warning: %s handler ", exception_name(sig, buf, O_BUFLEN)); tty->print("expected:%s", get_signal_handler_name(jvmHandler, buf, O_BUFLEN)); @@ -4061,7 +4024,6 @@ } void os::Solaris::install_signal_handlers() { - bool libjsigdone = false; signal_handlers_are_installed = true; // signal-chaining @@ -4079,7 +4041,8 @@ dlsym(RTLD_DEFAULT, "JVM_get_libjsig_version")); libjsig_is_loaded = true; if (os::Solaris::get_libjsig_version != NULL) { - libjsigversion = (*os::Solaris::get_libjsig_version)(); + int libjsigversion = (*os::Solaris::get_libjsig_version)(); + guarantee(libjsigversion == JSIG_VERSION_1_4_1, "libjsig version mismatch"); } assert(UseSignalChaining, "should enable signal-chaining"); } @@ -4094,21 +4057,9 @@ set_signal_handler(SIGBUS, true, true); set_signal_handler(SIGILL, true, true); set_signal_handler(SIGFPE, true, true); + set_signal_handler(ASYNC_SIGNAL, true, true); - - if (os::Solaris::SIGasync() > OLDMAXSIGNUM) { - // Pre-1.4.1 Libjsig limited to signal chaining signals <= 32 so - // can not register overridable signals which might be > 32 - if (libjsig_is_loaded && libjsigversion <= JSIG_VERSION_1_4_1) { - // Tell libjsig jvm has finished setting signal handlers - (*end_signal_setting)(); - libjsigdone = true; - } - } - - set_signal_handler(os::Solaris::SIGasync(), true, true); - - if (libjsig_is_loaded && !libjsigdone) { + if (libjsig_is_loaded) { // Tell libjsig jvm finishes setting signal handlers (*end_signal_setting)(); } @@ -4408,10 +4359,6 @@ Solaris::init_signal_mem(); Solaris::install_signal_handlers(); - if (libjsigversion < JSIG_VERSION_1_4_1) { - Maxlibjsigsigs = OLDMAXSIGNUM; - } - // initialize synchronization primitives to use either thread or // lwp synchronization (controlled by UseLWPSynchronization) Solaris::synchronization_init(); --- old/src/os/solaris/vm/os_solaris.hpp 2017-03-16 08:34:52.554069281 -0400 +++ new/src/os/solaris/vm/os_solaris.hpp 2017-03-16 08:34:50.585955444 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -109,9 +109,6 @@ static int (*get_libjsig_version)(); static void save_preinstalled_handler(int, struct sigaction&); static void check_signal_handler(int sig); - // For overridable signals - static int _SIGasync; // user-overridable ASYNC_SIGNAL - static void set_SIGasync(int newsig) { _SIGasync = newsig; } typedef int (*pthread_setname_np_func_t)(pthread_t, const char*); static pthread_setname_np_func_t _pthread_setname_np; @@ -120,7 +117,6 @@ // Large Page Support--ISM. static bool largepage_range(char* addr, size_t size); - static int SIGasync() { return _SIGasync; } static address handler_start, handler_end; // start and end pc of thr_sighndlrinfo static bool valid_stack_address(Thread* thread, address sp); --- old/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp 2017-03-16 08:34:59.482470023 -0400 +++ new/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp 2017-03-16 08:34:57.250340916 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -362,14 +362,14 @@ } } - if (sig == os::Solaris::SIGasync()) { + if (sig == ASYNC_SIGNAL) { if (thread || vmthread) { OSThread::SR_handler(t, uc); return true; } else if (os::Solaris::chained_handler(sig, info, ucVoid)) { return true; } else { - // If os::Solaris::SIGasync not chained, and this is a non-vm and + // If ASYNC_SIGNAL not chained, and this is a non-vm and // non-java thread return true; } --- old/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp 2017-03-16 08:35:05.442814771 -0400 +++ new/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp 2017-03-16 08:35:03.478701166 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -437,14 +437,14 @@ } } - if (sig == os::Solaris::SIGasync()) { + if (sig == ASYNC_SIGNAL) { if(thread || vmthread){ OSThread::SR_handler(t, uc); return true; } else if (os::Solaris::chained_handler(sig, info, ucVoid)) { return true; } else { - // If os::Solaris::SIGasync not chained, and this is a non-vm and + // If ASYNC_SIGNAL not chained, and this is a non-vm and // non-java thread return true; }