# HG changeset patch # User dcubed # Date 1370523393 25200 # Node ID a3b280ab0a2f924b27569f0b68b2eae56c11f5bd # Parent 78ed1b8dafe2c6d396c345000cfbca60e1d697cc# Parent 262aa770cb1b147e8559bcddef3023168f739586 Merge diff -r 78ed1b8dafe2 -r a3b280ab0a2f hotspot/src/os/bsd/vm/os_bsd.cpp --- a/hotspot/src/os/bsd/vm/os_bsd.cpp Wed Jun 05 09:47:27 2013 -0700 +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Thu Jun 06 05:56:33 2013 -0700 @@ -3030,6 +3030,19 @@ 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; diff -r 78ed1b8dafe2 -r a3b280ab0a2f hotspot/src/share/vm/runtime/thread.hpp --- a/hotspot/src/share/vm/runtime/thread.hpp Wed Jun 05 09:47:27 2013 -0700 +++ b/hotspot/src/share/vm/runtime/thread.hpp Thu Jun 06 05:56:33 2013 -0700 @@ -638,9 +638,6 @@ 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