equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
515 if ((sig == SIGSEGV) && VM_Version::is_cpuinfo_segv_addr(pc)) { |
515 if ((sig == SIGSEGV) && VM_Version::is_cpuinfo_segv_addr(pc)) { |
516 // Verify that OS save/restore AVX registers. |
516 // Verify that OS save/restore AVX registers. |
517 stub = VM_Version::cpuinfo_cont_addr(); |
517 stub = VM_Version::cpuinfo_cont_addr(); |
518 } |
518 } |
519 |
519 |
520 if (thread->thread_state() == _thread_in_vm) { |
520 if (thread->thread_state() == _thread_in_vm || |
|
521 thread->thread_state() == _thread_in_native) { |
521 if (sig == SIGBUS && info->si_code == BUS_OBJERR && thread->doing_unsafe_access()) { |
522 if (sig == SIGBUS && info->si_code == BUS_OBJERR && thread->doing_unsafe_access()) { |
522 address next_pc = Assembler::locate_next_instruction(pc); |
523 address next_pc = Assembler::locate_next_instruction(pc); |
|
524 if (UnsafeCopyMemory::contains_pc(pc)) { |
|
525 next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); |
|
526 } |
523 stub = SharedRuntime::handle_unsafe_access(thread, next_pc); |
527 stub = SharedRuntime::handle_unsafe_access(thread, next_pc); |
524 } |
528 } |
525 } |
529 } |
526 |
530 |
527 if (thread->thread_state() == _thread_in_Java) { |
531 if (thread->thread_state() == _thread_in_Java) { |
534 // here if the underlying file has been truncated. |
538 // here if the underlying file has been truncated. |
535 // Do not crash the VM in such a case. |
539 // Do not crash the VM in such a case. |
536 CodeBlob* cb = CodeCache::find_blob_unsafe(pc); |
540 CodeBlob* cb = CodeCache::find_blob_unsafe(pc); |
537 if (cb != NULL) { |
541 if (cb != NULL) { |
538 CompiledMethod* nm = cb->as_compiled_method_or_null(); |
542 CompiledMethod* nm = cb->as_compiled_method_or_null(); |
539 if (nm != NULL && nm->has_unsafe_access()) { |
543 bool is_unsafe_arraycopy = thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc); |
|
544 if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) { |
540 address next_pc = Assembler::locate_next_instruction(pc); |
545 address next_pc = Assembler::locate_next_instruction(pc); |
|
546 if (is_unsafe_arraycopy) { |
|
547 next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); |
|
548 } |
541 stub = SharedRuntime::handle_unsafe_access(thread, next_pc); |
549 stub = SharedRuntime::handle_unsafe_access(thread, next_pc); |
542 } |
550 } |
543 } |
551 } |
544 } |
552 } |
545 else |
553 else |