8330821: Rename UnsafeCopyMemory
Reviewed-by: kvn, sviswanathan
This commit is contained in:
parent
1d52234e19
commit
58ad399d19
@ -1519,9 +1519,9 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ push(RegSet::of(d, count), sp);
|
||||
}
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
bool add_entry = !is_oop && (!aligned || sizeof(jlong) == size);
|
||||
UnsafeCopyMemoryMark ucmm(this, add_entry, true);
|
||||
UnsafeMemoryAccessMark umam(this, add_entry, true);
|
||||
copy_memory(decorators, is_oop ? T_OBJECT : T_BYTE, aligned, s, d, count, size);
|
||||
}
|
||||
|
||||
@ -1590,9 +1590,9 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ push(RegSet::of(d, count), sp);
|
||||
}
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
bool add_entry = !is_oop && (!aligned || sizeof(jlong) == size);
|
||||
UnsafeCopyMemoryMark ucmm(this, add_entry, true);
|
||||
UnsafeMemoryAccessMark umam(this, add_entry, true);
|
||||
copy_memory(decorators, is_oop ? T_OBJECT : T_BYTE, aligned, s, d, count, -size);
|
||||
}
|
||||
if (is_oop) {
|
||||
@ -8378,8 +8378,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
SharedRuntime::throw_delayed_StackOverflowError));
|
||||
|
||||
// Initialize table for copy memory (arraycopy) check.
|
||||
if (UnsafeCopyMemory::_table == nullptr) {
|
||||
UnsafeCopyMemory::create_table(8 + 4); // 8 for copyMemory; 4 for setMemory
|
||||
if (UnsafeMemoryAccess::_table == nullptr) {
|
||||
UnsafeMemoryAccess::create_table(8 + 4); // 8 for copyMemory; 4 for setMemory
|
||||
}
|
||||
|
||||
if (UseCRC32Intrinsics) {
|
||||
|
@ -956,8 +956,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
Label L_skip_pld;
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, unsafe_copy, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, unsafe_copy, true);
|
||||
// predecrease to exit when there is less than count_per_loop
|
||||
__ sub_32(count, count, count_per_loop);
|
||||
|
||||
@ -1105,8 +1105,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ push(RegisterSet(R4,R10));
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, unsafe_copy, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, unsafe_copy, true);
|
||||
__ sub_32(count, count, count_per_loop);
|
||||
|
||||
const bool prefetch_before = pld_offset < 0;
|
||||
@ -1761,8 +1761,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
assert_different_registers(from, to, count, tmp);
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, unsafe_copy, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, unsafe_copy, true);
|
||||
__ align(OptoLoopAlignment);
|
||||
Label L_small_loop;
|
||||
__ BIND(L_small_loop);
|
||||
@ -1900,8 +1900,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ push(RegisterSet(R4,R10));
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, unsafe_copy, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, unsafe_copy, true);
|
||||
load_one(Rval, from, wordSize, forward);
|
||||
|
||||
switch (bytes_per_count) {
|
||||
@ -2058,8 +2058,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
int count_required_to_align = 0;
|
||||
{
|
||||
// UnsafeCopyMemoryMark page error: continue at UnsafeCopyMemory common_error_exit
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, false);
|
||||
// UnsafeMemoryAccessMark page error: continue at UnsafeMemoryAccess common_error_exit
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, false);
|
||||
count_required_to_align = from_is_aligned ? 0 : align_src(from, to, count, tmp1, bytes_per_count, forward);
|
||||
assert (small_copy_limit >= count_required_to_align, "alignment could exhaust count");
|
||||
}
|
||||
@ -2092,9 +2092,9 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
int min_copy;
|
||||
if (forward) {
|
||||
min_copy = generate_forward_aligned_copy_loop(from, to, count, bytes_per_count, !aligned /*add UnsafeCopyMemory entry*/);
|
||||
min_copy = generate_forward_aligned_copy_loop(from, to, count, bytes_per_count, !aligned /*add UnsafeMemoryAccess entry*/);
|
||||
} else {
|
||||
min_copy = generate_backward_aligned_copy_loop(from, to, count, bytes_per_count, !aligned /*add UnsafeCopyMemory entry*/);
|
||||
min_copy = generate_backward_aligned_copy_loop(from, to, count, bytes_per_count, !aligned /*add UnsafeMemoryAccess entry*/);
|
||||
}
|
||||
assert(small_copy_limit >= count_required_to_align + min_copy, "first loop might exhaust count");
|
||||
|
||||
@ -2105,7 +2105,7 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ ret();
|
||||
|
||||
{
|
||||
copy_small_array(from, to, count, tmp1, tmp2, bytes_per_count, forward, L_small_array /* entry */, !aligned /*add UnsafeCopyMemory entry*/);
|
||||
copy_small_array(from, to, count, tmp1, tmp2, bytes_per_count, forward, L_small_array /* entry */, !aligned /*add UnsafeMemoryAccess entry*/);
|
||||
|
||||
if (status) {
|
||||
__ mov(R0, 0); // OK
|
||||
@ -2116,7 +2116,7 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
if (! to_is_aligned) {
|
||||
__ BIND(L_unaligned_dst);
|
||||
int min_copy_shifted = align_dst_and_generate_shifted_copy_loop(from, to, count, bytes_per_count, forward, !aligned /*add UnsafeCopyMemory entry*/);
|
||||
int min_copy_shifted = align_dst_and_generate_shifted_copy_loop(from, to, count, bytes_per_count, forward, !aligned /*add UnsafeMemoryAccess entry*/);
|
||||
assert (small_copy_limit >= count_required_to_align + min_copy_shifted, "first loop might exhaust count");
|
||||
|
||||
if (status) {
|
||||
@ -2862,7 +2862,7 @@ class StubGenerator: public StubCodeGenerator {
|
||||
#endif
|
||||
|
||||
address ucm_common_error_exit = generate_unsafecopy_common_error_exit();
|
||||
UnsafeCopyMemory::set_common_exit_stub_pc(ucm_common_error_exit);
|
||||
UnsafeMemoryAccess::set_common_exit_stub_pc(ucm_common_error_exit);
|
||||
|
||||
// these need always status in case they are called from generic_arraycopy
|
||||
StubRoutines::_jbyte_disjoint_arraycopy = generate_primitive_copy(false, "jbyte_disjoint_arraycopy", true, 1, true);
|
||||
@ -3134,8 +3134,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
// stub for throwing stack overflow error used both by interpreter and compiler
|
||||
StubRoutines::_throw_StackOverflowError_entry = generate_throw_exception("StackOverflowError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError));
|
||||
|
||||
if (UnsafeCopyMemory::_table == nullptr) {
|
||||
UnsafeCopyMemory::create_table(32 + 4); // 32 for copyMemory; 4 for setMemory
|
||||
if (UnsafeMemoryAccess::_table == nullptr) {
|
||||
UnsafeMemoryAccess::create_table(32 + 4); // 32 for copyMemory; 4 for setMemory
|
||||
}
|
||||
|
||||
// integer division used both by interpreter and compiler
|
||||
|
@ -961,7 +961,7 @@ class StubGenerator: public StubCodeGenerator {
|
||||
// need to copy backwards
|
||||
}
|
||||
|
||||
// This is common errorexit stub for UnsafeCopyMemory.
|
||||
// This is common errorexit stub for UnsafeMemoryAccess.
|
||||
address generate_unsafecopy_common_error_exit() {
|
||||
address start_pc = __ pc();
|
||||
Register tmp1 = R6_ARG4;
|
||||
@ -1013,8 +1013,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
Label l_1, l_2, l_3, l_4, l_5, l_6, l_7, l_8, l_9, l_10;
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, false);
|
||||
// UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, false);
|
||||
|
||||
// Don't try anything fancy if arrays don't have many elements.
|
||||
__ li(tmp3, 0);
|
||||
@ -1195,8 +1195,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
// that we don't have to optimize it.
|
||||
Label l_1, l_2;
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, false);
|
||||
// UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, false);
|
||||
__ b(l_2);
|
||||
__ bind(l_1);
|
||||
__ stbx(tmp1, R4_ARG2, R5_ARG3);
|
||||
@ -1282,8 +1282,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
Label l_1, l_2, l_3, l_4, l_5, l_6, l_7, l_8, l_9;
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, false);
|
||||
// UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, false);
|
||||
// don't try anything fancy if arrays don't have many elements
|
||||
__ li(tmp3, 0);
|
||||
__ cmpwi(CCR0, R5_ARG3, 9);
|
||||
@ -1466,8 +1466,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
Label l_1, l_2;
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, false);
|
||||
// UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, false);
|
||||
__ sldi(tmp1, R5_ARG3, 1);
|
||||
__ b(l_2);
|
||||
__ bind(l_1);
|
||||
@ -1625,8 +1625,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
address start = __ function_entry();
|
||||
assert_positive_int(R5_ARG3);
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, false);
|
||||
// UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, false);
|
||||
generate_disjoint_int_copy_core(aligned);
|
||||
}
|
||||
__ li(R3_RET, 0); // return 0
|
||||
@ -1777,8 +1777,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
array_overlap_test(nooverlap_target, 2);
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, false);
|
||||
// UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, false);
|
||||
generate_conjoint_int_copy_core(aligned);
|
||||
}
|
||||
|
||||
@ -1903,8 +1903,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
address start = __ function_entry();
|
||||
assert_positive_int(R5_ARG3);
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, false);
|
||||
// UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, false);
|
||||
generate_disjoint_long_copy_core(aligned);
|
||||
}
|
||||
__ li(R3_RET, 0); // return 0
|
||||
@ -2034,8 +2034,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
array_overlap_test(nooverlap_target, 3);
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, false);
|
||||
// UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, false);
|
||||
generate_conjoint_long_copy_core(aligned);
|
||||
}
|
||||
__ li(R3_RET, 0); // return 0
|
||||
@ -3129,7 +3129,7 @@ class StubGenerator: public StubCodeGenerator {
|
||||
// the conjoint stubs use them.
|
||||
|
||||
address ucm_common_error_exit = generate_unsafecopy_common_error_exit();
|
||||
UnsafeCopyMemory::set_common_exit_stub_pc(ucm_common_error_exit);
|
||||
UnsafeMemoryAccess::set_common_exit_stub_pc(ucm_common_error_exit);
|
||||
|
||||
// non-aligned disjoint versions
|
||||
StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(false, "jbyte_disjoint_arraycopy");
|
||||
@ -4745,8 +4745,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
StubRoutines::_call_stub_entry = generate_call_stub(StubRoutines::_call_stub_return_address);
|
||||
StubRoutines::_catch_exception_entry = generate_catch_exception();
|
||||
|
||||
if (UnsafeCopyMemory::_table == nullptr) {
|
||||
UnsafeCopyMemory::create_table(8 + 4); // 8 for copyMemory; 4 for setMemory
|
||||
if (UnsafeMemoryAccess::_table == nullptr) {
|
||||
UnsafeMemoryAccess::create_table(8 + 4); // 8 for copyMemory; 4 for setMemory
|
||||
}
|
||||
|
||||
// Build this early so it's available for the interpreter.
|
||||
|
@ -1136,9 +1136,9 @@ class StubGenerator: public StubCodeGenerator {
|
||||
}
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
bool add_entry = !is_oop && (!aligned || sizeof(jlong) == size);
|
||||
UnsafeCopyMemoryMark ucmm(this, add_entry, true);
|
||||
UnsafeMemoryAccessMark umam(this, add_entry, true);
|
||||
copy_memory(decorators, is_oop ? T_OBJECT : T_BYTE, aligned, s, d, count, size);
|
||||
}
|
||||
|
||||
@ -1212,9 +1212,9 @@ class StubGenerator: public StubCodeGenerator {
|
||||
}
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
bool add_entry = !is_oop && (!aligned || sizeof(jlong) == size);
|
||||
UnsafeCopyMemoryMark ucmm(this, add_entry, true);
|
||||
UnsafeMemoryAccessMark umam(this, add_entry, true);
|
||||
copy_memory(decorators, is_oop ? T_OBJECT : T_BYTE, aligned, s, d, count, -size);
|
||||
}
|
||||
|
||||
@ -5500,8 +5500,8 @@ static const int64_t right_3_bits = right_n_bits(3);
|
||||
|
||||
StubRoutines::_forward_exception_entry = generate_forward_exception();
|
||||
|
||||
if (UnsafeCopyMemory::_table == nullptr) {
|
||||
UnsafeCopyMemory::create_table(8 + 4); // 8 for copyMemory; 4 for setMemory
|
||||
if (UnsafeMemoryAccess::_table == nullptr) {
|
||||
UnsafeMemoryAccess::create_table(8 + 4); // 8 for copyMemory; 4 for setMemory
|
||||
}
|
||||
|
||||
StubRoutines::_call_stub_entry =
|
||||
|
@ -1131,8 +1131,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
bs->arraycopy_prologue(_masm, decorators, t, from, to, count);
|
||||
{
|
||||
bool add_entry = (t != T_OBJECT && (!aligned || t == T_INT));
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, add_entry, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, add_entry, true);
|
||||
__ subptr(to, from); // to --> to_from
|
||||
__ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
|
||||
__ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
|
||||
@ -1321,8 +1321,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
{
|
||||
bool add_entry = (t != T_OBJECT && (!aligned || t == T_INT));
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, add_entry, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, add_entry, true);
|
||||
// copy from high to low
|
||||
__ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
|
||||
__ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
|
||||
@ -1450,8 +1450,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
BLOCK_COMMENT("Entry:");
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, true, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, true, true);
|
||||
__ subptr(to, from); // to --> to_from
|
||||
if (UseXMMForArrayCopy) {
|
||||
xmm_copy_forward(from, to_from, count);
|
||||
@ -1505,8 +1505,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ jump_cc(Assembler::aboveEqual, nooverlap);
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, true, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, true, true);
|
||||
|
||||
__ jmpb(L_copy_8_bytes);
|
||||
|
||||
@ -4121,8 +4121,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
create_control_words();
|
||||
|
||||
// Initialize table for copy memory (arraycopy) check.
|
||||
if (UnsafeCopyMemory::_table == nullptr) {
|
||||
UnsafeCopyMemory::create_table(16 + 4); // 16 for copyMemory; 4 for setMemory
|
||||
if (UnsafeMemoryAccess::_table == nullptr) {
|
||||
UnsafeMemoryAccess::create_table(16 + 4); // 16 for copyMemory; 4 for setMemory
|
||||
}
|
||||
|
||||
StubRoutines::x86::_verify_mxcsr_entry = generate_verify_mxcsr();
|
||||
|
@ -4057,8 +4057,8 @@ void StubGenerator::generate_initial_stubs() {
|
||||
create_control_words();
|
||||
|
||||
// Initialize table for unsafe copy memeory check.
|
||||
if (UnsafeCopyMemory::_table == nullptr) {
|
||||
UnsafeCopyMemory::create_table(16 + 4); // 16 for copyMemory; 4 for setMemory
|
||||
if (UnsafeMemoryAccess::_table == nullptr) {
|
||||
UnsafeMemoryAccess::create_table(16 + 4); // 16 for copyMemory; 4 for setMemory
|
||||
}
|
||||
|
||||
// entry points that exist in all platforms Note: This is code
|
||||
|
@ -560,8 +560,8 @@ address StubGenerator::generate_disjoint_copy_avx3_masked(address* entry, const
|
||||
int loop_size[] = { 192, 96, 48, 24};
|
||||
int threshold[] = { 4096, 2048, 1024, 512};
|
||||
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true);
|
||||
// 'from', 'to' and 'count' are now valid
|
||||
|
||||
// temp1 holds remaining count and temp4 holds running count used to compute
|
||||
@ -730,7 +730,7 @@ address StubGenerator::generate_disjoint_copy_avx3_masked(address* entry, const
|
||||
|
||||
if (MaxVectorSize == 64) {
|
||||
__ BIND(L_copy_large);
|
||||
UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, false, ucme_exit_pc);
|
||||
UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, false, ucme_exit_pc);
|
||||
arraycopy_avx3_large(to, from, temp1, temp2, temp3, temp4, count, xmm1, xmm2, xmm3, xmm4, shift);
|
||||
__ jmp(L_finish);
|
||||
}
|
||||
@ -859,8 +859,8 @@ address StubGenerator::generate_conjoint_copy_avx3_masked(address* entry, const
|
||||
int loop_size[] = { 192, 96, 48, 24};
|
||||
int threshold[] = { 4096, 2048, 1024, 512};
|
||||
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true);
|
||||
// 'from', 'to' and 'count' are now valid
|
||||
|
||||
// temp1 holds remaining count.
|
||||
@ -1318,8 +1318,8 @@ address StubGenerator::generate_disjoint_byte_copy(bool aligned, address* entry,
|
||||
// r9 and r10 may be used to save non-volatile registers
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, true);
|
||||
// 'from', 'to' and 'count' are now valid
|
||||
__ movptr(byte_count, count);
|
||||
__ shrptr(count, 3); // count => qword_count
|
||||
@ -1374,7 +1374,7 @@ __ BIND(L_exit);
|
||||
__ ret(0);
|
||||
|
||||
{
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, false, ucme_exit_pc);
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, false, ucme_exit_pc);
|
||||
// Copy in multi-bytes chunks
|
||||
copy_bytes_forward(end_from, end_to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, T_BYTE);
|
||||
__ jmp(L_copy_4_bytes);
|
||||
@ -1432,8 +1432,8 @@ address StubGenerator::generate_conjoint_byte_copy(bool aligned, address nooverl
|
||||
// r9 and r10 may be used to save non-volatile registers
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, true);
|
||||
// 'from', 'to' and 'count' are now valid
|
||||
__ movptr(byte_count, count);
|
||||
__ shrptr(count, 3); // count => qword_count
|
||||
@ -1477,8 +1477,8 @@ address StubGenerator::generate_conjoint_byte_copy(bool aligned, address nooverl
|
||||
__ ret(0);
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, true);
|
||||
// Copy in multi-bytes chunks
|
||||
copy_bytes_backward(from, to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, T_BYTE);
|
||||
}
|
||||
@ -1549,8 +1549,8 @@ address StubGenerator::generate_disjoint_short_copy(bool aligned, address *entry
|
||||
// r9 and r10 may be used to save non-volatile registers
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, true);
|
||||
// 'from', 'to' and 'count' are now valid
|
||||
__ movptr(word_count, count);
|
||||
__ shrptr(count, 2); // count => qword_count
|
||||
@ -1598,7 +1598,7 @@ __ BIND(L_exit);
|
||||
__ ret(0);
|
||||
|
||||
{
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, false, ucme_exit_pc);
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, false, ucme_exit_pc);
|
||||
// Copy in multi-bytes chunks
|
||||
copy_bytes_forward(end_from, end_to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, T_SHORT);
|
||||
__ jmp(L_copy_4_bytes);
|
||||
@ -1624,7 +1624,7 @@ address StubGenerator::generate_fill(BasicType t, bool aligned, const char *name
|
||||
|
||||
{
|
||||
// Add set memory mark to protect against unsafe accesses faulting
|
||||
UnsafeCopyMemoryMark usmm(this, ((t == T_BYTE) && !aligned), true);
|
||||
UnsafeMemoryAccessMark umam(this, ((t == T_BYTE) && !aligned), true);
|
||||
__ generate_fill(t, aligned, to, value, r11, rax, xmm0);
|
||||
}
|
||||
|
||||
@ -1685,8 +1685,8 @@ address StubGenerator::generate_conjoint_short_copy(bool aligned, address noover
|
||||
// r9 and r10 may be used to save non-volatile registers
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, true);
|
||||
// 'from', 'to' and 'count' are now valid
|
||||
__ movptr(word_count, count);
|
||||
__ shrptr(count, 2); // count => qword_count
|
||||
@ -1722,8 +1722,8 @@ address StubGenerator::generate_conjoint_short_copy(bool aligned, address noover
|
||||
__ ret(0);
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !aligned, true);
|
||||
// Copy in multi-bytes chunks
|
||||
copy_bytes_backward(from, to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, T_SHORT);
|
||||
}
|
||||
@ -1806,8 +1806,8 @@ address StubGenerator::generate_disjoint_int_oop_copy(bool aligned, bool is_oop,
|
||||
bs->arraycopy_prologue(_masm, decorators, type, from, to, count);
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true);
|
||||
// 'from', 'to' and 'count' are now valid
|
||||
__ movptr(dword_count, count);
|
||||
__ shrptr(count, 1); // count => qword_count
|
||||
@ -1843,7 +1843,7 @@ __ BIND(L_exit);
|
||||
__ ret(0);
|
||||
|
||||
{
|
||||
UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, false, ucme_exit_pc);
|
||||
UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, false, ucme_exit_pc);
|
||||
// Copy in multi-bytes chunks
|
||||
copy_bytes_forward(end_from, end_to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, is_oop ? T_OBJECT : T_INT);
|
||||
__ jmp(L_copy_4_bytes);
|
||||
@ -1916,8 +1916,8 @@ address StubGenerator::generate_conjoint_int_oop_copy(bool aligned, bool is_oop,
|
||||
|
||||
assert_clean_int(count, rax); // Make sure 'count' is clean int.
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true);
|
||||
// 'from', 'to' and 'count' are now valid
|
||||
__ movptr(dword_count, count);
|
||||
__ shrptr(count, 1); // count => qword_count
|
||||
@ -1949,8 +1949,8 @@ address StubGenerator::generate_conjoint_int_oop_copy(bool aligned, bool is_oop,
|
||||
__ ret(0);
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true);
|
||||
// Copy in multi-bytes chunks
|
||||
copy_bytes_backward(from, to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, is_oop ? T_OBJECT : T_INT);
|
||||
}
|
||||
@ -2031,8 +2031,8 @@ address StubGenerator::generate_disjoint_long_oop_copy(bool aligned, bool is_oop
|
||||
BasicType type = is_oop ? T_OBJECT : T_LONG;
|
||||
bs->arraycopy_prologue(_masm, decorators, type, from, to, qword_count);
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true);
|
||||
|
||||
// Copy from low to high addresses. Use 'to' as scratch.
|
||||
__ lea(end_from, Address(from, qword_count, Address::times_8, -8));
|
||||
@ -2063,8 +2063,8 @@ address StubGenerator::generate_disjoint_long_oop_copy(bool aligned, bool is_oop
|
||||
}
|
||||
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true);
|
||||
// Copy in multi-bytes chunks
|
||||
copy_bytes_forward(end_from, end_to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, is_oop ? T_OBJECT : T_LONG);
|
||||
}
|
||||
@ -2140,8 +2140,8 @@ address StubGenerator::generate_conjoint_long_oop_copy(bool aligned, bool is_oop
|
||||
BasicType type = is_oop ? T_OBJECT : T_LONG;
|
||||
bs->arraycopy_prologue(_masm, decorators, type, from, to, qword_count);
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true);
|
||||
|
||||
__ jmp(L_copy_bytes);
|
||||
|
||||
@ -2167,8 +2167,8 @@ address StubGenerator::generate_conjoint_long_oop_copy(bool aligned, bool is_oop
|
||||
__ ret(0);
|
||||
}
|
||||
{
|
||||
// UnsafeCopyMemory page error: continue after ucm
|
||||
UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true);
|
||||
// UnsafeMemoryAccess page error: continue after unsafe access
|
||||
UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true);
|
||||
|
||||
// Copy in multi-bytes chunks
|
||||
copy_bytes_backward(from, to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, is_oop ? T_OBJECT : T_LONG);
|
||||
@ -2628,7 +2628,7 @@ address StubGenerator::generate_unsafe_setmemory(const char *name,
|
||||
// Fill words
|
||||
{
|
||||
Label L_wordsTail, L_wordsLoop, L_wordsTailLoop;
|
||||
UnsafeCopyMemoryMark usmm(this, true, true);
|
||||
UnsafeMemoryAccessMark umam(this, true, true);
|
||||
|
||||
// At this point, we know the lower bit of size is zero and a
|
||||
// multiple of 2
|
||||
@ -2642,7 +2642,7 @@ address StubGenerator::generate_unsafe_setmemory(const char *name,
|
||||
// Fill QUADWORDs
|
||||
{
|
||||
Label L_qwordLoop, L_qwordsTail, L_qwordsTailLoop;
|
||||
UnsafeCopyMemoryMark usmm(this, true, true);
|
||||
UnsafeMemoryAccessMark umam(this, true, true);
|
||||
|
||||
// At this point, we know the lower 3 bits of size are zero and a
|
||||
// multiple of 8
|
||||
@ -2659,7 +2659,7 @@ address StubGenerator::generate_unsafe_setmemory(const char *name,
|
||||
// Fill DWORDs
|
||||
{
|
||||
Label L_dwordLoop, L_dwordsTail, L_dwordsTailLoop;
|
||||
UnsafeCopyMemoryMark usmm(this, true, true);
|
||||
UnsafeMemoryAccessMark umam(this, true, true);
|
||||
|
||||
// At this point, we know the lower 2 bits of size are zero and a
|
||||
// multiple of 4
|
||||
|
@ -2795,12 +2795,12 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
|
||||
nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr;
|
||||
}
|
||||
|
||||
bool is_unsafe_memory_access = (in_native || in_java) && UnsafeCopyMemory::contains_pc(pc);
|
||||
bool is_unsafe_memory_access = (in_native || in_java) && UnsafeMemoryAccess::contains_pc(pc);
|
||||
if (((in_vm || in_native || is_unsafe_memory_access) && thread->doing_unsafe_access()) ||
|
||||
(nm != nullptr && nm->has_unsafe_access())) {
|
||||
address next_pc = Assembler::locate_next_instruction(pc);
|
||||
if (is_unsafe_memory_access) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
return Handle_Exception(exceptionInfo, SharedRuntime::handle_unsafe_access(thread, next_pc));
|
||||
}
|
||||
|
@ -340,11 +340,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
// underlying file has been truncated. Do not crash the VM in such a case.
|
||||
CodeBlob* cb = CodeCache::find_blob(pc);
|
||||
nmethod* nm = cb ? cb->as_nmethod_or_null() : nullptr;
|
||||
bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
|
||||
bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc));
|
||||
if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) {
|
||||
address next_pc = pc + 4;
|
||||
if (is_unsafe_memory_access) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
os::Posix::ucontext_set_pc(uc, next_pc);
|
||||
@ -368,8 +368,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
thread->thread_state() == _thread_in_native) &&
|
||||
sig == SIGBUS && thread->doing_unsafe_access()) {
|
||||
address next_pc = pc + 4;
|
||||
if (UnsafeCopyMemory::contains_pc(pc)) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
if (UnsafeMemoryAccess::contains_pc(pc)) {
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
os::Posix::ucontext_set_pc(uc, next_pc);
|
||||
|
@ -257,11 +257,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
// Do not crash the VM in such a case.
|
||||
CodeBlob* cb = CodeCache::find_blob(pc);
|
||||
nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr;
|
||||
bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
|
||||
bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc));
|
||||
if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) {
|
||||
address next_pc = pc + NativeCall::instruction_size;
|
||||
if (is_unsafe_memory_access) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
}
|
||||
@ -299,8 +299,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
|
||||
thread->doing_unsafe_access()) {
|
||||
address next_pc = pc + NativeCall::instruction_size;
|
||||
if (UnsafeCopyMemory::contains_pc(pc)) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
if (UnsafeMemoryAccess::contains_pc(pc)) {
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
}
|
||||
|
@ -441,11 +441,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
// Do not crash the VM in such a case.
|
||||
CodeBlob* cb = CodeCache::find_blob(pc);
|
||||
nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr;
|
||||
bool is_unsafe_memory_access = thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc);
|
||||
bool is_unsafe_memory_access = thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc);
|
||||
if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) {
|
||||
address next_pc = Assembler::locate_next_instruction(pc);
|
||||
if (is_unsafe_memory_access) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
}
|
||||
@ -521,8 +521,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
|
||||
thread->doing_unsafe_access()) {
|
||||
address next_pc = Assembler::locate_next_instruction(pc);
|
||||
if (UnsafeCopyMemory::contains_pc(pc)) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
if (UnsafeMemoryAccess::contains_pc(pc)) {
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
}
|
||||
|
@ -240,11 +240,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
// Do not crash the VM in such a case.
|
||||
CodeBlob* cb = CodeCache::find_blob(pc);
|
||||
nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr;
|
||||
bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
|
||||
bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc));
|
||||
if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) {
|
||||
address next_pc = pc + NativeCall::instruction_size;
|
||||
if (is_unsafe_memory_access) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
}
|
||||
@ -286,8 +286,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
|
||||
thread->doing_unsafe_access()) {
|
||||
address next_pc = pc + NativeCall::instruction_size;
|
||||
if (UnsafeCopyMemory::contains_pc(pc)) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
if (UnsafeMemoryAccess::contains_pc(pc)) {
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr;
|
||||
if ((nm != nullptr && nm->has_unsafe_access()) ||
|
||||
(thread->doing_unsafe_access() &&
|
||||
UnsafeCopyMemory::contains_pc(pc))) {
|
||||
UnsafeMemoryAccess::contains_pc(pc))) {
|
||||
unsafe_access = true;
|
||||
}
|
||||
} else if (sig == SIGSEGV &&
|
||||
@ -364,8 +364,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
// any other suitable exception reason,
|
||||
// so assume it is an unsafe access.
|
||||
address next_pc = pc + Assembler::InstructionSize;
|
||||
if (UnsafeCopyMemory::contains_pc(pc)) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
if (UnsafeMemoryAccess::contains_pc(pc)) {
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
#ifdef __thumb__
|
||||
if (uc->uc_mcontext.arm_cpsr & PSR_T_BIT) {
|
||||
|
@ -355,11 +355,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
// underlying file has been truncated. Do not crash the VM in such a case.
|
||||
CodeBlob* cb = CodeCache::find_blob(pc);
|
||||
nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr;
|
||||
bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
|
||||
bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc));
|
||||
if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) {
|
||||
address next_pc = pc + 4;
|
||||
if (is_unsafe_memory_access) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
os::Posix::ucontext_set_pc(uc, next_pc);
|
||||
@ -379,8 +379,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
thread->thread_state() == _thread_in_native) &&
|
||||
sig == SIGBUS && thread->doing_unsafe_access()) {
|
||||
address next_pc = pc + 4;
|
||||
if (UnsafeCopyMemory::contains_pc(pc)) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
if (UnsafeMemoryAccess::contains_pc(pc)) {
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
os::Posix::ucontext_set_pc(uc, next_pc);
|
||||
|
@ -230,11 +230,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
// Do not crash the VM in such a case.
|
||||
CodeBlob* cb = CodeCache::find_blob(pc);
|
||||
nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr;
|
||||
bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
|
||||
bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc));
|
||||
if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) {
|
||||
address next_pc = Assembler::locate_next_instruction(pc);
|
||||
if (is_unsafe_memory_access) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
}
|
||||
@ -272,8 +272,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
|
||||
thread->doing_unsafe_access()) {
|
||||
address next_pc = Assembler::locate_next_instruction(pc);
|
||||
if (UnsafeCopyMemory::contains_pc(pc)) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
if (UnsafeMemoryAccess::contains_pc(pc)) {
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
}
|
||||
|
@ -260,11 +260,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
// Do not crash the VM in such a case.
|
||||
CodeBlob* cb = CodeCache::find_blob(pc);
|
||||
nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr;
|
||||
bool is_unsafe_memory_access = thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc);
|
||||
bool is_unsafe_memory_access = thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc);
|
||||
if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) {
|
||||
address next_pc = Assembler::locate_next_instruction(pc);
|
||||
if (is_unsafe_memory_access) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
}
|
||||
@ -315,8 +315,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
||||
(sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
|
||||
thread->doing_unsafe_access())) {
|
||||
address next_pc = Assembler::locate_next_instruction(pc);
|
||||
if (UnsafeCopyMemory::contains_pc(pc)) {
|
||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||
if (UnsafeMemoryAccess::contains_pc(pc)) {
|
||||
next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
|
||||
}
|
||||
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
|
||||
}
|
||||
|
@ -41,10 +41,10 @@
|
||||
#include "opto/runtime.hpp"
|
||||
#endif
|
||||
|
||||
UnsafeCopyMemory* UnsafeCopyMemory::_table = nullptr;
|
||||
int UnsafeCopyMemory::_table_length = 0;
|
||||
int UnsafeCopyMemory::_table_max_length = 0;
|
||||
address UnsafeCopyMemory::_common_exit_stub_pc = nullptr;
|
||||
UnsafeMemoryAccess* UnsafeMemoryAccess::_table = nullptr;
|
||||
int UnsafeMemoryAccess::_table_length = 0;
|
||||
int UnsafeMemoryAccess::_table_max_length = 0;
|
||||
address UnsafeMemoryAccess::_common_exit_stub_pc = nullptr;
|
||||
|
||||
// Implementation of StubRoutines - for a description
|
||||
// of how to extend it, see the header file.
|
||||
@ -206,14 +206,14 @@ address StubRoutines::_lookup_secondary_supers_table_stubs[Klass::SECONDARY_SUPE
|
||||
|
||||
extern void StubGenerator_generate(CodeBuffer* code, StubCodeGenerator::StubsKind kind); // only interface to generators
|
||||
|
||||
void UnsafeCopyMemory::create_table(int max_size) {
|
||||
UnsafeCopyMemory::_table = new UnsafeCopyMemory[max_size];
|
||||
UnsafeCopyMemory::_table_max_length = max_size;
|
||||
void UnsafeMemoryAccess::create_table(int max_size) {
|
||||
UnsafeMemoryAccess::_table = new UnsafeMemoryAccess[max_size];
|
||||
UnsafeMemoryAccess::_table_max_length = max_size;
|
||||
}
|
||||
|
||||
bool UnsafeCopyMemory::contains_pc(address pc) {
|
||||
for (int i = 0; i < UnsafeCopyMemory::_table_length; i++) {
|
||||
UnsafeCopyMemory* entry = &UnsafeCopyMemory::_table[i];
|
||||
bool UnsafeMemoryAccess::contains_pc(address pc) {
|
||||
for (int i = 0; i < UnsafeMemoryAccess::_table_length; i++) {
|
||||
UnsafeMemoryAccess* entry = &UnsafeMemoryAccess::_table[i];
|
||||
if (pc >= entry->start_pc() && pc < entry->end_pc()) {
|
||||
return true;
|
||||
}
|
||||
@ -221,9 +221,9 @@ bool UnsafeCopyMemory::contains_pc(address pc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
address UnsafeCopyMemory::page_error_continue_pc(address pc) {
|
||||
for (int i = 0; i < UnsafeCopyMemory::_table_length; i++) {
|
||||
UnsafeCopyMemory* entry = &UnsafeCopyMemory::_table[i];
|
||||
address UnsafeMemoryAccess::page_error_continue_pc(address pc) {
|
||||
for (int i = 0; i < UnsafeMemoryAccess::_table_length; i++) {
|
||||
UnsafeMemoryAccess* entry = &UnsafeMemoryAccess::_table[i];
|
||||
if (pc >= entry->start_pc() && pc < entry->end_pc()) {
|
||||
return entry->error_exit_pc();
|
||||
}
|
||||
@ -523,20 +523,20 @@ StubRoutines::select_arraycopy_function(BasicType t, bool aligned, bool disjoint
|
||||
#undef RETURN_STUB_PARM
|
||||
}
|
||||
|
||||
UnsafeCopyMemoryMark::UnsafeCopyMemoryMark(StubCodeGenerator* cgen, bool add_entry, bool continue_at_scope_end, address error_exit_pc) {
|
||||
UnsafeMemoryAccessMark::UnsafeMemoryAccessMark(StubCodeGenerator* cgen, bool add_entry, bool continue_at_scope_end, address error_exit_pc) {
|
||||
_cgen = cgen;
|
||||
_ucm_entry = nullptr;
|
||||
if (add_entry) {
|
||||
address err_exit_pc = nullptr;
|
||||
if (!continue_at_scope_end) {
|
||||
err_exit_pc = error_exit_pc != nullptr ? error_exit_pc : UnsafeCopyMemory::common_exit_stub_pc();
|
||||
err_exit_pc = error_exit_pc != nullptr ? error_exit_pc : UnsafeMemoryAccess::common_exit_stub_pc();
|
||||
}
|
||||
assert(err_exit_pc != nullptr || continue_at_scope_end, "error exit not set");
|
||||
_ucm_entry = UnsafeCopyMemory::add_to_table(_cgen->assembler()->pc(), nullptr, err_exit_pc);
|
||||
_ucm_entry = UnsafeMemoryAccess::add_to_table(_cgen->assembler()->pc(), nullptr, err_exit_pc);
|
||||
}
|
||||
}
|
||||
|
||||
UnsafeCopyMemoryMark::~UnsafeCopyMemoryMark() {
|
||||
UnsafeMemoryAccessMark::~UnsafeMemoryAccessMark() {
|
||||
if (_ucm_entry != nullptr) {
|
||||
_ucm_entry->set_end_pc(_cgen->assembler()->pc());
|
||||
if (_ucm_entry->error_exit_pc() == nullptr) {
|
||||
|
@ -76,17 +76,17 @@
|
||||
// 4. implement the corresponding generator function in the platform-dependent
|
||||
// stubGenerator_<arch>.cpp file and call the function in generate_all() of that file
|
||||
|
||||
class UnsafeCopyMemory : public CHeapObj<mtCode> {
|
||||
class UnsafeMemoryAccess : public CHeapObj<mtCode> {
|
||||
private:
|
||||
address _start_pc;
|
||||
address _end_pc;
|
||||
address _error_exit_pc;
|
||||
public:
|
||||
static address _common_exit_stub_pc;
|
||||
static UnsafeCopyMemory* _table;
|
||||
static UnsafeMemoryAccess* _table;
|
||||
static int _table_length;
|
||||
static int _table_max_length;
|
||||
UnsafeCopyMemory() : _start_pc(nullptr), _end_pc(nullptr), _error_exit_pc(nullptr) {}
|
||||
UnsafeMemoryAccess() : _start_pc(nullptr), _end_pc(nullptr), _error_exit_pc(nullptr) {}
|
||||
void set_start_pc(address pc) { _start_pc = pc; }
|
||||
void set_end_pc(address pc) { _end_pc = pc; }
|
||||
void set_error_exit_pc(address pc) { _error_exit_pc = pc; }
|
||||
@ -97,9 +97,9 @@ class UnsafeCopyMemory : public CHeapObj<mtCode> {
|
||||
static void set_common_exit_stub_pc(address pc) { _common_exit_stub_pc = pc; }
|
||||
static address common_exit_stub_pc() { return _common_exit_stub_pc; }
|
||||
|
||||
static UnsafeCopyMemory* add_to_table(address start_pc, address end_pc, address error_exit_pc) {
|
||||
guarantee(_table_length < _table_max_length, "Incorrect UnsafeCopyMemory::_table_max_length");
|
||||
UnsafeCopyMemory* entry = &_table[_table_length];
|
||||
static UnsafeMemoryAccess* add_to_table(address start_pc, address end_pc, address error_exit_pc) {
|
||||
guarantee(_table_length < _table_max_length, "Incorrect UnsafeMemoryAccess::_table_max_length");
|
||||
UnsafeMemoryAccess* entry = &_table[_table_length];
|
||||
entry->set_start_pc(start_pc);
|
||||
entry->set_end_pc(end_pc);
|
||||
entry->set_error_exit_pc(error_exit_pc);
|
||||
@ -113,13 +113,13 @@ class UnsafeCopyMemory : public CHeapObj<mtCode> {
|
||||
static void create_table(int max_size);
|
||||
};
|
||||
|
||||
class UnsafeCopyMemoryMark : public StackObj {
|
||||
class UnsafeMemoryAccessMark : public StackObj {
|
||||
private:
|
||||
UnsafeCopyMemory* _ucm_entry;
|
||||
UnsafeMemoryAccess* _ucm_entry;
|
||||
StubCodeGenerator* _cgen;
|
||||
public:
|
||||
UnsafeCopyMemoryMark(StubCodeGenerator* cgen, bool add_entry, bool continue_at_scope_end, address error_exit_pc = nullptr);
|
||||
~UnsafeCopyMemoryMark();
|
||||
UnsafeMemoryAccessMark(StubCodeGenerator* cgen, bool add_entry, bool continue_at_scope_end, address error_exit_pc = nullptr);
|
||||
~UnsafeMemoryAccessMark();
|
||||
};
|
||||
|
||||
class StubRoutines: AllStatic {
|
||||
|
Loading…
Reference in New Issue
Block a user