359 // current thread was created by user code with MAP_GROWSDOWN flag
360 // and then attached to VM. See notes in os_linux.cpp.
361 if (thread->osthread()->expanding_stack() == 0) {
362 thread->osthread()->set_expanding_stack();
363 if (os::Linux::manually_expand_stack(thread, addr)) {
364 thread->osthread()->clear_expanding_stack();
365 return 1;
366 }
367 thread->osthread()->clear_expanding_stack();
368 } else {
369 fatal("recursive segv. expanding stack.");
370 }
371 }
372 }
373 }
374
375 if (thread->thread_state() == _thread_in_Java) {
376 // Java thread running in Java code => find exception handler if any
377 // a fault inside compiled code, the interpreter, or a stub
378
379 if (sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) {
380 stub = SharedRuntime::get_poll_stub(pc);
381 } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) {
382 // BugId 4454115: A read from a MappedByteBuffer can fault
383 // here if the underlying file has been truncated.
384 // Do not crash the VM in such a case.
385 CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
386 nmethod* nm = (cb != NULL && cb->is_nmethod()) ? (nmethod*)cb : NULL;
387 if (nm != NULL && nm->has_unsafe_access()) {
388 stub = handle_unsafe_access(thread, pc);
389 }
390 }
391 else
392
393 if (sig == SIGFPE &&
394 (info->si_code == FPE_INTDIV || info->si_code == FPE_FLTDIV)) {
395 stub =
396 SharedRuntime::
397 continuation_for_implicit_exception(thread,
398 pc,
399 SharedRuntime::
|
359 // current thread was created by user code with MAP_GROWSDOWN flag
360 // and then attached to VM. See notes in os_linux.cpp.
361 if (thread->osthread()->expanding_stack() == 0) {
362 thread->osthread()->set_expanding_stack();
363 if (os::Linux::manually_expand_stack(thread, addr)) {
364 thread->osthread()->clear_expanding_stack();
365 return 1;
366 }
367 thread->osthread()->clear_expanding_stack();
368 } else {
369 fatal("recursive segv. expanding stack.");
370 }
371 }
372 }
373 }
374
375 if (thread->thread_state() == _thread_in_Java) {
376 // Java thread running in Java code => find exception handler if any
377 // a fault inside compiled code, the interpreter, or a stub
378
379 // Handle signal from NativeJump::patch_verified_entry().
380 if ((sig == SIGILL || sig == SIGTRAP)
381 && nativeInstruction_at(pc)->is_sigill_zombie_not_entrant()) {
382 if (TraceTraps) {
383 tty->print_cr("trap: zombie_not_entrant (%s)", (sig == SIGTRAP) ? "SIGTRAP" : "SIGILL");
384 }
385 stub = SharedRuntime::get_handle_wrong_method_stub();
386 } else if (sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) {
387 stub = SharedRuntime::get_poll_stub(pc);
388 } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) {
389 // BugId 4454115: A read from a MappedByteBuffer can fault
390 // here if the underlying file has been truncated.
391 // Do not crash the VM in such a case.
392 CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
393 nmethod* nm = (cb != NULL && cb->is_nmethod()) ? (nmethod*)cb : NULL;
394 if (nm != NULL && nm->has_unsafe_access()) {
395 stub = handle_unsafe_access(thread, pc);
396 }
397 }
398 else
399
400 if (sig == SIGFPE &&
401 (info->si_code == FPE_INTDIV || info->si_code == FPE_FLTDIV)) {
402 stub =
403 SharedRuntime::
404 continuation_for_implicit_exception(thread,
405 pc,
406 SharedRuntime::
|