1 /* |
1 /* |
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright (c) 2016, 2018 SAP SE. All rights reserved. |
3 * Copyright (c) 2016, 2018 SAP SE. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
268 } |
268 } |
269 } |
269 } |
270 |
270 |
271 #ifdef CAN_SHOW_REGISTERS_ON_ASSERT |
271 #ifdef CAN_SHOW_REGISTERS_ON_ASSERT |
272 if ((sig == SIGSEGV || sig == SIGBUS) && info != NULL && info->si_addr == g_assert_poison) { |
272 if ((sig == SIGSEGV || sig == SIGBUS) && info != NULL && info->si_addr == g_assert_poison) { |
273 handle_assert_poison_fault(ucVoid, info->si_addr); |
273 if (handle_assert_poison_fault(ucVoid, info->si_addr)) { |
274 return 1; |
274 return 1; |
|
275 } |
275 } |
276 } |
276 #endif |
277 #endif |
277 |
278 |
278 JavaThread* thread = NULL; |
279 JavaThread* thread = NULL; |
279 VMThread* vmthread = NULL; |
280 VMThread* vmthread = NULL; |
465 } else if ((sig == SIGFPE) && VM_Version::is_determine_features_test_running()) { |
466 } else if ((sig == SIGFPE) && VM_Version::is_determine_features_test_running()) { |
466 // SIGFPE is known to be caused by trying to execute a vector instruction |
467 // SIGFPE is known to be caused by trying to execute a vector instruction |
467 // when the vector facility is installed, but operating system support is missing. |
468 // when the vector facility is installed, but operating system support is missing. |
468 VM_Version::reset_has_VectorFacility(); |
469 VM_Version::reset_has_VectorFacility(); |
469 stub = pc; // Continue with next instruction. |
470 stub = pc; // Continue with next instruction. |
470 } else if (thread->thread_state() == _thread_in_vm && |
471 } else if ((thread->thread_state() == _thread_in_vm || |
|
472 thread->thread_state() == _thread_in_native) && |
471 sig == SIGBUS && thread->doing_unsafe_access()) { |
473 sig == SIGBUS && thread->doing_unsafe_access()) { |
472 // We don't really need a stub here! Just set the pending exeption and |
474 // We don't really need a stub here! Just set the pending exeption and |
473 // continue at the next instruction after the faulting read. Returning |
475 // continue at the next instruction after the faulting read. Returning |
474 // garbage from this read is ok. |
476 // garbage from this read is ok. |
475 thread->set_pending_unsafe_access_error(); |
477 thread->set_pending_unsafe_access_error(); |
476 os::Linux::ucontext_set_pc(uc, pc + Assembler::instr_len(pc)); |
478 os::Linux::ucontext_set_pc(uc, pc + Assembler::instr_len(pc)); |
477 return true; |
479 return true; |
|
480 } |
|
481 } |
|
482 |
|
483 // jni_fast_Get<Primitive>Field can trap at certain pc's if a GC kicks in |
|
484 // and the heap gets shrunk before the field access. |
|
485 if ((sig == SIGSEGV) || (sig == SIGBUS)) { |
|
486 address addr = JNI_FastGetField::find_slowcase_pc(pc); |
|
487 if (addr != (address)-1) { |
|
488 stub = addr; |
478 } |
489 } |
479 } |
490 } |
480 } |
491 } |
481 |
492 |
482 if (stub != NULL) { |
493 if (stub != NULL) { |