author | darcy |
Tue, 12 Nov 2019 10:45:23 -0800 | |
changeset 59037 | 3d2575331a41 |
parent 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
48951
diff
changeset
|
2 |
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
48951
diff
changeset
|
25 |
#ifndef OS_CPU_WINDOWS_X86_COPY_WINDOWS_X86_INLINE_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
48951
diff
changeset
|
26 |
#define OS_CPU_WINDOWS_X86_COPY_WINDOWS_X86_INLINE_HPP |
7397 | 27 |
|
48951 | 28 |
static void pd_conjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
1 | 29 |
(void)memmove(to, from, count * HeapWordSize); |
30 |
} |
|
31 |
||
48951 | 32 |
static void pd_disjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
1 | 33 |
#ifdef AMD64 |
34 |
switch (count) { |
|
35 |
case 8: to[7] = from[7]; |
|
36 |
case 7: to[6] = from[6]; |
|
37 |
case 6: to[5] = from[5]; |
|
38 |
case 5: to[4] = from[4]; |
|
39 |
case 4: to[3] = from[3]; |
|
40 |
case 3: to[2] = from[2]; |
|
41 |
case 2: to[1] = from[1]; |
|
42 |
case 1: to[0] = from[0]; |
|
43 |
case 0: break; |
|
44 |
default: |
|
45 |
(void)memcpy(to, from, count * HeapWordSize); |
|
46 |
break; |
|
47 |
} |
|
48 |
#else |
|
49 |
(void)memcpy(to, from, count * HeapWordSize); |
|
50 |
#endif // AMD64 |
|
51 |
} |
|
52 |
||
48951 | 53 |
static void pd_disjoint_words_atomic(const HeapWord* from, HeapWord* to, size_t count) { |
1 | 54 |
switch (count) { |
55 |
case 8: to[7] = from[7]; |
|
56 |
case 7: to[6] = from[6]; |
|
57 |
case 6: to[5] = from[5]; |
|
58 |
case 5: to[4] = from[4]; |
|
59 |
case 4: to[3] = from[3]; |
|
60 |
case 3: to[2] = from[2]; |
|
61 |
case 2: to[1] = from[1]; |
|
62 |
case 1: to[0] = from[0]; |
|
63 |
case 0: break; |
|
64 |
default: while (count-- > 0) { |
|
65 |
*to++ = *from++; |
|
66 |
} |
|
67 |
break; |
|
68 |
} |
|
69 |
} |
|
70 |
||
48951 | 71 |
static void pd_aligned_conjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
1 | 72 |
(void)memmove(to, from, count * HeapWordSize); |
73 |
} |
|
74 |
||
48951 | 75 |
static void pd_aligned_disjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
1 | 76 |
pd_disjoint_words(from, to, count); |
77 |
} |
|
78 |
||
48951 | 79 |
static void pd_conjoint_bytes(const void* from, void* to, size_t count) { |
1 | 80 |
(void)memmove(to, from, count); |
81 |
} |
|
82 |
||
48951 | 83 |
static void pd_conjoint_bytes_atomic(const void* from, void* to, size_t count) { |
1 | 84 |
pd_conjoint_bytes(from, to, count); |
85 |
} |
|
86 |
||
48951 | 87 |
static void pd_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) { |
10743
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
88 |
if (from > to) { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
89 |
while (count-- > 0) { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
90 |
// Copy forwards |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
91 |
*to++ = *from++; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
92 |
} |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
93 |
} else { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
94 |
from += count - 1; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
95 |
to += count - 1; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
96 |
while (count-- > 0) { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
97 |
// Copy backwards |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
98 |
*to-- = *from--; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
99 |
} |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
100 |
} |
1 | 101 |
} |
102 |
||
48951 | 103 |
static void pd_conjoint_jints_atomic(const jint* from, jint* to, size_t count) { |
10743
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
104 |
if (from > to) { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
105 |
while (count-- > 0) { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
106 |
// Copy forwards |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
107 |
*to++ = *from++; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
108 |
} |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
109 |
} else { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
110 |
from += count - 1; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
111 |
to += count - 1; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
112 |
while (count-- > 0) { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
113 |
// Copy backwards |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
114 |
*to-- = *from--; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
115 |
} |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
7397
diff
changeset
|
116 |
} |
1 | 117 |
} |
118 |
||
48951 | 119 |
static void pd_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) { |
1 | 120 |
#ifdef AMD64 |
121 |
assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); |
|
48951 | 122 |
pd_conjoint_oops_atomic((const oop*)from, (oop*)to, count); |
1 | 123 |
#else |
124 |
// Guarantee use of fild/fistp or xmm regs via some asm code, because compilers won't. |
|
125 |
__asm { |
|
126 |
mov eax, from; |
|
127 |
mov edx, to; |
|
128 |
mov ecx, count; |
|
129 |
cmp eax, edx; |
|
130 |
jbe downtest; |
|
131 |
jmp uptest; |
|
132 |
up: |
|
133 |
fild qword ptr [eax]; |
|
134 |
fistp qword ptr [edx]; |
|
135 |
add eax, 8; |
|
136 |
add edx, 8; |
|
137 |
uptest: |
|
138 |
sub ecx, 1; |
|
139 |
jge up; |
|
140 |
jmp done; |
|
141 |
down: |
|
142 |
fild qword ptr [eax][ecx*8]; |
|
143 |
fistp qword ptr [edx][ecx*8]; |
|
144 |
downtest: |
|
145 |
sub ecx, 1; |
|
146 |
jge down; |
|
147 |
done:; |
|
148 |
} |
|
149 |
#endif // AMD64 |
|
150 |
} |
|
151 |
||
48951 | 152 |
static void pd_conjoint_oops_atomic(const oop* from, oop* to, size_t count) { |
1 | 153 |
// Do better than this: inline memmove body NEEDS CLEANUP |
154 |
if (from > to) { |
|
155 |
while (count-- > 0) { |
|
156 |
// Copy forwards |
|
157 |
*to++ = *from++; |
|
158 |
} |
|
159 |
} else { |
|
160 |
from += count - 1; |
|
161 |
to += count - 1; |
|
162 |
while (count-- > 0) { |
|
163 |
// Copy backwards |
|
164 |
*to-- = *from--; |
|
165 |
} |
|
166 |
} |
|
167 |
} |
|
168 |
||
48951 | 169 |
static void pd_arrayof_conjoint_bytes(const HeapWord* from, HeapWord* to, size_t count) { |
1 | 170 |
#ifdef AMD64 |
171 |
pd_conjoint_bytes_atomic(from, to, count); |
|
172 |
#else |
|
173 |
pd_conjoint_bytes(from, to, count); |
|
174 |
#endif // AMD64 |
|
175 |
} |
|
176 |
||
48951 | 177 |
static void pd_arrayof_conjoint_jshorts(const HeapWord* from, HeapWord* to, size_t count) { |
178 |
pd_conjoint_jshorts_atomic((const jshort*)from, (jshort*)to, count); |
|
1 | 179 |
} |
180 |
||
48951 | 181 |
static void pd_arrayof_conjoint_jints(const HeapWord* from, HeapWord* to, size_t count) { |
182 |
pd_conjoint_jints_atomic((const jint*)from, (jint*)to, count); |
|
1 | 183 |
} |
184 |
||
48951 | 185 |
static void pd_arrayof_conjoint_jlongs(const HeapWord* from, HeapWord* to, size_t count) { |
186 |
pd_conjoint_jlongs_atomic((const jlong*)from, (jlong*)to, count); |
|
1 | 187 |
} |
188 |
||
48951 | 189 |
static void pd_arrayof_conjoint_oops(const HeapWord* from, HeapWord* to, size_t count) { |
190 |
pd_conjoint_oops_atomic((const oop*)from, (oop*)to, count); |
|
1 | 191 |
} |
7397 | 192 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
48951
diff
changeset
|
193 |
#endif // OS_CPU_WINDOWS_X86_COPY_WINDOWS_X86_INLINE_HPP |