mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
JDK-8369207: _Copy_conjoint_{jshorts,jints,jlongs}_atomic on Linux/BSD AArch64 do not prevent tearing
Signed-off-by: Justin King <jcking@google.com>
This commit is contained in:
parent
2bfada3f58
commit
e3e0cb0a52
@ -521,10 +521,6 @@ void os::current_thread_enable_wx(WXMode mode) {
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void atomic_copy64(const volatile void *src, volatile void *dst) {
|
||||
*(jlong *) dst = *(const jlong *) src;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
int SpinPause() {
|
||||
// We don't use StubRoutines::aarch64::spin_wait stub in order to
|
||||
@ -559,28 +555,28 @@ extern "C" {
|
||||
if (from > to) {
|
||||
const jshort *end = from + count;
|
||||
while (from < end)
|
||||
*(to++) = *(from++);
|
||||
*((volatile jshort*) to++) = *(from++);
|
||||
}
|
||||
else if (from < to) {
|
||||
const jshort *end = from;
|
||||
from += count - 1;
|
||||
to += count - 1;
|
||||
while (from >= end)
|
||||
*(to--) = *(from--);
|
||||
*((volatile jshort*) to--) = *(from--);
|
||||
}
|
||||
}
|
||||
void _Copy_conjoint_jints_atomic(const jint* from, jint* to, size_t count) {
|
||||
if (from > to) {
|
||||
const jint *end = from + count;
|
||||
while (from < end)
|
||||
*(to++) = *(from++);
|
||||
*((volatile jint*) to++) = *(from++);
|
||||
}
|
||||
else if (from < to) {
|
||||
const jint *end = from;
|
||||
from += count - 1;
|
||||
to += count - 1;
|
||||
while (from >= end)
|
||||
*(to--) = *(from--);
|
||||
*((volatile jint*) to--) = *(from--);
|
||||
}
|
||||
}
|
||||
|
||||
@ -588,14 +584,14 @@ extern "C" {
|
||||
if (from > to) {
|
||||
const jlong *end = from + count;
|
||||
while (from < end)
|
||||
atomic_copy64(from++, to++);
|
||||
*((volatile jlong*) to++) = *(from++);
|
||||
}
|
||||
else if (from < to) {
|
||||
const jlong *end = from;
|
||||
from += count - 1;
|
||||
to += count - 1;
|
||||
while (from >= end)
|
||||
atomic_copy64(from--, to--);
|
||||
*((volatile jlong*) to--) = *(from--);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -383,10 +383,6 @@ int os::extra_bang_size_in_bytes() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void atomic_copy64(const volatile void *src, volatile void *dst) {
|
||||
*(jlong *) dst = *(const jlong *) src;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
int SpinPause() {
|
||||
using spin_wait_func_ptr_t = void (*)();
|
||||
@ -409,28 +405,28 @@ extern "C" {
|
||||
if (from > to) {
|
||||
const jshort *end = from + count;
|
||||
while (from < end)
|
||||
*(to++) = *(from++);
|
||||
*((volatile jshort*) to++) = *(from++);
|
||||
}
|
||||
else if (from < to) {
|
||||
const jshort *end = from;
|
||||
from += count - 1;
|
||||
to += count - 1;
|
||||
while (from >= end)
|
||||
*(to--) = *(from--);
|
||||
*((volatile jshort*) to--) = *(from--);
|
||||
}
|
||||
}
|
||||
void _Copy_conjoint_jints_atomic(const jint* from, jint* to, size_t count) {
|
||||
if (from > to) {
|
||||
const jint *end = from + count;
|
||||
while (from < end)
|
||||
*(to++) = *(from++);
|
||||
*((volatile jint*) to++) = *(from++);
|
||||
}
|
||||
else if (from < to) {
|
||||
const jint *end = from;
|
||||
from += count - 1;
|
||||
to += count - 1;
|
||||
while (from >= end)
|
||||
*(to--) = *(from--);
|
||||
*((volatile jint*) to--) = *(from--);
|
||||
}
|
||||
}
|
||||
|
||||
@ -438,14 +434,14 @@ extern "C" {
|
||||
if (from > to) {
|
||||
const jlong *end = from + count;
|
||||
while (from < end)
|
||||
atomic_copy64(from++, to++);
|
||||
*((volatile jlong*) to++) = *(from++);
|
||||
}
|
||||
else if (from < to) {
|
||||
const jlong *end = from;
|
||||
from += count - 1;
|
||||
to += count - 1;
|
||||
while (from >= end)
|
||||
atomic_copy64(from--, to--);
|
||||
*((volatile jlong*) to--) = *(from--);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user