231 tty->print_cr("trap: not_entrant (%s)", (sig == SIGTRAP) ? "SIGTRAP" : "SIGILL");
232 }
233 stub = SharedRuntime::get_handle_wrong_method_stub();
234 } else if (sig == SIGSEGV && SafepointMechanism::is_poll_address((address)info->si_addr)) {
235 stub = SharedRuntime::get_poll_stub(pc);
236 } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) {
237 // BugId 4454115: A read from a MappedByteBuffer can fault
238 // here if the underlying file has been truncated.
239 // Do not crash the VM in such a case.
240 CodeBlob* cb = CodeCache::find_blob(pc);
241 nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr;
242 bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc));
243 if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) {
244 address next_pc = pc + NativeCall::instruction_size;
245 if (is_unsafe_memory_access) {
246 next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
247 }
248 stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
249 }
250 } else if (sig == SIGILL && nativeInstruction_at(pc)->is_stop()) {
251 // Pull a pointer to the error message out of the instruction
252 // stream.
253 const uint64_t *detail_msg_ptr
254 = (uint64_t*)(pc + NativeInstruction::instruction_size);
255 const char *detail_msg = (const char *)*detail_msg_ptr;
256 const char *msg = "stop";
257 if (TraceTraps) {
258 tty->print_cr("trap: %s: (SIGILL)", msg);
259 }
260
261 // End life with a fatal error, message and detail message and the context.
262 // Note: no need to do any post-processing here (e.g. signal chaining)
263 VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
264
265 ShouldNotReachHere();
266
267 }
268 else
269
270 if (sig == SIGFPE &&
271 (info->si_code == FPE_INTDIV || info->si_code == FPE_FLTDIV)) {
272 stub =
273 SharedRuntime::
274 continuation_for_implicit_exception(thread,
275 pc,
|
231 tty->print_cr("trap: not_entrant (%s)", (sig == SIGTRAP) ? "SIGTRAP" : "SIGILL");
232 }
233 stub = SharedRuntime::get_handle_wrong_method_stub();
234 } else if (sig == SIGSEGV && SafepointMechanism::is_poll_address((address)info->si_addr)) {
235 stub = SharedRuntime::get_poll_stub(pc);
236 } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) {
237 // BugId 4454115: A read from a MappedByteBuffer can fault
238 // here if the underlying file has been truncated.
239 // Do not crash the VM in such a case.
240 CodeBlob* cb = CodeCache::find_blob(pc);
241 nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr;
242 bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc));
243 if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) {
244 address next_pc = pc + NativeCall::instruction_size;
245 if (is_unsafe_memory_access) {
246 next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
247 }
248 stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
249 }
250 } else if (sig == SIGILL && nativeInstruction_at(pc)->is_stop()) {
251 // A pointer to the message will have been placed in r0
252 const char *detail_msg = (const char *)(uc->uc_mcontext.regs[0]);
253 const char *msg = "stop";
254 if (TraceTraps) {
255 tty->print_cr("trap: %s: (SIGILL)", msg);
256 }
257
258 // End life with a fatal error, message and detail message and the context.
259 // Note: no need to do any post-processing here (e.g. signal chaining)
260 VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
261
262 ShouldNotReachHere();
263
264 }
265 else
266
267 if (sig == SIGFPE &&
268 (info->si_code == FPE_INTDIV || info->si_code == FPE_FLTDIV)) {
269 stub =
270 SharedRuntime::
271 continuation_for_implicit_exception(thread,
272 pc,
|