8322163: runtime/Unsafe/InternalErrorTest.java fails on Alpine after JDK-8320886
Reviewed-by: mdoerr, clanger
This commit is contained in:
parent
dce7a5732e
commit
1230853343
@ -243,6 +243,16 @@ void Copy::fill_to_memory_atomic(void* to, size_t size, jubyte value) {
|
||||
}
|
||||
} else {
|
||||
// Not aligned, so no need to be atomic.
|
||||
#ifdef MUSL_LIBC
|
||||
// This code is used by Unsafe and may hit the next page after truncation of mapped memory.
|
||||
// Therefore, we use volatile to prevent compilers from replacing the loop by memset which
|
||||
// may not trigger SIGBUS as needed (observed on Alpine Linux x86_64)
|
||||
jbyte fill = value;
|
||||
for (uintptr_t off = 0; off < size; off += sizeof(jbyte)) {
|
||||
*(volatile jbyte*)(dst + off) = fill;
|
||||
}
|
||||
#else
|
||||
Copy::fill_to_bytes(dst, size, value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user