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