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. |
434 } |
434 } |
435 } |
435 } |
436 } |
436 } |
437 |
437 |
438 |
438 |
439 if (thread->thread_state() == _thread_in_vm) { |
439 if (thread->thread_state() == _thread_in_vm || |
|
440 thread->thread_state() == _thread_in_native) { |
440 if (sig == SIGBUS && thread->doing_unsafe_access()) { |
441 if (sig == SIGBUS && thread->doing_unsafe_access()) { |
|
442 if (UnsafeCopyMemory::contains_pc(pc)) { |
|
443 npc = UnsafeCopyMemory::page_error_continue_pc(pc); |
|
444 } |
441 stub = SharedRuntime::handle_unsafe_access(thread, npc); |
445 stub = SharedRuntime::handle_unsafe_access(thread, npc); |
442 } |
446 } |
443 } |
447 } |
444 |
448 |
445 else if (thread->thread_state() == _thread_in_Java) { |
449 else if (thread->thread_state() == _thread_in_Java) { |
474 // BugId 4454115: A read from a MappedByteBuffer can fault |
478 // BugId 4454115: A read from a MappedByteBuffer can fault |
475 // here if the underlying file has been truncated. |
479 // here if the underlying file has been truncated. |
476 // Do not crash the VM in such a case. |
480 // Do not crash the VM in such a case. |
477 CodeBlob* cb = CodeCache::find_blob_unsafe(pc); |
481 CodeBlob* cb = CodeCache::find_blob_unsafe(pc); |
478 CompiledMethod* nm = cb->as_compiled_method_or_null(); |
482 CompiledMethod* nm = cb->as_compiled_method_or_null(); |
479 if (nm != NULL && nm->has_unsafe_access()) { |
483 bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc)); |
|
484 if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) { |
|
485 if (is_unsafe_arraycopy) { |
|
486 npc = UnsafeCopyMemory::page_error_continue_pc(pc); |
|
487 } |
480 stub = SharedRuntime::handle_unsafe_access(thread, npc); |
488 stub = SharedRuntime::handle_unsafe_access(thread, npc); |
481 } |
489 } |
482 } |
490 } |
483 |
491 |
484 else if (sig == SIGFPE && info->si_code == FPE_INTDIV) { |
492 else if (sig == SIGFPE && info->si_code == FPE_INTDIV) { |