author | vromero |
Sun, 09 Dec 2018 12:36:24 -0500 | |
changeset 52914 | 4fa75d8ad418 |
parent 52220 | 9c260a6b6471 |
child 53284 | a995647f4911 |
permissions | -rw-r--r-- |
36934 | 1 |
/* |
48710 | 2 |
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
36934 | 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. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
package java.lang.invoke; |
|
26 |
||
27 |
import jdk.internal.misc.Unsafe; |
|
38356
1e4ecca97792
8155794: Move Objects.checkIndex BiFunction accepting methods to an internal package
psandoz
parents:
36934
diff
changeset
|
28 |
import jdk.internal.util.Preconditions; |
36934 | 29 |
import jdk.internal.vm.annotation.ForceInline; |
30 |
||
31 |
import java.nio.ByteBuffer; |
|
32 |
import java.nio.ReadOnlyBufferException; |
|
33 |
import java.util.Objects; |
|
34 |
||
35 |
import static java.lang.invoke.MethodHandleStatics.UNSAFE; |
|
36 |
||
37 |
#warn |
|
38 |
||
39 |
final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { |
|
40 |
||
41 |
static final int ALIGN = $BoxType$.BYTES - 1; |
|
42 |
||
43 |
#if[floatingPoint] |
|
44 |
@ForceInline |
|
45 |
static $rawType$ convEndian(boolean big, $type$ v) { |
|
46 |
$rawType$ rv = $Type$.$type$ToRaw$RawType$Bits(v); |
|
47 |
return big == BE ? rv : $RawBoxType$.reverseBytes(rv); |
|
48 |
} |
|
49 |
||
50 |
@ForceInline |
|
51 |
static $type$ convEndian(boolean big, $rawType$ rv) { |
|
52 |
rv = big == BE ? rv : $RawBoxType$.reverseBytes(rv); |
|
53 |
return $Type$.$rawType$BitsTo$Type$(rv); |
|
54 |
} |
|
55 |
#else[floatingPoint] |
|
56 |
@ForceInline |
|
57 |
static $type$ convEndian(boolean big, $type$ n) { |
|
58 |
return big == BE ? n : $BoxType$.reverseBytes(n); |
|
59 |
} |
|
60 |
#end[floatingPoint] |
|
61 |
||
62 |
||
37792 | 63 |
private static abstract class ByteArrayViewVarHandle extends VarHandle { |
36934 | 64 |
final boolean be; |
65 |
||
37792 | 66 |
ByteArrayViewVarHandle(VarForm form, boolean be) { |
67 |
super(form); |
|
36934 | 68 |
this.be = be; |
69 |
} |
|
52914 | 70 |
|
71 |
@Override |
|
72 |
final boolean internalEquals(VarHandle vh) { |
|
73 |
ByteArrayViewVarHandle that = (ByteArrayViewVarHandle) vh; |
|
74 |
return be == that.be; |
|
75 |
} |
|
76 |
||
77 |
@Override |
|
78 |
final int internalHashCode() { |
|
79 |
return Boolean.hashCode(be); |
|
80 |
} |
|
36934 | 81 |
} |
82 |
||
83 |
static final class ArrayHandle extends ByteArrayViewVarHandle { |
|
84 |
||
85 |
ArrayHandle(boolean be) { |
|
37792 | 86 |
super(ArrayHandle.FORM, be); |
87 |
} |
|
88 |
||
89 |
@Override |
|
90 |
final MethodType accessModeTypeUncached(AccessMode accessMode) { |
|
91 |
return accessMode.at.accessModeType(byte[].class, $type$.class, int.class); |
|
36934 | 92 |
} |
93 |
||
94 |
@ForceInline |
|
95 |
static int index(byte[] ba, int index) { |
|
38356
1e4ecca97792
8155794: Move Objects.checkIndex BiFunction accepting methods to an internal package
psandoz
parents:
36934
diff
changeset
|
96 |
return Preconditions.checkIndex(index, ba.length - ALIGN, null); |
36934 | 97 |
} |
98 |
||
99 |
@ForceInline |
|
100 |
static long address(byte[] ba, int index) { |
|
101 |
long address = ((long) index) + Unsafe.ARRAY_BYTE_BASE_OFFSET; |
|
102 |
if ((address & ALIGN) != 0) |
|
103 |
throw newIllegalStateExceptionForMisalignedAccess(index); |
|
104 |
return address; |
|
105 |
} |
|
106 |
||
107 |
@ForceInline |
|
108 |
static $type$ get(ArrayHandle handle, Object oba, int index) { |
|
109 |
byte[] ba = (byte[]) oba; |
|
110 |
#if[floatingPoint] |
|
111 |
$rawType$ rawValue = UNSAFE.get$RawType$Unaligned( |
|
112 |
ba, |
|
113 |
((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET, |
|
114 |
handle.be); |
|
115 |
return $Type$.$rawType$BitsTo$Type$(rawValue); |
|
116 |
#else[floatingPoint] |
|
117 |
return UNSAFE.get$Type$Unaligned( |
|
118 |
ba, |
|
119 |
((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET, |
|
120 |
handle.be); |
|
121 |
#end[floatingPoint] |
|
122 |
} |
|
123 |
||
124 |
@ForceInline |
|
125 |
static void set(ArrayHandle handle, Object oba, int index, $type$ value) { |
|
126 |
byte[] ba = (byte[]) oba; |
|
127 |
#if[floatingPoint] |
|
128 |
UNSAFE.put$RawType$Unaligned( |
|
129 |
ba, |
|
130 |
((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET, |
|
131 |
$Type$.$type$ToRaw$RawType$Bits(value), |
|
132 |
handle.be); |
|
133 |
#else[floatingPoint] |
|
134 |
UNSAFE.put$RawType$Unaligned( |
|
135 |
ba, |
|
136 |
((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET, |
|
137 |
value, |
|
138 |
handle.be); |
|
139 |
#end[floatingPoint] |
|
140 |
} |
|
141 |
||
142 |
@ForceInline |
|
143 |
static $type$ getVolatile(ArrayHandle handle, Object oba, int index) { |
|
144 |
byte[] ba = (byte[]) oba; |
|
145 |
return convEndian(handle.be, |
|
146 |
UNSAFE.get$RawType$Volatile( |
|
147 |
ba, |
|
148 |
address(ba, index(ba, index)))); |
|
149 |
} |
|
150 |
||
151 |
@ForceInline |
|
152 |
static void setVolatile(ArrayHandle handle, Object oba, int index, $type$ value) { |
|
153 |
byte[] ba = (byte[]) oba; |
|
154 |
UNSAFE.put$RawType$Volatile( |
|
155 |
ba, |
|
156 |
address(ba, index(ba, index)), |
|
157 |
convEndian(handle.be, value)); |
|
158 |
} |
|
159 |
||
160 |
@ForceInline |
|
161 |
static $type$ getAcquire(ArrayHandle handle, Object oba, int index) { |
|
162 |
byte[] ba = (byte[]) oba; |
|
163 |
return convEndian(handle.be, |
|
164 |
UNSAFE.get$RawType$Acquire( |
|
165 |
ba, |
|
166 |
address(ba, index(ba, index)))); |
|
167 |
} |
|
168 |
||
169 |
@ForceInline |
|
170 |
static void setRelease(ArrayHandle handle, Object oba, int index, $type$ value) { |
|
171 |
byte[] ba = (byte[]) oba; |
|
172 |
UNSAFE.put$RawType$Release( |
|
173 |
ba, |
|
174 |
address(ba, index(ba, index)), |
|
175 |
convEndian(handle.be, value)); |
|
176 |
} |
|
177 |
||
178 |
@ForceInline |
|
179 |
static $type$ getOpaque(ArrayHandle handle, Object oba, int index) { |
|
180 |
byte[] ba = (byte[]) oba; |
|
181 |
return convEndian(handle.be, |
|
182 |
UNSAFE.get$RawType$Opaque( |
|
183 |
ba, |
|
184 |
address(ba, index(ba, index)))); |
|
185 |
} |
|
186 |
||
187 |
@ForceInline |
|
188 |
static void setOpaque(ArrayHandle handle, Object oba, int index, $type$ value) { |
|
189 |
byte[] ba = (byte[]) oba; |
|
190 |
UNSAFE.put$RawType$Opaque( |
|
191 |
ba, |
|
192 |
address(ba, index(ba, index)), |
|
193 |
convEndian(handle.be, value)); |
|
194 |
} |
|
195 |
#if[CAS] |
|
196 |
||
197 |
@ForceInline |
|
198 |
static boolean compareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { |
|
199 |
byte[] ba = (byte[]) oba; |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
200 |
#if[Object] |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
201 |
return UNSAFE.compareAndSetReference( |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
202 |
ba, |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
203 |
address(ba, index(ba, index)), |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
204 |
convEndian(handle.be, expected), convEndian(handle.be, value)); |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
205 |
#else[Object] |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
206 |
return UNSAFE.compareAndSet$RawType$( |
36934 | 207 |
ba, |
208 |
address(ba, index(ba, index)), |
|
209 |
convEndian(handle.be, expected), convEndian(handle.be, value)); |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
210 |
#end[Object] |
36934 | 211 |
} |
212 |
||
213 |
@ForceInline |
|
39472
6df82f4c63ac
8154737: Rename VarHandle.compareAndExchangeVolatile to VarHandle.compareAndExchange
psandoz
parents:
38382
diff
changeset
|
214 |
static $type$ compareAndExchange(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { |
36934 | 215 |
byte[] ba = (byte[]) oba; |
216 |
return convEndian(handle.be, |
|
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
217 |
UNSAFE.compareAndExchange$RawType$( |
36934 | 218 |
ba, |
219 |
address(ba, index(ba, index)), |
|
220 |
convEndian(handle.be, expected), convEndian(handle.be, value))); |
|
221 |
} |
|
222 |
||
223 |
@ForceInline |
|
224 |
static $type$ compareAndExchangeAcquire(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { |
|
225 |
byte[] ba = (byte[]) oba; |
|
226 |
return convEndian(handle.be, |
|
227 |
UNSAFE.compareAndExchange$RawType$Acquire( |
|
228 |
ba, |
|
229 |
address(ba, index(ba, index)), |
|
230 |
convEndian(handle.be, expected), convEndian(handle.be, value))); |
|
231 |
} |
|
232 |
||
233 |
@ForceInline |
|
234 |
static $type$ compareAndExchangeRelease(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { |
|
235 |
byte[] ba = (byte[]) oba; |
|
236 |
return convEndian(handle.be, |
|
237 |
UNSAFE.compareAndExchange$RawType$Release( |
|
238 |
ba, |
|
239 |
address(ba, index(ba, index)), |
|
240 |
convEndian(handle.be, expected), convEndian(handle.be, value))); |
|
241 |
} |
|
242 |
||
243 |
@ForceInline |
|
40734
48879ea67e2a
8162108: Rename weakCompareAndSetVolatile to weakCompareAndSet
psandoz
parents:
40733
diff
changeset
|
244 |
static boolean weakCompareAndSetPlain(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { |
36934 | 245 |
byte[] ba = (byte[]) oba; |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
246 |
return UNSAFE.weakCompareAndSet$RawType$Plain( |
36934 | 247 |
ba, |
248 |
address(ba, index(ba, index)), |
|
249 |
convEndian(handle.be, expected), convEndian(handle.be, value)); |
|
250 |
} |
|
251 |
||
252 |
@ForceInline |
|
40734
48879ea67e2a
8162108: Rename weakCompareAndSetVolatile to weakCompareAndSet
psandoz
parents:
40733
diff
changeset
|
253 |
static boolean weakCompareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { |
37719
add11bc0e6e2
8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents:
36934
diff
changeset
|
254 |
byte[] ba = (byte[]) oba; |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
255 |
return UNSAFE.weakCompareAndSet$RawType$( |
37719
add11bc0e6e2
8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents:
36934
diff
changeset
|
256 |
ba, |
add11bc0e6e2
8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents:
36934
diff
changeset
|
257 |
address(ba, index(ba, index)), |
add11bc0e6e2
8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents:
36934
diff
changeset
|
258 |
convEndian(handle.be, expected), convEndian(handle.be, value)); |
add11bc0e6e2
8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents:
36934
diff
changeset
|
259 |
} |
add11bc0e6e2
8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents:
36934
diff
changeset
|
260 |
|
add11bc0e6e2
8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents:
36934
diff
changeset
|
261 |
@ForceInline |
36934 | 262 |
static boolean weakCompareAndSetAcquire(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { |
263 |
byte[] ba = (byte[]) oba; |
|
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
264 |
return UNSAFE.weakCompareAndSet$RawType$Acquire( |
36934 | 265 |
ba, |
266 |
address(ba, index(ba, index)), |
|
267 |
convEndian(handle.be, expected), convEndian(handle.be, value)); |
|
268 |
} |
|
269 |
||
270 |
@ForceInline |
|
271 |
static boolean weakCompareAndSetRelease(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { |
|
272 |
byte[] ba = (byte[]) oba; |
|
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
273 |
return UNSAFE.weakCompareAndSet$RawType$Release( |
36934 | 274 |
ba, |
275 |
address(ba, index(ba, index)), |
|
276 |
convEndian(handle.be, expected), convEndian(handle.be, value)); |
|
277 |
} |
|
278 |
||
279 |
@ForceInline |
|
280 |
static $type$ getAndSet(ArrayHandle handle, Object oba, int index, $type$ value) { |
|
281 |
byte[] ba = (byte[]) oba; |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
282 |
#if[Object] |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
283 |
return convEndian(handle.be, |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
284 |
UNSAFE.getAndSetReference( |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
285 |
ba, |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
286 |
address(ba, index(ba, index)), |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
287 |
convEndian(handle.be, value))); |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
288 |
#else[Object] |
36934 | 289 |
return convEndian(handle.be, |
290 |
UNSAFE.getAndSet$RawType$( |
|
291 |
ba, |
|
292 |
address(ba, index(ba, index)), |
|
293 |
convEndian(handle.be, value))); |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
294 |
#end[Object] |
36934 | 295 |
} |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
296 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
297 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
298 |
static $type$ getAndSetAcquire(ArrayHandle handle, Object oba, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
299 |
byte[] ba = (byte[]) oba; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
300 |
return convEndian(handle.be, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
301 |
UNSAFE.getAndSet$RawType$Acquire( |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
302 |
ba, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
303 |
address(ba, index(ba, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
304 |
convEndian(handle.be, value))); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
305 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
306 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
307 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
308 |
static $type$ getAndSetRelease(ArrayHandle handle, Object oba, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
309 |
byte[] ba = (byte[]) oba; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
310 |
return convEndian(handle.be, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
311 |
UNSAFE.getAndSet$RawType$Release( |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
312 |
ba, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
313 |
address(ba, index(ba, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
314 |
convEndian(handle.be, value))); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
315 |
} |
36934 | 316 |
#end[CAS] |
317 |
#if[AtomicAdd] |
|
318 |
||
319 |
@ForceInline |
|
38382
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
320 |
static $type$ getAndAdd(ArrayHandle handle, Object oba, int index, $type$ delta) { |
36934 | 321 |
byte[] ba = (byte[]) oba; |
38382
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
322 |
if (handle.be == BE) { |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
323 |
return UNSAFE.getAndAdd$RawType$( |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
324 |
ba, |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
325 |
address(ba, index(ba, index)), |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
326 |
delta); |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
327 |
} else { |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
328 |
return getAndAddConvEndianWithCAS(ba, index, delta); |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
329 |
} |
36934 | 330 |
} |
331 |
||
332 |
@ForceInline |
|
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
333 |
static $type$ getAndAddAcquire(ArrayHandle handle, Object oba, int index, $type$ delta) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
334 |
byte[] ba = (byte[]) oba; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
335 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
336 |
return UNSAFE.getAndAdd$RawType$Acquire( |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
337 |
ba, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
338 |
address(ba, index(ba, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
339 |
delta); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
340 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
341 |
return getAndAddConvEndianWithCAS(ba, index, delta); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
342 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
343 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
344 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
345 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
346 |
static $type$ getAndAddRelease(ArrayHandle handle, Object oba, int index, $type$ delta) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
347 |
byte[] ba = (byte[]) oba; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
348 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
349 |
return UNSAFE.getAndAdd$RawType$Release( |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
350 |
ba, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
351 |
address(ba, index(ba, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
352 |
delta); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
353 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
354 |
return getAndAddConvEndianWithCAS(ba, index, delta); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
355 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
356 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
357 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
358 |
@ForceInline |
38382
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
359 |
static $type$ getAndAddConvEndianWithCAS(byte[] ba, int index, $type$ delta) { |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
360 |
$type$ nativeExpectedValue, expectedValue; |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
361 |
long offset = address(ba, index(ba, index)); |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
362 |
do { |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
363 |
nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
364 |
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
365 |
} while (!UNSAFE.weakCompareAndSet$RawType$(ba, offset, |
38382
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
366 |
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue + delta))); |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
367 |
return expectedValue; |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
368 |
} |
36934 | 369 |
#end[AtomicAdd] |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
370 |
#if[Bitwise] |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
371 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
372 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
373 |
static $type$ getAndBitwiseOr(ArrayHandle handle, Object oba, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
374 |
byte[] ba = (byte[]) oba; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
375 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
376 |
return UNSAFE.getAndBitwiseOr$RawType$( |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
377 |
ba, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
378 |
address(ba, index(ba, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
379 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
380 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
381 |
return getAndBitwiseOrConvEndianWithCAS(ba, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
382 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
383 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
384 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
385 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
386 |
static $type$ getAndBitwiseOrRelease(ArrayHandle handle, Object oba, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
387 |
byte[] ba = (byte[]) oba; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
388 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
389 |
return UNSAFE.getAndBitwiseOr$RawType$Release( |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
390 |
ba, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
391 |
address(ba, index(ba, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
392 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
393 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
394 |
return getAndBitwiseOrConvEndianWithCAS(ba, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
395 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
396 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
397 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
398 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
399 |
static $type$ getAndBitwiseOrAcquire(ArrayHandle handle, Object oba, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
400 |
byte[] ba = (byte[]) oba; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
401 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
402 |
return UNSAFE.getAndBitwiseOr$RawType$Acquire( |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
403 |
ba, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
404 |
address(ba, index(ba, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
405 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
406 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
407 |
return getAndBitwiseOrConvEndianWithCAS(ba, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
408 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
409 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
410 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
411 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
412 |
static $type$ getAndBitwiseOrConvEndianWithCAS(byte[] ba, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
413 |
$type$ nativeExpectedValue, expectedValue; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
414 |
long offset = address(ba, index(ba, index)); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
415 |
do { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
416 |
nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
417 |
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
418 |
} while (!UNSAFE.weakCompareAndSet$RawType$(ba, offset, |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
419 |
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue | value))); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
420 |
return expectedValue; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
421 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
422 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
423 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
424 |
static $type$ getAndBitwiseAnd(ArrayHandle handle, Object oba, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
425 |
byte[] ba = (byte[]) oba; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
426 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
427 |
return UNSAFE.getAndBitwiseAnd$RawType$( |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
428 |
ba, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
429 |
address(ba, index(ba, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
430 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
431 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
432 |
return getAndBitwiseAndConvEndianWithCAS(ba, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
433 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
434 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
435 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
436 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
437 |
static $type$ getAndBitwiseAndRelease(ArrayHandle handle, Object oba, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
438 |
byte[] ba = (byte[]) oba; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
439 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
440 |
return UNSAFE.getAndBitwiseAnd$RawType$Release( |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
441 |
ba, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
442 |
address(ba, index(ba, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
443 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
444 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
445 |
return getAndBitwiseAndConvEndianWithCAS(ba, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
446 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
447 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
448 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
449 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
450 |
static $type$ getAndBitwiseAndAcquire(ArrayHandle handle, Object oba, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
451 |
byte[] ba = (byte[]) oba; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
452 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
453 |
return UNSAFE.getAndBitwiseAnd$RawType$Acquire( |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
454 |
ba, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
455 |
address(ba, index(ba, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
456 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
457 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
458 |
return getAndBitwiseAndConvEndianWithCAS(ba, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
459 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
460 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
461 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
462 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
463 |
static $type$ getAndBitwiseAndConvEndianWithCAS(byte[] ba, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
464 |
$type$ nativeExpectedValue, expectedValue; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
465 |
long offset = address(ba, index(ba, index)); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
466 |
do { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
467 |
nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
468 |
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
469 |
} while (!UNSAFE.weakCompareAndSet$RawType$(ba, offset, |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
470 |
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue & value))); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
471 |
return expectedValue; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
472 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
473 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
474 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
475 |
static $type$ getAndBitwiseXor(ArrayHandle handle, Object oba, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
476 |
byte[] ba = (byte[]) oba; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
477 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
478 |
return UNSAFE.getAndBitwiseXor$RawType$( |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
479 |
ba, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
480 |
address(ba, index(ba, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
481 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
482 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
483 |
return getAndBitwiseXorConvEndianWithCAS(ba, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
484 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
485 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
486 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
487 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
488 |
static $type$ getAndBitwiseXorRelease(ArrayHandle handle, Object oba, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
489 |
byte[] ba = (byte[]) oba; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
490 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
491 |
return UNSAFE.getAndBitwiseXor$RawType$Release( |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
492 |
ba, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
493 |
address(ba, index(ba, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
494 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
495 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
496 |
return getAndBitwiseXorConvEndianWithCAS(ba, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
497 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
498 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
499 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
500 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
501 |
static $type$ getAndBitwiseXorAcquire(ArrayHandle handle, Object oba, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
502 |
byte[] ba = (byte[]) oba; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
503 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
504 |
return UNSAFE.getAndBitwiseXor$RawType$Acquire( |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
505 |
ba, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
506 |
address(ba, index(ba, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
507 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
508 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
509 |
return getAndBitwiseXorConvEndianWithCAS(ba, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
510 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
511 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
512 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
513 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
514 |
static $type$ getAndBitwiseXorConvEndianWithCAS(byte[] ba, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
515 |
$type$ nativeExpectedValue, expectedValue; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
516 |
long offset = address(ba, index(ba, index)); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
517 |
do { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
518 |
nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
519 |
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
520 |
} while (!UNSAFE.weakCompareAndSet$RawType$(ba, offset, |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
521 |
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue ^ value))); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
522 |
return expectedValue; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
523 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
524 |
#end[Bitwise] |
37792 | 525 |
|
526 |
static final VarForm FORM = new VarForm(ArrayHandle.class, byte[].class, $type$.class, int.class); |
|
36934 | 527 |
} |
528 |
||
529 |
||
530 |
static final class ByteBufferHandle extends ByteArrayViewVarHandle { |
|
531 |
||
532 |
ByteBufferHandle(boolean be) { |
|
37792 | 533 |
super(ByteBufferHandle.FORM, be); |
534 |
} |
|
535 |
||
536 |
@Override |
|
537 |
final MethodType accessModeTypeUncached(AccessMode accessMode) { |
|
538 |
return accessMode.at.accessModeType(ByteBuffer.class, $type$.class, int.class); |
|
36934 | 539 |
} |
540 |
||
541 |
@ForceInline |
|
542 |
static int index(ByteBuffer bb, int index) { |
|
38356
1e4ecca97792
8155794: Move Objects.checkIndex BiFunction accepting methods to an internal package
psandoz
parents:
36934
diff
changeset
|
543 |
return Preconditions.checkIndex(index, UNSAFE.getInt(bb, BUFFER_LIMIT) - ALIGN, null); |
36934 | 544 |
} |
545 |
||
546 |
@ForceInline |
|
547 |
static int indexRO(ByteBuffer bb, int index) { |
|
548 |
if (UNSAFE.getBoolean(bb, BYTE_BUFFER_IS_READ_ONLY)) |
|
549 |
throw new ReadOnlyBufferException(); |
|
38356
1e4ecca97792
8155794: Move Objects.checkIndex BiFunction accepting methods to an internal package
psandoz
parents:
36934
diff
changeset
|
550 |
return Preconditions.checkIndex(index, UNSAFE.getInt(bb, BUFFER_LIMIT) - ALIGN, null); |
36934 | 551 |
} |
552 |
||
553 |
@ForceInline |
|
554 |
static long address(ByteBuffer bb, int index) { |
|
555 |
long address = ((long) index) + UNSAFE.getLong(bb, BUFFER_ADDRESS); |
|
556 |
if ((address & ALIGN) != 0) |
|
557 |
throw newIllegalStateExceptionForMisalignedAccess(index); |
|
558 |
return address; |
|
559 |
} |
|
560 |
||
561 |
@ForceInline |
|
562 |
static $type$ get(ByteBufferHandle handle, Object obb, int index) { |
|
48710 | 563 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
36934 | 564 |
#if[floatingPoint] |
565 |
$rawType$ rawValue = UNSAFE.get$RawType$Unaligned( |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
566 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 567 |
((long) index(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS), |
568 |
handle.be); |
|
569 |
return $Type$.$rawType$BitsTo$Type$(rawValue); |
|
570 |
#else[floatingPoint] |
|
571 |
return UNSAFE.get$Type$Unaligned( |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
572 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 573 |
((long) index(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS), |
574 |
handle.be); |
|
575 |
#end[floatingPoint] |
|
576 |
} |
|
577 |
||
578 |
@ForceInline |
|
579 |
static void set(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
|
48710 | 580 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
36934 | 581 |
#if[floatingPoint] |
582 |
UNSAFE.put$RawType$Unaligned( |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
583 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 584 |
((long) indexRO(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS), |
585 |
$Type$.$type$ToRaw$RawType$Bits(value), |
|
586 |
handle.be); |
|
587 |
#else[floatingPoint] |
|
588 |
UNSAFE.put$Type$Unaligned( |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
589 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 590 |
((long) indexRO(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS), |
591 |
value, |
|
592 |
handle.be); |
|
593 |
#end[floatingPoint] |
|
594 |
} |
|
595 |
||
596 |
@ForceInline |
|
597 |
static $type$ getVolatile(ByteBufferHandle handle, Object obb, int index) { |
|
48710 | 598 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
36934 | 599 |
return convEndian(handle.be, |
600 |
UNSAFE.get$RawType$Volatile( |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
601 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 602 |
address(bb, index(bb, index)))); |
603 |
} |
|
604 |
||
605 |
@ForceInline |
|
606 |
static void setVolatile(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
|
48710 | 607 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
36934 | 608 |
UNSAFE.put$RawType$Volatile( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
609 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 610 |
address(bb, indexRO(bb, index)), |
611 |
convEndian(handle.be, value)); |
|
612 |
} |
|
613 |
||
614 |
@ForceInline |
|
615 |
static $type$ getAcquire(ByteBufferHandle handle, Object obb, int index) { |
|
48710 | 616 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
36934 | 617 |
return convEndian(handle.be, |
618 |
UNSAFE.get$RawType$Acquire( |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
619 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 620 |
address(bb, index(bb, index)))); |
621 |
} |
|
622 |
||
623 |
@ForceInline |
|
624 |
static void setRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
|
48710 | 625 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
36934 | 626 |
UNSAFE.put$RawType$Release( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
627 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 628 |
address(bb, indexRO(bb, index)), |
629 |
convEndian(handle.be, value)); |
|
630 |
} |
|
631 |
||
632 |
@ForceInline |
|
633 |
static $type$ getOpaque(ByteBufferHandle handle, Object obb, int index) { |
|
48710 | 634 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
36934 | 635 |
return convEndian(handle.be, |
636 |
UNSAFE.get$RawType$Opaque( |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
637 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 638 |
address(bb, index(bb, index)))); |
639 |
} |
|
640 |
||
641 |
@ForceInline |
|
642 |
static void setOpaque(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
|
48710 | 643 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
36934 | 644 |
UNSAFE.put$RawType$Opaque( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
645 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 646 |
address(bb, indexRO(bb, index)), |
647 |
convEndian(handle.be, value)); |
|
648 |
} |
|
649 |
#if[CAS] |
|
650 |
||
651 |
@ForceInline |
|
652 |
static boolean compareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { |
|
48710 | 653 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
654 |
#if[Object] |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
655 |
return UNSAFE.compareAndSetReference( |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
656 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 657 |
address(bb, indexRO(bb, index)), |
658 |
convEndian(handle.be, expected), convEndian(handle.be, value)); |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
659 |
#else[Object] |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
660 |
return UNSAFE.compareAndSet$RawType$( |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
661 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
662 |
address(bb, indexRO(bb, index)), |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
663 |
convEndian(handle.be, expected), convEndian(handle.be, value)); |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
664 |
#end[Object] |
36934 | 665 |
} |
666 |
||
667 |
@ForceInline |
|
39472
6df82f4c63ac
8154737: Rename VarHandle.compareAndExchangeVolatile to VarHandle.compareAndExchange
psandoz
parents:
38382
diff
changeset
|
668 |
static $type$ compareAndExchange(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { |
48710 | 669 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
36934 | 670 |
return convEndian(handle.be, |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
671 |
UNSAFE.compareAndExchange$RawType$( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
672 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 673 |
address(bb, indexRO(bb, index)), |
674 |
convEndian(handle.be, expected), convEndian(handle.be, value))); |
|
675 |
} |
|
676 |
||
677 |
@ForceInline |
|
678 |
static $type$ compareAndExchangeAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { |
|
48710 | 679 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
36934 | 680 |
return convEndian(handle.be, |
681 |
UNSAFE.compareAndExchange$RawType$Acquire( |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
682 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 683 |
address(bb, indexRO(bb, index)), |
684 |
convEndian(handle.be, expected), convEndian(handle.be, value))); |
|
685 |
} |
|
686 |
||
687 |
@ForceInline |
|
688 |
static $type$ compareAndExchangeRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { |
|
48710 | 689 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
36934 | 690 |
return convEndian(handle.be, |
691 |
UNSAFE.compareAndExchange$RawType$Release( |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
692 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 693 |
address(bb, indexRO(bb, index)), |
694 |
convEndian(handle.be, expected), convEndian(handle.be, value))); |
|
695 |
} |
|
696 |
||
697 |
@ForceInline |
|
40734
48879ea67e2a
8162108: Rename weakCompareAndSetVolatile to weakCompareAndSet
psandoz
parents:
40733
diff
changeset
|
698 |
static boolean weakCompareAndSetPlain(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { |
48710 | 699 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
700 |
return UNSAFE.weakCompareAndSet$RawType$Plain( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
701 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 702 |
address(bb, indexRO(bb, index)), |
703 |
convEndian(handle.be, expected), convEndian(handle.be, value)); |
|
704 |
} |
|
705 |
||
706 |
@ForceInline |
|
40734
48879ea67e2a
8162108: Rename weakCompareAndSetVolatile to weakCompareAndSet
psandoz
parents:
40733
diff
changeset
|
707 |
static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { |
48710 | 708 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
709 |
return UNSAFE.weakCompareAndSet$RawType$( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
710 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
37719
add11bc0e6e2
8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents:
36934
diff
changeset
|
711 |
address(bb, indexRO(bb, index)), |
add11bc0e6e2
8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents:
36934
diff
changeset
|
712 |
convEndian(handle.be, expected), convEndian(handle.be, value)); |
add11bc0e6e2
8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents:
36934
diff
changeset
|
713 |
} |
add11bc0e6e2
8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents:
36934
diff
changeset
|
714 |
|
add11bc0e6e2
8154755: Add a VarHandle weakCompareAndSet with volatile semantics
psandoz
parents:
36934
diff
changeset
|
715 |
@ForceInline |
36934 | 716 |
static boolean weakCompareAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { |
48710 | 717 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
718 |
return UNSAFE.weakCompareAndSet$RawType$Acquire( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
719 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 720 |
address(bb, indexRO(bb, index)), |
721 |
convEndian(handle.be, expected), convEndian(handle.be, value)); |
|
722 |
} |
|
723 |
||
724 |
@ForceInline |
|
725 |
static boolean weakCompareAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { |
|
48710 | 726 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
727 |
return UNSAFE.weakCompareAndSet$RawType$Release( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
728 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 729 |
address(bb, indexRO(bb, index)), |
730 |
convEndian(handle.be, expected), convEndian(handle.be, value)); |
|
731 |
} |
|
732 |
||
733 |
@ForceInline |
|
734 |
static $type$ getAndSet(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
|
48710 | 735 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
736 |
#if[Object] |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
737 |
return convEndian(handle.be, |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
738 |
UNSAFE.getAndSetReference( |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
739 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
740 |
address(bb, indexRO(bb, index)), |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
741 |
convEndian(handle.be, value))); |
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
742 |
#else[Object] |
36934 | 743 |
return convEndian(handle.be, |
744 |
UNSAFE.getAndSet$RawType$( |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
745 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
36934 | 746 |
address(bb, indexRO(bb, index)), |
747 |
convEndian(handle.be, value))); |
|
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
748 |
#end[Object] |
36934 | 749 |
} |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
750 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
751 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
752 |
static $type$ getAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
48710 | 753 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
754 |
return convEndian(handle.be, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
755 |
UNSAFE.getAndSet$RawType$Acquire( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
756 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
757 |
address(bb, indexRO(bb, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
758 |
convEndian(handle.be, value))); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
759 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
760 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
761 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
762 |
static $type$ getAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
48710 | 763 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
764 |
return convEndian(handle.be, |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
765 |
UNSAFE.getAndSet$RawType$Release( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
766 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
767 |
address(bb, indexRO(bb, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
768 |
convEndian(handle.be, value))); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
769 |
} |
36934 | 770 |
#end[CAS] |
771 |
#if[AtomicAdd] |
|
772 |
||
773 |
@ForceInline |
|
38382
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
774 |
static $type$ getAndAdd(ByteBufferHandle handle, Object obb, int index, $type$ delta) { |
48710 | 775 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
38382
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
776 |
if (handle.be == BE) { |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
777 |
return UNSAFE.getAndAdd$RawType$( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
778 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
38382
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
779 |
address(bb, indexRO(bb, index)), |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
780 |
delta); |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
781 |
} else { |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
782 |
return getAndAddConvEndianWithCAS(bb, index, delta); |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
783 |
} |
36934 | 784 |
} |
785 |
||
786 |
@ForceInline |
|
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
787 |
static $type$ getAndAddAcquire(ByteBufferHandle handle, Object obb, int index, $type$ delta) { |
48710 | 788 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
789 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
790 |
return UNSAFE.getAndAdd$RawType$Acquire( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
791 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
792 |
address(bb, indexRO(bb, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
793 |
delta); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
794 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
795 |
return getAndAddConvEndianWithCAS(bb, index, delta); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
796 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
797 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
798 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
799 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
800 |
static $type$ getAndAddRelease(ByteBufferHandle handle, Object obb, int index, $type$ delta) { |
48710 | 801 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
802 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
803 |
return UNSAFE.getAndAdd$RawType$Release( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
804 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
805 |
address(bb, indexRO(bb, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
806 |
delta); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
807 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
808 |
return getAndAddConvEndianWithCAS(bb, index, delta); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
809 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
810 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
811 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
812 |
@ForceInline |
38382
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
813 |
static $type$ getAndAddConvEndianWithCAS(ByteBuffer bb, int index, $type$ delta) { |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
814 |
$type$ nativeExpectedValue, expectedValue; |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
815 |
Object base = UNSAFE.getReference(bb, BYTE_BUFFER_HB); |
38382
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
816 |
long offset = address(bb, indexRO(bb, index)); |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
817 |
do { |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
818 |
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
819 |
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
820 |
} while (!UNSAFE.weakCompareAndSet$RawType$(base, offset, |
38382
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
821 |
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue + delta))); |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
822 |
return expectedValue; |
98d5a441bc2f
8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
psandoz
parents:
38372
diff
changeset
|
823 |
} |
36934 | 824 |
#end[AtomicAdd] |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
825 |
#if[Bitwise] |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
826 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
827 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
828 |
static $type$ getAndBitwiseOr(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
48710 | 829 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
830 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
831 |
return UNSAFE.getAndBitwiseOr$RawType$( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
832 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
833 |
address(bb, indexRO(bb, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
834 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
835 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
836 |
return getAndBitwiseOrConvEndianWithCAS(bb, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
837 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
838 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
839 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
840 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
841 |
static $type$ getAndBitwiseOrRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
48710 | 842 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
843 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
844 |
return UNSAFE.getAndBitwiseOr$RawType$Release( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
845 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
846 |
address(bb, indexRO(bb, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
847 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
848 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
849 |
return getAndBitwiseOrConvEndianWithCAS(bb, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
850 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
851 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
852 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
853 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
854 |
static $type$ getAndBitwiseOrAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
48710 | 855 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
856 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
857 |
return UNSAFE.getAndBitwiseOr$RawType$Acquire( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
858 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
859 |
address(bb, indexRO(bb, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
860 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
861 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
862 |
return getAndBitwiseOrConvEndianWithCAS(bb, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
863 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
864 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
865 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
866 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
867 |
static $type$ getAndBitwiseOrConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
868 |
$type$ nativeExpectedValue, expectedValue; |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
869 |
Object base = UNSAFE.getReference(bb, BYTE_BUFFER_HB); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
870 |
long offset = address(bb, indexRO(bb, index)); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
871 |
do { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
872 |
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
873 |
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
874 |
} while (!UNSAFE.weakCompareAndSet$RawType$(base, offset, |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
875 |
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue | value))); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
876 |
return expectedValue; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
877 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
878 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
879 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
880 |
static $type$ getAndBitwiseAnd(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
48710 | 881 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
882 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
883 |
return UNSAFE.getAndBitwiseAnd$RawType$( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
884 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
885 |
address(bb, indexRO(bb, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
886 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
887 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
888 |
return getAndBitwiseAndConvEndianWithCAS(bb, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
889 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
890 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
891 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
892 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
893 |
static $type$ getAndBitwiseAndRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
48710 | 894 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
895 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
896 |
return UNSAFE.getAndBitwiseAnd$RawType$Release( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
897 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
898 |
address(bb, indexRO(bb, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
899 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
900 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
901 |
return getAndBitwiseAndConvEndianWithCAS(bb, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
902 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
903 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
904 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
905 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
906 |
static $type$ getAndBitwiseAndAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
48710 | 907 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
908 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
909 |
return UNSAFE.getAndBitwiseAnd$RawType$Acquire( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
910 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
911 |
address(bb, indexRO(bb, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
912 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
913 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
914 |
return getAndBitwiseAndConvEndianWithCAS(bb, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
915 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
916 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
917 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
918 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
919 |
static $type$ getAndBitwiseAndConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
920 |
$type$ nativeExpectedValue, expectedValue; |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
921 |
Object base = UNSAFE.getReference(bb, BYTE_BUFFER_HB); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
922 |
long offset = address(bb, indexRO(bb, index)); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
923 |
do { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
924 |
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
925 |
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
926 |
} while (!UNSAFE.weakCompareAndSet$RawType$(base, offset, |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
927 |
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue & value))); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
928 |
return expectedValue; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
929 |
} |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
930 |
|
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
931 |
|
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
932 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
933 |
static $type$ getAndBitwiseXor(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
48710 | 934 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
935 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
936 |
return UNSAFE.getAndBitwiseXor$RawType$( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
937 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
938 |
address(bb, indexRO(bb, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
939 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
940 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
941 |
return getAndBitwiseXorConvEndianWithCAS(bb, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
942 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
943 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
944 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
945 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
946 |
static $type$ getAndBitwiseXorRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
48710 | 947 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
948 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
949 |
return UNSAFE.getAndBitwiseXor$RawType$Release( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
950 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
951 |
address(bb, indexRO(bb, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
952 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
953 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
954 |
return getAndBitwiseXorConvEndianWithCAS(bb, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
955 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
956 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
957 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
958 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
959 |
static $type$ getAndBitwiseXorAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) { |
48710 | 960 |
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
961 |
if (handle.be == BE) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
962 |
return UNSAFE.getAndBitwiseXor$RawType$Acquire( |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
963 |
UNSAFE.getReference(bb, BYTE_BUFFER_HB), |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
964 |
address(bb, indexRO(bb, index)), |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
965 |
value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
966 |
} else { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
967 |
return getAndBitwiseXorConvEndianWithCAS(bb, index, value); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
968 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
969 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
970 |
|
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
971 |
@ForceInline |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
972 |
static $type$ getAndBitwiseXorConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
973 |
$type$ nativeExpectedValue, expectedValue; |
52220
9c260a6b6471
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents:
48710
diff
changeset
|
974 |
Object base = UNSAFE.getReference(bb, BYTE_BUFFER_HB); |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
975 |
long offset = address(bb, indexRO(bb, index)); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
976 |
do { |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
977 |
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
978 |
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); |
45518
4a116dd82fb5
8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents:
40734
diff
changeset
|
979 |
} while (!UNSAFE.weakCompareAndSet$RawType$(base, offset, |
40732
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
980 |
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue ^ value))); |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
981 |
return expectedValue; |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
982 |
} |
2fd9cf42bb3c
8161444: VarHandles should provide access bitwise atomics
psandoz
parents:
39472
diff
changeset
|
983 |
#end[Bitwise] |
37792 | 984 |
|
985 |
static final VarForm FORM = new VarForm(ByteBufferHandle.class, ByteBuffer.class, $type$.class, int.class); |
|
36934 | 986 |
} |
987 |
} |