From f3fb3c4777c21c50915760a314a92a4dec151de9 Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Tue, 4 Jun 2013 19:39:21 -0700 Subject: [PATCH 1/2] 8010257: remove unused thread-local variables _ScratchA and _ScratchB Remove dead code. Reviewed-by: twisti, coleenp --- hotspot/src/share/vm/runtime/thread.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp index d64ca311c65..71007590bbf 100644 --- a/hotspot/src/share/vm/runtime/thread.hpp +++ b/hotspot/src/share/vm/runtime/thread.hpp @@ -638,9 +638,6 @@ public: jint _hashStateZ ; void * _schedctl ; - intptr_t _ScratchA, _ScratchB ; // Scratch locations for fast-path sync code - static ByteSize ScratchA_offset() { return byte_offset_of(Thread, _ScratchA ); } - static ByteSize ScratchB_offset() { return byte_offset_of(Thread, _ScratchB ); } volatile jint rng [4] ; // RNG for spin loop From 2fad2249a2f769677c3c94a1ed23f1fc089701af Mon Sep 17 00:00:00 2001 From: Gerard Ziemski Date: Wed, 5 Jun 2013 14:12:49 -0400 Subject: [PATCH 2/2] 8009302: Mac OS X: JVM crash on infinite recursion on Appkit Thread Use SA_ONSTACK flag to ensure signal gets delivered properly. Reviewed-by: dholmes, coleenp --- hotspot/src/os/bsd/vm/os_bsd.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp index f0b32196f5d..5dd7ce7e495 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.cpp +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp @@ -3030,6 +3030,19 @@ void os::Bsd::set_signal_handler(int sig, bool set_installed) { sigAct.sa_sigaction = signalHandler; sigAct.sa_flags = SA_SIGINFO|SA_RESTART; } +#if __APPLE__ + // Needed for main thread as XNU (Mac OS X kernel) will only deliver SIGSEGV + // (which starts as SIGBUS) on main thread with faulting address inside "stack+guard pages" + // if the signal handler declares it will handle it on alternate stack. + // Notice we only declare we will handle it on alt stack, but we are not + // actually going to use real alt stack - this is just a workaround. + // Please see ux_exception.c, method catch_mach_exception_raise for details + // link http://www.opensource.apple.com/source/xnu/xnu-2050.18.24/bsd/uxkern/ux_exception.c + if (sig == SIGSEGV) { + sigAct.sa_flags |= SA_ONSTACK; + } +#endif + // Save flags, which are set by ours assert(sig > 0 && sig < MAXSIGNUM, "vm signal out of expected range"); sigflags[sig] = sigAct.sa_flags;