author | coleenp |
Tue, 19 Dec 2017 06:29:17 -0500 | |
changeset 48468 | 7cc7de9bf4a4 |
parent 47593 | 2d56326b98f0 |
child 50029 | ea0a16ba6ac0 |
permissions | -rw-r--r-- |
10565 | 1 |
/* |
46523
cbcc0ebaa044
8166651: OrderAccess::load_acquire &etc should have const parameters
kbarrett
parents:
40655
diff
changeset
|
2 |
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
28468
b8e9517bf6b9
8067331: Zero: Atomic::xchg and Atomic::xchg_ptr need full memory barrier
sgehwolf
parents:
25715
diff
changeset
|
3 |
* Copyright 2007, 2008, 2011, 2015, Red Hat, Inc. |
10565 | 4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 |
* |
|
6 |
* This code is free software; you can redistribute it and/or modify it |
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
|
8 |
* published by the Free Software Foundation. |
|
9 |
* |
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
14 |
* accompanied this code). |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License version |
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 |
* |
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
21 |
* or visit www.oracle.com if you need additional information or have any |
|
22 |
* questions. |
|
23 |
* |
|
24 |
*/ |
|
25 |
||
40655
9f644073d3a0
8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents:
39404
diff
changeset
|
26 |
#ifndef OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP |
9f644073d3a0
8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents:
39404
diff
changeset
|
27 |
#define OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP |
10565 | 28 |
|
29 |
#include "runtime/os.hpp" |
|
30 |
||
31 |
// Implementation of class atomic |
|
32 |
||
33 |
#ifdef M68K |
|
34 |
||
35 |
/* |
|
36 |
* __m68k_cmpxchg |
|
37 |
* |
|
38 |
* Atomically store newval in *ptr if *ptr is equal to oldval for user space. |
|
39 |
* Returns newval on success and oldval if no exchange happened. |
|
40 |
* This implementation is processor specific and works on |
|
41 |
* 68020 68030 68040 and 68060. |
|
42 |
* |
|
43 |
* It will not work on ColdFire, 68000 and 68010 since they lack the CAS |
|
44 |
* instruction. |
|
45 |
* Using a kernelhelper would be better for arch complete implementation. |
|
46 |
* |
|
47 |
*/ |
|
48 |
||
49 |
static inline int __m68k_cmpxchg(int oldval, int newval, volatile int *ptr) { |
|
50 |
int ret; |
|
51 |
__asm __volatile ("cas%.l %0,%2,%1" |
|
52 |
: "=d" (ret), "+m" (*(ptr)) |
|
53 |
: "d" (newval), "0" (oldval)); |
|
54 |
return ret; |
|
55 |
} |
|
56 |
||
57 |
/* Perform an atomic compare and swap: if the current value of `*PTR' |
|
58 |
is OLDVAL, then write NEWVAL into `*PTR'. Return the contents of |
|
59 |
`*PTR' before the operation.*/ |
|
46958
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
60 |
static inline int m68k_compare_and_swap(int newval, |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
61 |
volatile int *ptr, |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
62 |
int oldval) { |
10565 | 63 |
for (;;) { |
64 |
int prev = *ptr; |
|
65 |
if (prev != oldval) |
|
66 |
return prev; |
|
67 |
||
68 |
if (__m68k_cmpxchg (prev, newval, ptr) == newval) |
|
69 |
// Success. |
|
70 |
return prev; |
|
71 |
||
72 |
// We failed even though prev == oldval. Try again. |
|
73 |
} |
|
74 |
} |
|
75 |
||
76 |
/* Atomically add an int to memory. */ |
|
46993
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
77 |
static inline int m68k_add_and_fetch(int add_value, volatile int *ptr) { |
10565 | 78 |
for (;;) { |
79 |
// Loop until success. |
|
80 |
||
81 |
int prev = *ptr; |
|
82 |
||
83 |
if (__m68k_cmpxchg (prev, prev + add_value, ptr) == prev + add_value) |
|
84 |
return prev + add_value; |
|
85 |
} |
|
86 |
} |
|
87 |
||
88 |
/* Atomically write VALUE into `*PTR' and returns the previous |
|
89 |
contents of `*PTR'. */ |
|
47578
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
90 |
static inline int m68k_lock_test_and_set(int newval, volatile int *ptr) { |
10565 | 91 |
for (;;) { |
92 |
// Loop until success. |
|
93 |
int prev = *ptr; |
|
94 |
||
95 |
if (__m68k_cmpxchg (prev, newval, ptr) == prev) |
|
96 |
return prev; |
|
97 |
} |
|
98 |
} |
|
99 |
#endif // M68K |
|
100 |
||
101 |
#ifdef ARM |
|
102 |
||
103 |
/* |
|
104 |
* __kernel_cmpxchg |
|
105 |
* |
|
106 |
* Atomically store newval in *ptr if *ptr is equal to oldval for user space. |
|
107 |
* Return zero if *ptr was changed or non-zero if no exchange happened. |
|
108 |
* The C flag is also set if *ptr was changed to allow for assembly |
|
109 |
* optimization in the calling code. |
|
110 |
* |
|
111 |
*/ |
|
112 |
||
113 |
typedef int (__kernel_cmpxchg_t)(int oldval, int newval, volatile int *ptr); |
|
114 |
#define __kernel_cmpxchg (*(__kernel_cmpxchg_t *) 0xffff0fc0) |
|
115 |
||
116 |
||
117 |
||
118 |
/* Perform an atomic compare and swap: if the current value of `*PTR' |
|
119 |
is OLDVAL, then write NEWVAL into `*PTR'. Return the contents of |
|
120 |
`*PTR' before the operation.*/ |
|
46958
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
121 |
static inline int arm_compare_and_swap(int newval, |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
122 |
volatile int *ptr, |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
123 |
int oldval) { |
10565 | 124 |
for (;;) { |
125 |
int prev = *ptr; |
|
126 |
if (prev != oldval) |
|
127 |
return prev; |
|
128 |
||
129 |
if (__kernel_cmpxchg (prev, newval, ptr) == 0) |
|
130 |
// Success. |
|
131 |
return prev; |
|
132 |
||
133 |
// We failed even though prev == oldval. Try again. |
|
134 |
} |
|
135 |
} |
|
136 |
||
137 |
/* Atomically add an int to memory. */ |
|
46993
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
138 |
static inline int arm_add_and_fetch(int add_value, volatile int *ptr) { |
10565 | 139 |
for (;;) { |
140 |
// Loop until a __kernel_cmpxchg succeeds. |
|
141 |
||
142 |
int prev = *ptr; |
|
143 |
||
144 |
if (__kernel_cmpxchg (prev, prev + add_value, ptr) == 0) |
|
145 |
return prev + add_value; |
|
146 |
} |
|
147 |
} |
|
148 |
||
149 |
/* Atomically write VALUE into `*PTR' and returns the previous |
|
150 |
contents of `*PTR'. */ |
|
47578
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
151 |
static inline int arm_lock_test_and_set(int newval, volatile int *ptr) { |
10565 | 152 |
for (;;) { |
153 |
// Loop until a __kernel_cmpxchg succeeds. |
|
154 |
int prev = *ptr; |
|
155 |
||
156 |
if (__kernel_cmpxchg (prev, newval, ptr) == 0) |
|
157 |
return prev; |
|
158 |
} |
|
159 |
} |
|
160 |
#endif // ARM |
|
161 |
||
46993
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
162 |
template<size_t byte_size> |
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
163 |
struct Atomic::PlatformAdd |
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
164 |
: Atomic::AddAndFetch<Atomic::PlatformAdd<byte_size> > |
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
165 |
{ |
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
166 |
template<typename I, typename D> |
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
167 |
D add_and_fetch(I add_value, D volatile* dest) const; |
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
168 |
}; |
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
169 |
|
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
170 |
template<> |
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
171 |
template<typename I, typename D> |
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
172 |
inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { |
47091
4cc46bb5057b
8186855: Multiple platforms broken after 8186476: Generalize Atomic::add with templates
glaubitz
parents:
46993
diff
changeset
|
173 |
STATIC_ASSERT(4 == sizeof(I)); |
4cc46bb5057b
8186855: Multiple platforms broken after 8186476: Generalize Atomic::add with templates
glaubitz
parents:
46993
diff
changeset
|
174 |
STATIC_ASSERT(4 == sizeof(D)); |
46993
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
175 |
|
10565 | 176 |
#ifdef ARM |
46993
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
177 |
return add_using_helper<int>(arm_add_and_fetch, add_value, dest); |
10565 | 178 |
#else |
179 |
#ifdef M68K |
|
46993
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
180 |
return add_using_helper<int>(m68k_add_and_fetch, add_value, dest); |
10565 | 181 |
#else |
182 |
return __sync_add_and_fetch(dest, add_value); |
|
183 |
#endif // M68K |
|
184 |
#endif // ARM |
|
185 |
} |
|
186 |
||
46993
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
187 |
template<> |
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
188 |
template<typename I, typename D> |
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
189 |
inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { |
47091
4cc46bb5057b
8186855: Multiple platforms broken after 8186476: Generalize Atomic::add with templates
glaubitz
parents:
46993
diff
changeset
|
190 |
STATIC_ASSERT(8 == sizeof(I)); |
4cc46bb5057b
8186855: Multiple platforms broken after 8186476: Generalize Atomic::add with templates
glaubitz
parents:
46993
diff
changeset
|
191 |
STATIC_ASSERT(8 == sizeof(D)); |
46993
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46958
diff
changeset
|
192 |
|
10565 | 193 |
return __sync_add_and_fetch(dest, add_value); |
194 |
} |
|
195 |
||
47578
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
196 |
template<> |
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
197 |
template<typename T> |
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
198 |
inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, |
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
199 |
T volatile* dest) const { |
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
200 |
STATIC_ASSERT(4 == sizeof(T)); |
10565 | 201 |
#ifdef ARM |
47578
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
202 |
return xchg_using_helper<int>(arm_lock_test_and_set, exchange_value, dest); |
10565 | 203 |
#else |
204 |
#ifdef M68K |
|
47578
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
205 |
return xchg_using_helper<int>(m68k_lock_test_and_set, exchange_value, dest); |
10565 | 206 |
#else |
207 |
// __sync_lock_test_and_set is a bizarrely named atomic exchange |
|
208 |
// operation. Note that some platforms only support this with the |
|
209 |
// limitation that the only valid value to store is the immediate |
|
210 |
// constant 1. There is a test for this in JNI_CreateJavaVM(). |
|
47578
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
211 |
T result = __sync_lock_test_and_set (dest, exchange_value); |
28468
b8e9517bf6b9
8067331: Zero: Atomic::xchg and Atomic::xchg_ptr need full memory barrier
sgehwolf
parents:
25715
diff
changeset
|
212 |
// All atomic operations are expected to be full memory barriers |
b8e9517bf6b9
8067331: Zero: Atomic::xchg and Atomic::xchg_ptr need full memory barrier
sgehwolf
parents:
25715
diff
changeset
|
213 |
// (see atomic.hpp). However, __sync_lock_test_and_set is not |
b8e9517bf6b9
8067331: Zero: Atomic::xchg and Atomic::xchg_ptr need full memory barrier
sgehwolf
parents:
25715
diff
changeset
|
214 |
// a full memory barrier, but an acquire barrier. Hence, this added |
b8e9517bf6b9
8067331: Zero: Atomic::xchg and Atomic::xchg_ptr need full memory barrier
sgehwolf
parents:
25715
diff
changeset
|
215 |
// barrier. |
b8e9517bf6b9
8067331: Zero: Atomic::xchg and Atomic::xchg_ptr need full memory barrier
sgehwolf
parents:
25715
diff
changeset
|
216 |
__sync_synchronize(); |
b8e9517bf6b9
8067331: Zero: Atomic::xchg and Atomic::xchg_ptr need full memory barrier
sgehwolf
parents:
25715
diff
changeset
|
217 |
return result; |
10565 | 218 |
#endif // M68K |
219 |
#endif // ARM |
|
220 |
} |
|
221 |
||
47578
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
222 |
template<> |
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
223 |
template<typename T> |
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
224 |
inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, |
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
225 |
T volatile* dest) const { |
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
226 |
STATIC_ASSERT(8 == sizeof(T)); |
09c41c4913d9
8187977: Generalize Atomic::xchg to use templates
eosterlund
parents:
47552
diff
changeset
|
227 |
T result = __sync_lock_test_and_set (dest, exchange_value); |
28468
b8e9517bf6b9
8067331: Zero: Atomic::xchg and Atomic::xchg_ptr need full memory barrier
sgehwolf
parents:
25715
diff
changeset
|
228 |
__sync_synchronize(); |
b8e9517bf6b9
8067331: Zero: Atomic::xchg and Atomic::xchg_ptr need full memory barrier
sgehwolf
parents:
25715
diff
changeset
|
229 |
return result; |
10565 | 230 |
} |
231 |
||
46958
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
232 |
// No direct support for cmpxchg of bytes; emulate using int. |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
233 |
template<> |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
234 |
struct Atomic::PlatformCmpxchg<1> : Atomic::CmpxchgByteUsingInt {}; |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
235 |
|
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
236 |
template<> |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
237 |
template<typename T> |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
238 |
inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
239 |
T volatile* dest, |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
240 |
T compare_value, |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
241 |
cmpxchg_memory_order order) const { |
47091
4cc46bb5057b
8186855: Multiple platforms broken after 8186476: Generalize Atomic::add with templates
glaubitz
parents:
46993
diff
changeset
|
242 |
STATIC_ASSERT(4 == sizeof(T)); |
10565 | 243 |
#ifdef ARM |
46958
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
244 |
return cmpxchg_using_helper<int>(arm_compare_and_swap, exchange_value, dest, compare_value); |
10565 | 245 |
#else |
246 |
#ifdef M68K |
|
46958
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
247 |
return cmpxchg_using_helper<int>(m68k_compare_and_swap, exchange_value, dest, compare_value); |
10565 | 248 |
#else |
249 |
return __sync_val_compare_and_swap(dest, compare_value, exchange_value); |
|
250 |
#endif // M68K |
|
251 |
#endif // ARM |
|
252 |
} |
|
253 |
||
46958
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
254 |
template<> |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
255 |
template<typename T> |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
256 |
inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
257 |
T volatile* dest, |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
258 |
T compare_value, |
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46523
diff
changeset
|
259 |
cmpxchg_memory_order order) const { |
47091
4cc46bb5057b
8186855: Multiple platforms broken after 8186476: Generalize Atomic::add with templates
glaubitz
parents:
46993
diff
changeset
|
260 |
STATIC_ASSERT(8 == sizeof(T)); |
10565 | 261 |
return __sync_val_compare_and_swap(dest, compare_value, exchange_value); |
262 |
} |
|
263 |
||
47593
2d56326b98f0
8188224: Generalize Atomic::load/store to use templates
eosterlund
parents:
47578
diff
changeset
|
264 |
template<> |
2d56326b98f0
8188224: Generalize Atomic::load/store to use templates
eosterlund
parents:
47578
diff
changeset
|
265 |
template<typename T> |
2d56326b98f0
8188224: Generalize Atomic::load/store to use templates
eosterlund
parents:
47578
diff
changeset
|
266 |
inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const { |
2d56326b98f0
8188224: Generalize Atomic::load/store to use templates
eosterlund
parents:
47578
diff
changeset
|
267 |
STATIC_ASSERT(8 == sizeof(T)); |
48468 | 268 |
volatile int64_t dest; |
269 |
os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest)); |
|
47593
2d56326b98f0
8188224: Generalize Atomic::load/store to use templates
eosterlund
parents:
47578
diff
changeset
|
270 |
return PrimitiveConversions::cast<T>(dest); |
10565 | 271 |
} |
272 |
||
47593
2d56326b98f0
8188224: Generalize Atomic::load/store to use templates
eosterlund
parents:
47578
diff
changeset
|
273 |
template<> |
2d56326b98f0
8188224: Generalize Atomic::load/store to use templates
eosterlund
parents:
47578
diff
changeset
|
274 |
template<typename T> |
2d56326b98f0
8188224: Generalize Atomic::load/store to use templates
eosterlund
parents:
47578
diff
changeset
|
275 |
inline void Atomic::PlatformStore<8>::operator()(T store_value, |
2d56326b98f0
8188224: Generalize Atomic::load/store to use templates
eosterlund
parents:
47578
diff
changeset
|
276 |
T volatile* dest) const { |
2d56326b98f0
8188224: Generalize Atomic::load/store to use templates
eosterlund
parents:
47578
diff
changeset
|
277 |
STATIC_ASSERT(8 == sizeof(T)); |
48468 | 278 |
os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest)); |
10565 | 279 |
} |
280 |
||
40655
9f644073d3a0
8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents:
39404
diff
changeset
|
281 |
#endif // OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP |