7167254: Crash on OSX in Enumerator.nextElement() with compressed oops
authorroland
Fri, 18 May 2012 15:50:09 +0200
changeset 12740 fa38bd69a34b
parent 12739 09f26b73ae66
child 12741 9315df9ea655
7167254: Crash on OSX in Enumerator.nextElement() with compressed oops Summary: null checks in "compressed oops with base" mode may trigger a SIGBUS rather than a SIGSEGV. Reviewed-by: dsamersoff, dcubed, rbackman, kvn
hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp
--- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Tue May 15 10:10:23 2012 +0200
+++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Fri May 18 15:50:09 2012 +0200
@@ -522,11 +522,12 @@
 
       if ((sig == SIGSEGV || sig == SIGBUS) && os::is_poll_address((address)info->si_addr)) {
         stub = SharedRuntime::get_poll_stub(pc);
-#if defined(__APPLE__) && !defined(AMD64)
+#if defined(__APPLE__)
       // 32-bit Darwin reports a SIGBUS for nearly all memory access exceptions.
+      // 64-bit Darwin may also use a SIGBUS (seen with compressed oops).
       // Catching SIGBUS here prevents the implicit SIGBUS NULL check below from
       // being called, so only do so if the implicit NULL check is not necessary.
-      } else if (sig == SIGBUS && MacroAssembler::needs_explicit_null_check((int)info->si_addr)) {
+      } else if (sig == SIGBUS && MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
 #else
       } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) {
 #endif