475 // stack overflow 476 if (thread->in_stack_yellow_zone(addr)) { 477 thread->disable_stack_yellow_zone(); 478 if (thread->thread_state() == _thread_in_Java) { 479 // Throw a stack overflow exception. Guard pages will be reenabled 480 // while unwinding the stack. 481 stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW); 482 } else { 483 // Thread was in the vm or native code. Return and try to finish. 484 return 1; 485 } 486 } else if (thread->in_stack_red_zone(addr)) { 487 // Fatal red zone violation. Disable the guard pages and fall through 488 // to handle_unexpected_exception way down below. 489 thread->disable_stack_red_zone(); 490 tty->print_raw_cr("An irrecoverable stack overflow has occurred."); 491 } 492 } 493 } 494 495 // We test if stub is already set (by the stack overflow code 496 // above) so it is not overwritten by the code that follows. This 497 // check is not required on other platforms, because on other 498 // platforms we check for SIGSEGV only or SIGBUS only, where here 499 // we have to check for both SIGSEGV and SIGBUS. 500 if (thread->thread_state() == _thread_in_Java && stub == NULL) { 501 // Java thread running in Java code => find exception handler if any 502 // a fault inside compiled code, the interpreter, or a stub 503 504 if ((sig == SIGSEGV || sig == SIGBUS) && os::is_poll_address((address)info->si_addr)) { 505 stub = SharedRuntime::get_poll_stub(pc); 506 #if defined(__APPLE__) 507 // 32-bit Darwin reports a SIGBUS for nearly all memory access exceptions. 508 // 64-bit Darwin may also use a SIGBUS (seen with compressed oops). 509 // Catching SIGBUS here prevents the implicit SIGBUS NULL check below from 510 // being called, so only do so if the implicit NULL check is not necessary. 511 } else if (sig == SIGBUS && MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) { 512 #else 513 } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) { 514 #endif | 475 // stack overflow 476 if (thread->in_stack_yellow_zone(addr)) { 477 thread->disable_stack_yellow_zone(); 478 if (thread->thread_state() == _thread_in_Java) { 479 // Throw a stack overflow exception. Guard pages will be reenabled 480 // while unwinding the stack. 481 stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW); 482 } else { 483 // Thread was in the vm or native code. Return and try to finish. 484 return 1; 485 } 486 } else if (thread->in_stack_red_zone(addr)) { 487 // Fatal red zone violation. Disable the guard pages and fall through 488 // to handle_unexpected_exception way down below. 489 thread->disable_stack_red_zone(); 490 tty->print_raw_cr("An irrecoverable stack overflow has occurred."); 491 } 492 } 493 } 494 495 if ((sig == SIGSEGV || sig == SIGBUS) && VM_Version::is_cpuinfo_segv_addr(pc)) { 496 // Verify that OS save/restore AVX registers. 497 stub = VM_Version::cpuinfo_cont_addr(); 498 } 499 500 // We test if stub is already set (by the stack overflow code 501 // above) so it is not overwritten by the code that follows. This 502 // check is not required on other platforms, because on other 503 // platforms we check for SIGSEGV only or SIGBUS only, where here 504 // we have to check for both SIGSEGV and SIGBUS. 505 if (thread->thread_state() == _thread_in_Java && stub == NULL) { 506 // Java thread running in Java code => find exception handler if any 507 // a fault inside compiled code, the interpreter, or a stub 508 509 if ((sig == SIGSEGV || sig == SIGBUS) && os::is_poll_address((address)info->si_addr)) { 510 stub = SharedRuntime::get_poll_stub(pc); 511 #if defined(__APPLE__) 512 // 32-bit Darwin reports a SIGBUS for nearly all memory access exceptions. 513 // 64-bit Darwin may also use a SIGBUS (seen with compressed oops). 514 // Catching SIGBUS here prevents the implicit SIGBUS NULL check below from 515 // being called, so only do so if the implicit NULL check is not necessary. 516 } else if (sig == SIGBUS && MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) { 517 #else 518 } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) { 519 #endif |