Skip to content

Commit 7f189a5

Browse files
swesongaPaul Hohensee
authored andcommitted
8334475: UnsafeIntrinsicsTest.java#ZGenerationalDebug assert(!assert_on_failure) failed: Has low-order bits set
Reviewed-by: stefank Backport-of: 5bf2709
1 parent 52e373c commit 7f189a5

File tree

1 file changed

+23
-40
lines changed

1 file changed

+23
-40
lines changed

src/hotspot/os_cpu/windows_aarch64/copy_windows_aarch64.hpp

Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,27 @@
2626
#ifndef OS_CPU_WINDOWS_AARCH64_COPY_WINDOWS_AARCH64_HPP
2727
#define OS_CPU_WINDOWS_AARCH64_COPY_WINDOWS_AARCH64_HPP
2828

29+
#include "runtime/atomic.hpp"
30+
2931
#include <string.h>
3032

33+
template <typename T>
34+
static void pd_conjoint_atomic_helper(const T* from, T* to, size_t count) {
35+
if (from > to) {
36+
while (count-- > 0) {
37+
// Copy forwards
38+
Atomic::store(to++, Atomic::load(from++));
39+
}
40+
} else {
41+
from += count - 1;
42+
to += count - 1;
43+
while (count-- > 0) {
44+
// Copy backwards
45+
Atomic::store(to--, Atomic::load(from--));
46+
}
47+
}
48+
}
49+
3150
static void pd_conjoint_words(const HeapWord* from, HeapWord* to, size_t count) {
3251
(void)memmove(to, from, count * HeapWordSize);
3352
}
@@ -71,55 +90,19 @@ static void pd_conjoint_bytes_atomic(const void* from, void* to, size_t count) {
7190
}
7291

7392
static void pd_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) {
74-
if (from > to) {
75-
while (count-- > 0) {
76-
// Copy forwards
77-
*to++ = *from++;
78-
}
79-
} else {
80-
from += count - 1;
81-
to += count - 1;
82-
while (count-- > 0) {
83-
// Copy backwards
84-
*to-- = *from--;
85-
}
86-
}
93+
pd_conjoint_atomic_helper(from, to, count);
8794
}
8895

8996
static void pd_conjoint_jints_atomic(const jint* from, jint* to, size_t count) {
90-
if (from > to) {
91-
while (count-- > 0) {
92-
// Copy forwards
93-
*to++ = *from++;
94-
}
95-
} else {
96-
from += count - 1;
97-
to += count - 1;
98-
while (count-- > 0) {
99-
// Copy backwards
100-
*to-- = *from--;
101-
}
102-
}
97+
pd_conjoint_atomic_helper(from, to, count);
10398
}
10499

105100
static void pd_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) {
106-
pd_conjoint_oops_atomic((const oop*)from, (oop*)to, count);
101+
pd_conjoint_atomic_helper(from, to, count);
107102
}
108103

109104
static void pd_conjoint_oops_atomic(const oop* from, oop* to, size_t count) {
110-
if (from > to) {
111-
while (count-- > 0) {
112-
// Copy forwards
113-
*to++ = *from++;
114-
}
115-
} else {
116-
from += count - 1;
117-
to += count - 1;
118-
while (count-- > 0) {
119-
// Copy backwards
120-
*to-- = *from--;
121-
}
122-
}
105+
pd_conjoint_atomic_helper(from, to, count);
123106
}
124107

125108
static void pd_arrayof_conjoint_bytes(const HeapWord* from, HeapWord* to, size_t count) {

0 commit comments

Comments
 (0)