author | vlivanov |
Fri, 06 May 2016 18:21:41 +0300 | |
changeset 38357 | f18eb84a3b96 |
parent 37668 | 34a002e5168a |
parent 38355 | 674cfd9b90cf |
child 38358 | cb99c6d2af1b |
permissions | -rw-r--r-- |
36934 | 1 |
/* |
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/* |
|
25 |
* @test |
|
26 |
* @run testng/othervm -Diters=10 -Xint VarHandleTestAccessLong |
|
27 |
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessLong |
|
28 |
* @run testng/othervm -Diters=20000 VarHandleTestAccessLong |
|
29 |
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestAccessLong |
|
30 |
*/ |
|
31 |
||
32 |
import org.testng.annotations.BeforeClass; |
|
33 |
import org.testng.annotations.DataProvider; |
|
34 |
import org.testng.annotations.Test; |
|
35 |
||
36 |
import java.lang.invoke.MethodHandles; |
|
37 |
import java.lang.invoke.VarHandle; |
|
38 |
import java.util.ArrayList; |
|
39 |
import java.util.Arrays; |
|
40 |
import java.util.List; |
|
41 |
||
42 |
import static org.testng.Assert.*; |
|
43 |
||
44 |
public class VarHandleTestAccessLong extends VarHandleBaseTest { |
|
45 |
static final long static_final_v = 1L; |
|
46 |
||
47 |
static long static_v; |
|
48 |
||
49 |
final long final_v = 1L; |
|
50 |
||
51 |
long v; |
|
52 |
||
53 |
VarHandle vhFinalField; |
|
54 |
||
55 |
VarHandle vhField; |
|
56 |
||
57 |
VarHandle vhStaticField; |
|
58 |
||
59 |
VarHandle vhStaticFinalField; |
|
60 |
||
61 |
VarHandle vhArray; |
|
62 |
||
63 |
@BeforeClass |
|
64 |
public void setup() throws Exception { |
|
65 |
vhFinalField = MethodHandles.lookup().findVarHandle( |
|
66 |
VarHandleTestAccessLong.class, "final_v", long.class); |
|
67 |
||
68 |
vhField = MethodHandles.lookup().findVarHandle( |
|
69 |
VarHandleTestAccessLong.class, "v", long.class); |
|
70 |
||
71 |
vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle( |
|
72 |
VarHandleTestAccessLong.class, "static_final_v", long.class); |
|
73 |
||
74 |
vhStaticField = MethodHandles.lookup().findStaticVarHandle( |
|
75 |
VarHandleTestAccessLong.class, "static_v", long.class); |
|
76 |
||
77 |
vhArray = MethodHandles.arrayElementVarHandle(long[].class); |
|
78 |
} |
|
79 |
||
80 |
||
81 |
@DataProvider |
|
82 |
public Object[][] varHandlesProvider() throws Exception { |
|
83 |
List<VarHandle> vhs = new ArrayList<>(); |
|
84 |
vhs.add(vhField); |
|
85 |
vhs.add(vhStaticField); |
|
86 |
vhs.add(vhArray); |
|
87 |
||
88 |
return vhs.stream().map(tc -> new Object[]{tc}).toArray(Object[][]::new); |
|
89 |
} |
|
90 |
||
91 |
@Test(dataProvider = "varHandlesProvider") |
|
92 |
public void testIsAccessModeSupported(VarHandle vh) { |
|
37343
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
93 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
94 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
95 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
96 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
97 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
98 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
99 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
100 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE)); |
36934 | 101 |
|
37343
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
102 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
103 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_VOLATILE)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
104 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
105 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
106 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
107 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
108 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
109 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); |
36934 | 110 |
|
37343
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
111 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); |
35a2231828a7
8151705: VarHandle.AccessMode enum names should conform to code style
psandoz
parents:
36934
diff
changeset
|
112 |
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); |
36934 | 113 |
} |
114 |
||
115 |
||
116 |
@DataProvider |
|
117 |
public Object[][] typesProvider() throws Exception { |
|
118 |
List<Object[]> types = new ArrayList<>(); |
|
119 |
types.add(new Object[] {vhField, Arrays.asList(VarHandleTestAccessLong.class)}); |
|
120 |
types.add(new Object[] {vhStaticField, Arrays.asList()}); |
|
121 |
types.add(new Object[] {vhArray, Arrays.asList(long[].class, int.class)}); |
|
122 |
||
123 |
return types.stream().toArray(Object[][]::new); |
|
124 |
} |
|
125 |
||
126 |
@Test(dataProvider = "typesProvider") |
|
127 |
public void testTypes(VarHandle vh, List<Class<?>> pts) { |
|
128 |
assertEquals(vh.varType(), long.class); |
|
129 |
||
130 |
assertEquals(vh.coordinateTypes(), pts); |
|
131 |
||
132 |
testTypes(vh); |
|
133 |
} |
|
134 |
||
135 |
||
136 |
@Test |
|
137 |
public void testLookupInstanceToStatic() { |
|
138 |
checkIAE("Lookup of static final field to instance final field", () -> { |
|
139 |
MethodHandles.lookup().findStaticVarHandle( |
|
140 |
VarHandleTestAccessLong.class, "final_v", long.class); |
|
141 |
}); |
|
142 |
||
143 |
checkIAE("Lookup of static field to instance field", () -> { |
|
144 |
MethodHandles.lookup().findStaticVarHandle( |
|
145 |
VarHandleTestAccessLong.class, "v", long.class); |
|
146 |
}); |
|
147 |
} |
|
148 |
||
149 |
@Test |
|
150 |
public void testLookupStaticToInstance() { |
|
151 |
checkIAE("Lookup of instance final field to static final field", () -> { |
|
152 |
MethodHandles.lookup().findVarHandle( |
|
153 |
VarHandleTestAccessLong.class, "static_final_v", long.class); |
|
154 |
}); |
|
155 |
||
156 |
checkIAE("Lookup of instance field to static field", () -> { |
|
157 |
vhStaticField = MethodHandles.lookup().findVarHandle( |
|
158 |
VarHandleTestAccessLong.class, "static_v", long.class); |
|
159 |
}); |
|
160 |
} |
|
161 |
||
162 |
||
163 |
@DataProvider |
|
164 |
public Object[][] accessTestCaseProvider() throws Exception { |
|
165 |
List<AccessTestCase<?>> cases = new ArrayList<>(); |
|
166 |
||
167 |
cases.add(new VarHandleAccessTestCase("Instance final field", |
|
168 |
vhFinalField, vh -> testInstanceFinalField(this, vh))); |
|
169 |
cases.add(new VarHandleAccessTestCase("Instance final field unsupported", |
|
170 |
vhFinalField, vh -> testInstanceFinalFieldUnsupported(this, vh), |
|
171 |
false)); |
|
172 |
||
173 |
cases.add(new VarHandleAccessTestCase("Static final field", |
|
174 |
vhStaticFinalField, VarHandleTestAccessLong::testStaticFinalField)); |
|
175 |
cases.add(new VarHandleAccessTestCase("Static final field unsupported", |
|
176 |
vhStaticFinalField, VarHandleTestAccessLong::testStaticFinalFieldUnsupported, |
|
177 |
false)); |
|
178 |
||
179 |
cases.add(new VarHandleAccessTestCase("Instance field", |
|
180 |
vhField, vh -> testInstanceField(this, vh))); |
|
181 |
cases.add(new VarHandleAccessTestCase("Instance field unsupported", |
|
182 |
vhField, vh -> testInstanceFieldUnsupported(this, vh), |
|
183 |
false)); |
|
184 |
||
185 |
cases.add(new VarHandleAccessTestCase("Static field", |
|
186 |
vhStaticField, VarHandleTestAccessLong::testStaticField)); |
|
187 |
cases.add(new VarHandleAccessTestCase("Static field unsupported", |
|
188 |
vhStaticField, VarHandleTestAccessLong::testStaticFieldUnsupported, |
|
189 |
false)); |
|
190 |
||
191 |
cases.add(new VarHandleAccessTestCase("Array", |
|
192 |
vhArray, VarHandleTestAccessLong::testArray)); |
|
193 |
cases.add(new VarHandleAccessTestCase("Array unsupported", |
|
194 |
vhArray, VarHandleTestAccessLong::testArrayUnsupported, |
|
195 |
false)); |
|
196 |
cases.add(new VarHandleAccessTestCase("Array index out of bounds", |
|
197 |
vhArray, VarHandleTestAccessLong::testArrayIndexOutOfBounds, |
|
198 |
false)); |
|
199 |
||
200 |
// Work around issue with jtreg summary reporting which truncates |
|
201 |
// the String result of Object.toString to 30 characters, hence |
|
202 |
// the first dummy argument |
|
203 |
return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new); |
|
204 |
} |
|
205 |
||
206 |
@Test(dataProvider = "accessTestCaseProvider") |
|
207 |
public <T> void testAccess(String desc, AccessTestCase<T> atc) throws Throwable { |
|
208 |
T t = atc.get(); |
|
209 |
int iters = atc.requiresLoop() ? ITERS : 1; |
|
210 |
for (int c = 0; c < iters; c++) { |
|
211 |
atc.testAccess(t); |
|
212 |
} |
|
213 |
} |
|
214 |
||
215 |
||
216 |
||
217 |
||
218 |
static void testInstanceFinalField(VarHandleTestAccessLong recv, VarHandle vh) { |
|
219 |
// Plain |
|
220 |
{ |
|
221 |
long x = (long) vh.get(recv); |
|
222 |
assertEquals(x, 1L, "get long value"); |
|
223 |
} |
|
224 |
||
225 |
||
226 |
// Volatile |
|
227 |
{ |
|
228 |
long x = (long) vh.getVolatile(recv); |
|
229 |
assertEquals(x, 1L, "getVolatile long value"); |
|
230 |
} |
|
231 |
||
232 |
// Lazy |
|
233 |
{ |
|
234 |
long x = (long) vh.getAcquire(recv); |
|
235 |
assertEquals(x, 1L, "getRelease long value"); |
|
236 |
} |
|
237 |
||
238 |
// Opaque |
|
239 |
{ |
|
240 |
long x = (long) vh.getOpaque(recv); |
|
241 |
assertEquals(x, 1L, "getOpaque long value"); |
|
242 |
} |
|
243 |
} |
|
244 |
||
245 |
static void testInstanceFinalFieldUnsupported(VarHandleTestAccessLong recv, VarHandle vh) { |
|
246 |
checkUOE(() -> { |
|
247 |
vh.set(recv, 2L); |
|
248 |
}); |
|
249 |
||
250 |
checkUOE(() -> { |
|
251 |
vh.setVolatile(recv, 2L); |
|
252 |
}); |
|
253 |
||
254 |
checkUOE(() -> { |
|
255 |
vh.setRelease(recv, 2L); |
|
256 |
}); |
|
257 |
||
258 |
checkUOE(() -> { |
|
259 |
vh.setOpaque(recv, 2L); |
|
260 |
}); |
|
261 |
||
262 |
||
263 |
} |
|
264 |
||
265 |
||
266 |
static void testStaticFinalField(VarHandle vh) { |
|
267 |
// Plain |
|
268 |
{ |
|
269 |
long x = (long) vh.get(); |
|
270 |
assertEquals(x, 1L, "get long value"); |
|
271 |
} |
|
272 |
||
273 |
||
274 |
// Volatile |
|
275 |
{ |
|
276 |
long x = (long) vh.getVolatile(); |
|
277 |
assertEquals(x, 1L, "getVolatile long value"); |
|
278 |
} |
|
279 |
||
280 |
// Lazy |
|
281 |
{ |
|
282 |
long x = (long) vh.getAcquire(); |
|
283 |
assertEquals(x, 1L, "getRelease long value"); |
|
284 |
} |
|
285 |
||
286 |
// Opaque |
|
287 |
{ |
|
288 |
long x = (long) vh.getOpaque(); |
|
289 |
assertEquals(x, 1L, "getOpaque long value"); |
|
290 |
} |
|
291 |
} |
|
292 |
||
293 |
static void testStaticFinalFieldUnsupported(VarHandle vh) { |
|
294 |
checkUOE(() -> { |
|
295 |
vh.set(2L); |
|
296 |
}); |
|
297 |
||
298 |
checkUOE(() -> { |
|
299 |
vh.setVolatile(2L); |
|
300 |
}); |
|
301 |
||
302 |
checkUOE(() -> { |
|
303 |
vh.setRelease(2L); |
|
304 |
}); |
|
305 |
||
306 |
checkUOE(() -> { |
|
307 |
vh.setOpaque(2L); |
|
308 |
}); |
|
309 |
||
310 |
||
311 |
} |
|
312 |
||
313 |
||
314 |
static void testInstanceField(VarHandleTestAccessLong recv, VarHandle vh) { |
|
315 |
// Plain |
|
316 |
{ |
|
317 |
vh.set(recv, 1L); |
|
318 |
long x = (long) vh.get(recv); |
|
319 |
assertEquals(x, 1L, "set long value"); |
|
320 |
} |
|
321 |
||
322 |
||
323 |
// Volatile |
|
324 |
{ |
|
325 |
vh.setVolatile(recv, 2L); |
|
326 |
long x = (long) vh.getVolatile(recv); |
|
327 |
assertEquals(x, 2L, "setVolatile long value"); |
|
328 |
} |
|
329 |
||
330 |
// Lazy |
|
331 |
{ |
|
332 |
vh.setRelease(recv, 1L); |
|
333 |
long x = (long) vh.getAcquire(recv); |
|
334 |
assertEquals(x, 1L, "setRelease long value"); |
|
335 |
} |
|
336 |
||
337 |
// Opaque |
|
338 |
{ |
|
339 |
vh.setOpaque(recv, 2L); |
|
340 |
long x = (long) vh.getOpaque(recv); |
|
341 |
assertEquals(x, 2L, "setOpaque long value"); |
|
342 |
} |
|
343 |
||
344 |
vh.set(recv, 1L); |
|
345 |
||
346 |
// Compare |
|
347 |
{ |
|
348 |
boolean r = vh.compareAndSet(recv, 1L, 2L); |
|
349 |
assertEquals(r, true, "success compareAndSet long"); |
|
350 |
long x = (long) vh.get(recv); |
|
351 |
assertEquals(x, 2L, "success compareAndSet long value"); |
|
352 |
} |
|
353 |
||
354 |
{ |
|
355 |
boolean r = vh.compareAndSet(recv, 1L, 3L); |
|
356 |
assertEquals(r, false, "failing compareAndSet long"); |
|
357 |
long x = (long) vh.get(recv); |
|
358 |
assertEquals(x, 2L, "failing compareAndSet long value"); |
|
359 |
} |
|
360 |
||
361 |
{ |
|
362 |
long r = (long) vh.compareAndExchangeVolatile(recv, 2L, 1L); |
|
363 |
assertEquals(r, 2L, "success compareAndExchangeVolatile long"); |
|
364 |
long x = (long) vh.get(recv); |
|
365 |
assertEquals(x, 1L, "success compareAndExchangeVolatile long value"); |
|
366 |
} |
|
367 |
||
368 |
{ |
|
369 |
long r = (long) vh.compareAndExchangeVolatile(recv, 2L, 3L); |
|
370 |
assertEquals(r, 1L, "failing compareAndExchangeVolatile long"); |
|
371 |
long x = (long) vh.get(recv); |
|
372 |
assertEquals(x, 1L, "failing compareAndExchangeVolatile long value"); |
|
373 |
} |
|
374 |
||
375 |
{ |
|
376 |
long r = (long) vh.compareAndExchangeAcquire(recv, 1L, 2L); |
|
377 |
assertEquals(r, 1L, "success compareAndExchangeAcquire long"); |
|
378 |
long x = (long) vh.get(recv); |
|
379 |
assertEquals(x, 2L, "success compareAndExchangeAcquire long value"); |
|
380 |
} |
|
381 |
||
382 |
{ |
|
383 |
long r = (long) vh.compareAndExchangeAcquire(recv, 1L, 3L); |
|
384 |
assertEquals(r, 2L, "failing compareAndExchangeAcquire long"); |
|
385 |
long x = (long) vh.get(recv); |
|
386 |
assertEquals(x, 2L, "failing compareAndExchangeAcquire long value"); |
|
387 |
} |
|
388 |
||
389 |
{ |
|
390 |
long r = (long) vh.compareAndExchangeRelease(recv, 2L, 1L); |
|
391 |
assertEquals(r, 2L, "success compareAndExchangeRelease long"); |
|
392 |
long x = (long) vh.get(recv); |
|
393 |
assertEquals(x, 1L, "success compareAndExchangeRelease long value"); |
|
394 |
} |
|
395 |
||
396 |
{ |
|
397 |
long r = (long) vh.compareAndExchangeRelease(recv, 2L, 3L); |
|
398 |
assertEquals(r, 1L, "failing compareAndExchangeRelease long"); |
|
399 |
long x = (long) vh.get(recv); |
|
400 |
assertEquals(x, 1L, "failing compareAndExchangeRelease long value"); |
|
401 |
} |
|
402 |
||
403 |
{ |
|
38355
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
404 |
boolean success = false; |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
405 |
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
406 |
success = vh.weakCompareAndSet(recv, 1L, 2L); |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
407 |
} |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
408 |
assertEquals(success, true, "weakCompareAndSet long"); |
36934 | 409 |
long x = (long) vh.get(recv); |
410 |
assertEquals(x, 2L, "weakCompareAndSet long value"); |
|
411 |
} |
|
412 |
||
413 |
{ |
|
38355
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
414 |
boolean success = false; |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
415 |
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
416 |
success = vh.weakCompareAndSetAcquire(recv, 2L, 1L); |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
417 |
} |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
418 |
assertEquals(success, true, "weakCompareAndSetAcquire long"); |
36934 | 419 |
long x = (long) vh.get(recv); |
420 |
assertEquals(x, 1L, "weakCompareAndSetAcquire long"); |
|
421 |
} |
|
422 |
||
423 |
{ |
|
38355
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
424 |
boolean success = false; |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
425 |
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
426 |
success = vh.weakCompareAndSetRelease(recv, 1L, 2L); |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
427 |
} |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
428 |
assertEquals(success, true, "weakCompareAndSetRelease long"); |
36934 | 429 |
long x = (long) vh.get(recv); |
430 |
assertEquals(x, 2L, "weakCompareAndSetRelease long"); |
|
431 |
} |
|
432 |
||
433 |
// Compare set and get |
|
434 |
{ |
|
435 |
long o = (long) vh.getAndSet(recv, 1L); |
|
436 |
assertEquals(o, 2L, "getAndSet long"); |
|
437 |
long x = (long) vh.get(recv); |
|
438 |
assertEquals(x, 1L, "getAndSet long value"); |
|
439 |
} |
|
440 |
||
441 |
vh.set(recv, 1L); |
|
442 |
||
443 |
// get and add, add and get |
|
444 |
{ |
|
445 |
long o = (long) vh.getAndAdd(recv, 3L); |
|
446 |
assertEquals(o, 1L, "getAndAdd long"); |
|
447 |
long c = (long) vh.addAndGet(recv, 3L); |
|
448 |
assertEquals(c, 1L + 3L + 3L, "getAndAdd long value"); |
|
449 |
} |
|
450 |
} |
|
451 |
||
452 |
static void testInstanceFieldUnsupported(VarHandleTestAccessLong recv, VarHandle vh) { |
|
453 |
||
454 |
} |
|
455 |
||
456 |
||
457 |
static void testStaticField(VarHandle vh) { |
|
458 |
// Plain |
|
459 |
{ |
|
460 |
vh.set(1L); |
|
461 |
long x = (long) vh.get(); |
|
462 |
assertEquals(x, 1L, "set long value"); |
|
463 |
} |
|
464 |
||
465 |
||
466 |
// Volatile |
|
467 |
{ |
|
468 |
vh.setVolatile(2L); |
|
469 |
long x = (long) vh.getVolatile(); |
|
470 |
assertEquals(x, 2L, "setVolatile long value"); |
|
471 |
} |
|
472 |
||
473 |
// Lazy |
|
474 |
{ |
|
475 |
vh.setRelease(1L); |
|
476 |
long x = (long) vh.getAcquire(); |
|
477 |
assertEquals(x, 1L, "setRelease long value"); |
|
478 |
} |
|
479 |
||
480 |
// Opaque |
|
481 |
{ |
|
482 |
vh.setOpaque(2L); |
|
483 |
long x = (long) vh.getOpaque(); |
|
484 |
assertEquals(x, 2L, "setOpaque long value"); |
|
485 |
} |
|
486 |
||
487 |
vh.set(1L); |
|
488 |
||
489 |
// Compare |
|
490 |
{ |
|
491 |
boolean r = vh.compareAndSet(1L, 2L); |
|
492 |
assertEquals(r, true, "success compareAndSet long"); |
|
493 |
long x = (long) vh.get(); |
|
494 |
assertEquals(x, 2L, "success compareAndSet long value"); |
|
495 |
} |
|
496 |
||
497 |
{ |
|
498 |
boolean r = vh.compareAndSet(1L, 3L); |
|
499 |
assertEquals(r, false, "failing compareAndSet long"); |
|
500 |
long x = (long) vh.get(); |
|
501 |
assertEquals(x, 2L, "failing compareAndSet long value"); |
|
502 |
} |
|
503 |
||
504 |
{ |
|
505 |
long r = (long) vh.compareAndExchangeVolatile(2L, 1L); |
|
506 |
assertEquals(r, 2L, "success compareAndExchangeVolatile long"); |
|
507 |
long x = (long) vh.get(); |
|
508 |
assertEquals(x, 1L, "success compareAndExchangeVolatile long value"); |
|
509 |
} |
|
510 |
||
511 |
{ |
|
512 |
long r = (long) vh.compareAndExchangeVolatile(2L, 3L); |
|
513 |
assertEquals(r, 1L, "failing compareAndExchangeVolatile long"); |
|
514 |
long x = (long) vh.get(); |
|
515 |
assertEquals(x, 1L, "failing compareAndExchangeVolatile long value"); |
|
516 |
} |
|
517 |
||
518 |
{ |
|
519 |
long r = (long) vh.compareAndExchangeAcquire(1L, 2L); |
|
520 |
assertEquals(r, 1L, "success compareAndExchangeAcquire long"); |
|
521 |
long x = (long) vh.get(); |
|
522 |
assertEquals(x, 2L, "success compareAndExchangeAcquire long value"); |
|
523 |
} |
|
524 |
||
525 |
{ |
|
526 |
long r = (long) vh.compareAndExchangeAcquire(1L, 3L); |
|
527 |
assertEquals(r, 2L, "failing compareAndExchangeAcquire long"); |
|
528 |
long x = (long) vh.get(); |
|
529 |
assertEquals(x, 2L, "failing compareAndExchangeAcquire long value"); |
|
530 |
} |
|
531 |
||
532 |
{ |
|
533 |
long r = (long) vh.compareAndExchangeRelease(2L, 1L); |
|
534 |
assertEquals(r, 2L, "success compareAndExchangeRelease long"); |
|
535 |
long x = (long) vh.get(); |
|
536 |
assertEquals(x, 1L, "success compareAndExchangeRelease long value"); |
|
537 |
} |
|
538 |
||
539 |
{ |
|
540 |
long r = (long) vh.compareAndExchangeRelease(2L, 3L); |
|
541 |
assertEquals(r, 1L, "failing compareAndExchangeRelease long"); |
|
542 |
long x = (long) vh.get(); |
|
543 |
assertEquals(x, 1L, "failing compareAndExchangeRelease long value"); |
|
544 |
} |
|
545 |
||
546 |
{ |
|
38355
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
547 |
boolean success = false; |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
548 |
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
549 |
success = vh.weakCompareAndSet(1L, 2L); |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
550 |
} |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
551 |
assertEquals(success, true, "weakCompareAndSet long"); |
36934 | 552 |
long x = (long) vh.get(); |
553 |
assertEquals(x, 2L, "weakCompareAndSet long value"); |
|
554 |
} |
|
555 |
||
556 |
{ |
|
38355
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
557 |
boolean success = false; |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
558 |
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
559 |
success = vh.weakCompareAndSetAcquire(2L, 1L); |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
560 |
} |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
561 |
assertEquals(success, true, "weakCompareAndSetAcquire long"); |
36934 | 562 |
long x = (long) vh.get(); |
563 |
assertEquals(x, 1L, "weakCompareAndSetAcquire long"); |
|
564 |
} |
|
565 |
||
566 |
{ |
|
38355
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
567 |
boolean success = false; |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
568 |
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
569 |
success = vh.weakCompareAndSetRelease(1L, 2L); |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
570 |
} |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
571 |
assertEquals(success, true, "weakCompareAndSetRelease long"); |
36934 | 572 |
long x = (long) vh.get(); |
573 |
assertEquals(x, 2L, "weakCompareAndSetRelease long"); |
|
574 |
} |
|
575 |
||
576 |
// Compare set and get |
|
577 |
{ |
|
578 |
long o = (long) vh.getAndSet( 1L); |
|
579 |
assertEquals(o, 2L, "getAndSet long"); |
|
580 |
long x = (long) vh.get(); |
|
581 |
assertEquals(x, 1L, "getAndSet long value"); |
|
582 |
} |
|
583 |
||
584 |
vh.set(1L); |
|
585 |
||
586 |
// get and add, add and get |
|
587 |
{ |
|
588 |
long o = (long) vh.getAndAdd( 3L); |
|
589 |
assertEquals(o, 1L, "getAndAdd long"); |
|
590 |
long c = (long) vh.addAndGet(3L); |
|
591 |
assertEquals(c, 1L + 3L + 3L, "getAndAdd long value"); |
|
592 |
} |
|
593 |
} |
|
594 |
||
595 |
static void testStaticFieldUnsupported(VarHandle vh) { |
|
596 |
||
597 |
} |
|
598 |
||
599 |
||
600 |
static void testArray(VarHandle vh) { |
|
601 |
long[] array = new long[10]; |
|
602 |
||
603 |
for (int i = 0; i < array.length; i++) { |
|
604 |
// Plain |
|
605 |
{ |
|
606 |
vh.set(array, i, 1L); |
|
607 |
long x = (long) vh.get(array, i); |
|
608 |
assertEquals(x, 1L, "get long value"); |
|
609 |
} |
|
610 |
||
611 |
||
612 |
// Volatile |
|
613 |
{ |
|
614 |
vh.setVolatile(array, i, 2L); |
|
615 |
long x = (long) vh.getVolatile(array, i); |
|
616 |
assertEquals(x, 2L, "setVolatile long value"); |
|
617 |
} |
|
618 |
||
619 |
// Lazy |
|
620 |
{ |
|
621 |
vh.setRelease(array, i, 1L); |
|
622 |
long x = (long) vh.getAcquire(array, i); |
|
623 |
assertEquals(x, 1L, "setRelease long value"); |
|
624 |
} |
|
625 |
||
626 |
// Opaque |
|
627 |
{ |
|
628 |
vh.setOpaque(array, i, 2L); |
|
629 |
long x = (long) vh.getOpaque(array, i); |
|
630 |
assertEquals(x, 2L, "setOpaque long value"); |
|
631 |
} |
|
632 |
||
633 |
vh.set(array, i, 1L); |
|
634 |
||
635 |
// Compare |
|
636 |
{ |
|
637 |
boolean r = vh.compareAndSet(array, i, 1L, 2L); |
|
638 |
assertEquals(r, true, "success compareAndSet long"); |
|
639 |
long x = (long) vh.get(array, i); |
|
640 |
assertEquals(x, 2L, "success compareAndSet long value"); |
|
641 |
} |
|
642 |
||
643 |
{ |
|
644 |
boolean r = vh.compareAndSet(array, i, 1L, 3L); |
|
645 |
assertEquals(r, false, "failing compareAndSet long"); |
|
646 |
long x = (long) vh.get(array, i); |
|
647 |
assertEquals(x, 2L, "failing compareAndSet long value"); |
|
648 |
} |
|
649 |
||
650 |
{ |
|
651 |
long r = (long) vh.compareAndExchangeVolatile(array, i, 2L, 1L); |
|
652 |
assertEquals(r, 2L, "success compareAndExchangeVolatile long"); |
|
653 |
long x = (long) vh.get(array, i); |
|
654 |
assertEquals(x, 1L, "success compareAndExchangeVolatile long value"); |
|
655 |
} |
|
656 |
||
657 |
{ |
|
658 |
long r = (long) vh.compareAndExchangeVolatile(array, i, 2L, 3L); |
|
659 |
assertEquals(r, 1L, "failing compareAndExchangeVolatile long"); |
|
660 |
long x = (long) vh.get(array, i); |
|
661 |
assertEquals(x, 1L, "failing compareAndExchangeVolatile long value"); |
|
662 |
} |
|
663 |
||
664 |
{ |
|
665 |
long r = (long) vh.compareAndExchangeAcquire(array, i, 1L, 2L); |
|
666 |
assertEquals(r, 1L, "success compareAndExchangeAcquire long"); |
|
667 |
long x = (long) vh.get(array, i); |
|
668 |
assertEquals(x, 2L, "success compareAndExchangeAcquire long value"); |
|
669 |
} |
|
670 |
||
671 |
{ |
|
672 |
long r = (long) vh.compareAndExchangeAcquire(array, i, 1L, 3L); |
|
673 |
assertEquals(r, 2L, "failing compareAndExchangeAcquire long"); |
|
674 |
long x = (long) vh.get(array, i); |
|
675 |
assertEquals(x, 2L, "failing compareAndExchangeAcquire long value"); |
|
676 |
} |
|
677 |
||
678 |
{ |
|
679 |
long r = (long) vh.compareAndExchangeRelease(array, i, 2L, 1L); |
|
680 |
assertEquals(r, 2L, "success compareAndExchangeRelease long"); |
|
681 |
long x = (long) vh.get(array, i); |
|
682 |
assertEquals(x, 1L, "success compareAndExchangeRelease long value"); |
|
683 |
} |
|
684 |
||
685 |
{ |
|
686 |
long r = (long) vh.compareAndExchangeRelease(array, i, 2L, 3L); |
|
687 |
assertEquals(r, 1L, "failing compareAndExchangeRelease long"); |
|
688 |
long x = (long) vh.get(array, i); |
|
689 |
assertEquals(x, 1L, "failing compareAndExchangeRelease long value"); |
|
690 |
} |
|
691 |
||
692 |
{ |
|
38355
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
693 |
boolean success = false; |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
694 |
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
695 |
success = vh.weakCompareAndSet(array, i, 1L, 2L); |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
696 |
} |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
697 |
assertEquals(success, true, "weakCompareAndSet long"); |
36934 | 698 |
long x = (long) vh.get(array, i); |
699 |
assertEquals(x, 2L, "weakCompareAndSet long value"); |
|
700 |
} |
|
701 |
||
702 |
{ |
|
38355
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
703 |
boolean success = false; |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
704 |
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
705 |
success = vh.weakCompareAndSetAcquire(array, i, 2L, 1L); |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
706 |
} |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
707 |
assertEquals(success, true, "weakCompareAndSetAcquire long"); |
36934 | 708 |
long x = (long) vh.get(array, i); |
709 |
assertEquals(x, 1L, "weakCompareAndSetAcquire long"); |
|
710 |
} |
|
711 |
||
712 |
{ |
|
38355
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
713 |
boolean success = false; |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
714 |
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
715 |
success = vh.weakCompareAndSetRelease(array, i, 1L, 2L); |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
716 |
} |
674cfd9b90cf
8155739: [TESTBUG] VarHandles/Unsafe tests for weakCAS should allow spurious failures
shade
parents:
37343
diff
changeset
|
717 |
assertEquals(success, true, "weakCompareAndSetRelease long"); |
36934 | 718 |
long x = (long) vh.get(array, i); |
719 |
assertEquals(x, 2L, "weakCompareAndSetRelease long"); |
|
720 |
} |
|
721 |
||
722 |
// Compare set and get |
|
723 |
{ |
|
724 |
long o = (long) vh.getAndSet(array, i, 1L); |
|
725 |
assertEquals(o, 2L, "getAndSet long"); |
|
726 |
long x = (long) vh.get(array, i); |
|
727 |
assertEquals(x, 1L, "getAndSet long value"); |
|
728 |
} |
|
729 |
||
730 |
vh.set(array, i, 1L); |
|
731 |
||
732 |
// get and add, add and get |
|
733 |
{ |
|
734 |
long o = (long) vh.getAndAdd(array, i, 3L); |
|
735 |
assertEquals(o, 1L, "getAndAdd long"); |
|
736 |
long c = (long) vh.addAndGet(array, i, 3L); |
|
737 |
assertEquals(c, 1L + 3L + 3L, "getAndAdd long value"); |
|
738 |
} |
|
739 |
} |
|
740 |
} |
|
741 |
||
742 |
static void testArrayUnsupported(VarHandle vh) { |
|
743 |
long[] array = new long[10]; |
|
744 |
||
745 |
int i = 0; |
|
746 |
||
747 |
} |
|
748 |
||
749 |
static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { |
|
750 |
long[] array = new long[10]; |
|
751 |
||
752 |
for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) { |
|
753 |
final int ci = i; |
|
754 |
||
755 |
checkIOOBE(() -> { |
|
756 |
long x = (long) vh.get(array, ci); |
|
757 |
}); |
|
758 |
||
759 |
checkIOOBE(() -> { |
|
760 |
vh.set(array, ci, 1L); |
|
761 |
}); |
|
762 |
||
763 |
checkIOOBE(() -> { |
|
764 |
long x = (long) vh.getVolatile(array, ci); |
|
765 |
}); |
|
766 |
||
767 |
checkIOOBE(() -> { |
|
768 |
vh.setVolatile(array, ci, 1L); |
|
769 |
}); |
|
770 |
||
771 |
checkIOOBE(() -> { |
|
772 |
long x = (long) vh.getAcquire(array, ci); |
|
773 |
}); |
|
774 |
||
775 |
checkIOOBE(() -> { |
|
776 |
vh.setRelease(array, ci, 1L); |
|
777 |
}); |
|
778 |
||
779 |
checkIOOBE(() -> { |
|
780 |
long x = (long) vh.getOpaque(array, ci); |
|
781 |
}); |
|
782 |
||
783 |
checkIOOBE(() -> { |
|
784 |
vh.setOpaque(array, ci, 1L); |
|
785 |
}); |
|
786 |
||
787 |
checkIOOBE(() -> { |
|
788 |
boolean r = vh.compareAndSet(array, ci, 1L, 2L); |
|
789 |
}); |
|
790 |
||
791 |
checkIOOBE(() -> { |
|
792 |
long r = (long) vh.compareAndExchangeVolatile(array, ci, 2L, 1L); |
|
793 |
}); |
|
794 |
||
795 |
checkIOOBE(() -> { |
|
796 |
long r = (long) vh.compareAndExchangeAcquire(array, ci, 2L, 1L); |
|
797 |
}); |
|
798 |
||
799 |
checkIOOBE(() -> { |
|
800 |
long r = (long) vh.compareAndExchangeRelease(array, ci, 2L, 1L); |
|
801 |
}); |
|
802 |
||
803 |
checkIOOBE(() -> { |
|
804 |
boolean r = vh.weakCompareAndSet(array, ci, 1L, 2L); |
|
805 |
}); |
|
806 |
||
807 |
checkIOOBE(() -> { |
|
808 |
boolean r = vh.weakCompareAndSetAcquire(array, ci, 1L, 2L); |
|
809 |
}); |
|
810 |
||
811 |
checkIOOBE(() -> { |
|
812 |
boolean r = vh.weakCompareAndSetRelease(array, ci, 1L, 2L); |
|
813 |
}); |
|
814 |
||
815 |
checkIOOBE(() -> { |
|
816 |
long o = (long) vh.getAndSet(array, ci, 1L); |
|
817 |
}); |
|
818 |
||
819 |
checkIOOBE(() -> { |
|
820 |
long o = (long) vh.getAndAdd(array, ci, 3L); |
|
821 |
}); |
|
822 |
||
823 |
checkIOOBE(() -> { |
|
824 |
long o = (long) vh.addAndGet(array, ci, 3L); |
|
825 |
}); |
|
826 |
} |
|
827 |
} |
|
828 |
} |
|
829 |