author | coleenp |
Thu, 10 Jan 2019 15:13:51 -0500 | |
changeset 53244 | 9807daeb47c4 |
parent 48951 | 950c35ea6237 |
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:
670
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
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:
670
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 CPU_SPARC_COPY_SPARC_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
48951
diff
changeset
|
26 |
#define CPU_SPARC_COPY_SPARC_HPP |
7397 | 27 |
|
1 | 28 |
// Inline functions for memory copy and fill. |
29 |
||
48951 | 30 |
static void pd_conjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
1 | 31 |
(void)memmove(to, from, count * HeapWordSize); |
32 |
} |
|
33 |
||
48951 | 34 |
static void pd_disjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
1 | 35 |
switch (count) { |
36 |
case 8: to[7] = from[7]; |
|
37 |
case 7: to[6] = from[6]; |
|
38 |
case 6: to[5] = from[5]; |
|
39 |
case 5: to[4] = from[4]; |
|
40 |
case 4: to[3] = from[3]; |
|
41 |
case 3: to[2] = from[2]; |
|
42 |
case 2: to[1] = from[1]; |
|
43 |
case 1: to[0] = from[0]; |
|
44 |
case 0: break; |
|
45 |
default: (void)memcpy(to, from, count * HeapWordSize); |
|
46 |
break; |
|
47 |
} |
|
48 |
} |
|
49 |
||
48951 | 50 |
static void pd_disjoint_words_atomic(const HeapWord* from, HeapWord* to, size_t count) { |
1 | 51 |
switch (count) { |
52 |
case 8: to[7] = from[7]; |
|
53 |
case 7: to[6] = from[6]; |
|
54 |
case 6: to[5] = from[5]; |
|
55 |
case 5: to[4] = from[4]; |
|
56 |
case 4: to[3] = from[3]; |
|
57 |
case 3: to[2] = from[2]; |
|
58 |
case 2: to[1] = from[1]; |
|
59 |
case 1: to[0] = from[0]; |
|
60 |
case 0: break; |
|
61 |
default: while (count-- > 0) { |
|
62 |
*to++ = *from++; |
|
63 |
} |
|
64 |
break; |
|
65 |
} |
|
66 |
} |
|
67 |
||
48951 | 68 |
static void pd_aligned_conjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
1 | 69 |
(void)memmove(to, from, count * HeapWordSize); |
70 |
} |
|
71 |
||
48951 | 72 |
static void pd_aligned_disjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
1 | 73 |
pd_disjoint_words(from, to, count); |
74 |
} |
|
75 |
||
48951 | 76 |
static void pd_conjoint_bytes(const void* from, void* to, size_t count) { |
1 | 77 |
(void)memmove(to, from, count); |
78 |
} |
|
79 |
||
48951 | 80 |
static void pd_conjoint_bytes_atomic(const void* from, void* to, size_t count) { |
1 | 81 |
(void)memmove(to, from, count); |
82 |
} |
|
83 |
||
48951 | 84 |
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:
10501
diff
changeset
|
85 |
if (from > to) { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
86 |
while (count-- > 0) { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
87 |
// Copy forwards |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
88 |
*to++ = *from++; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
89 |
} |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
90 |
} else { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
91 |
from += count - 1; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
92 |
to += count - 1; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
93 |
while (count-- > 0) { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
94 |
// Copy backwards |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
95 |
*to-- = *from--; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
96 |
} |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
97 |
} |
1 | 98 |
} |
99 |
||
48951 | 100 |
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:
10501
diff
changeset
|
101 |
if (from > to) { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
102 |
while (count-- > 0) { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
103 |
// Copy forwards |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
104 |
*to++ = *from++; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
105 |
} |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
106 |
} else { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
107 |
from += count - 1; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
108 |
to += count - 1; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
109 |
while (count-- > 0) { |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
110 |
// Copy backwards |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
111 |
*to-- = *from--; |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
112 |
} |
2ee610c1fe49
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
kvn
parents:
10501
diff
changeset
|
113 |
} |
1 | 114 |
} |
115 |
||
48951 | 116 |
static void pd_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) { |
1 | 117 |
assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); |
48951 | 118 |
pd_conjoint_oops_atomic((const oop*)from, (oop*)to, count); |
1 | 119 |
} |
120 |
||
48951 | 121 |
static void pd_conjoint_oops_atomic(const oop* from, oop* to, size_t count) { |
1 | 122 |
// Do better than this: inline memmove body NEEDS CLEANUP |
123 |
if (from > to) { |
|
124 |
while (count-- > 0) { |
|
125 |
// Copy forwards |
|
126 |
*to++ = *from++; |
|
127 |
} |
|
128 |
} else { |
|
129 |
from += count - 1; |
|
130 |
to += count - 1; |
|
131 |
while (count-- > 0) { |
|
132 |
// Copy backwards |
|
133 |
*to-- = *from--; |
|
134 |
} |
|
135 |
} |
|
136 |
} |
|
137 |
||
48951 | 138 |
static void pd_arrayof_conjoint_bytes(const HeapWord* from, HeapWord* to, size_t count) { |
1 | 139 |
pd_conjoint_bytes_atomic(from, to, count); |
140 |
} |
|
141 |
||
48951 | 142 |
static void pd_arrayof_conjoint_jshorts(const HeapWord* from, HeapWord* to, size_t count) { |
143 |
pd_conjoint_jshorts_atomic((const jshort*)from, (jshort*)to, count); |
|
1 | 144 |
} |
145 |
||
48951 | 146 |
static void pd_arrayof_conjoint_jints(const HeapWord* from, HeapWord* to, size_t count) { |
147 |
pd_conjoint_jints_atomic((const jint*)from, (jint*)to, count); |
|
1 | 148 |
} |
149 |
||
48951 | 150 |
static void pd_arrayof_conjoint_jlongs(const HeapWord* from, HeapWord* to, size_t count) { |
151 |
pd_conjoint_jlongs_atomic((const jlong*)from, (jlong*)to, count); |
|
1 | 152 |
} |
153 |
||
48951 | 154 |
static void pd_arrayof_conjoint_oops(const HeapWord* from, HeapWord* to, size_t count) { |
155 |
pd_conjoint_oops_atomic((const oop*)from, (oop*)to, count); |
|
1 | 156 |
} |
157 |
||
158 |
static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) { |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
159 |
guarantee(mask_bits((uintptr_t)tohw, right_n_bits(LogBytesPerLong)) == 0, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
160 |
"unaligned fill words"); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
161 |
julong* to = (julong*)tohw; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
162 |
julong v = ((julong)value << 32) | value; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
163 |
while (count-- > 0) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
164 |
*to++ = v; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
165 |
} |
1 | 166 |
} |
167 |
||
10501 | 168 |
typedef void (*_zero_Fn)(HeapWord* to, size_t count); |
169 |
||
35898
ddc274f0052f
8145628: hotspot metadata classes shouldn't use HeapWordSize or heap related macros like align_object_size
coleenp
parents:
24675
diff
changeset
|
170 |
// Only used for heap objects, so align_object_offset. |
ddc274f0052f
8145628: hotspot metadata classes shouldn't use HeapWordSize or heap related macros like align_object_size
coleenp
parents:
24675
diff
changeset
|
171 |
// All other platforms pd_fill_to_aligned_words simply calls pd_fill_to_words, don't |
ddc274f0052f
8145628: hotspot metadata classes shouldn't use HeapWordSize or heap related macros like align_object_size
coleenp
parents:
24675
diff
changeset
|
172 |
// know why this one is different. |
1 | 173 |
static void pd_fill_to_aligned_words(HeapWord* tohw, size_t count, juint value) { |
5694
1e0532a6abff
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
670
diff
changeset
|
174 |
assert(MinObjAlignmentInBytes >= BytesPerLong, "need alternate implementation"); |
1 | 175 |
|
10501 | 176 |
if (value == 0 && UseBlockZeroing && |
24675
8dd2c4604ff4
8043206: Fix signed vs. unsigned comparison warning in copy_sparc.hpp
mikael
parents:
10743
diff
changeset
|
177 |
(count > (size_t)(BlockZeroingLowLimit >> LogHeapWordSize))) { |
10501 | 178 |
// Call it only when block zeroing is used |
179 |
((_zero_Fn)StubRoutines::zero_aligned_words())(tohw, count); |
|
180 |
} else { |
|
1 | 181 |
julong* to = (julong*)tohw; |
182 |
julong v = ((julong)value << 32) | value; |
|
183 |
// If count is odd, odd will be equal to 1 on 32-bit platform |
|
184 |
// and be equal to 0 on 64-bit platform. |
|
185 |
size_t odd = count % (BytesPerLong / HeapWordSize) ; |
|
186 |
||
5694
1e0532a6abff
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
670
diff
changeset
|
187 |
size_t aligned_count = align_object_offset(count - odd) / HeapWordsPerLong; |
1 | 188 |
julong* end = ((julong*)tohw) + aligned_count - 1; |
189 |
while (to <= end) { |
|
190 |
DEBUG_ONLY(count -= BytesPerLong / HeapWordSize ;) |
|
191 |
*to++ = v; |
|
192 |
} |
|
193 |
assert(count == odd, "bad bounds on loop filling to aligned words"); |
|
194 |
if (odd) { |
|
195 |
*((juint*)to) = value; |
|
196 |
||
197 |
} |
|
10501 | 198 |
} |
1 | 199 |
} |
200 |
||
201 |
static void pd_fill_to_bytes(void* to, size_t count, jubyte value) { |
|
202 |
(void)memset(to, value, count); |
|
203 |
} |
|
204 |
||
205 |
static void pd_zero_to_words(HeapWord* tohw, size_t count) { |
|
206 |
pd_fill_to_words(tohw, count, 0); |
|
207 |
} |
|
208 |
||
209 |
static void pd_zero_to_bytes(void* to, size_t count) { |
|
210 |
(void)memset(to, 0, count); |
|
211 |
} |
|
7397 | 212 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
48951
diff
changeset
|
213 |
#endif // CPU_SPARC_COPY_SPARC_HPP |