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                   VarHandleTestAccessFloat
  27  * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestAccessFloat
  28  * @run testng/othervm -Diters=20000                         VarHandleTestAccessFloat
  29  * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  VarHandleTestAccessFloat
  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 VarHandleTestAccessFloat extends VarHandleBaseTest {
  45     static final float static_final_v = 1.0f;
  46 
  47     static float static_v;
  48 
  49     final float final_v = 1.0f;
  50 
  51     float v;
  52 
  53     static final float static_final_v2 = 1.0f;
  54 
  55     static float static_v2;
  56 
  57     final float final_v2 = 1.0f;
  58 
  59     float v2;
  60 
  61     VarHandle vhFinalField;
  62 
  63     VarHandle vhField;
  64 
  65     VarHandle vhStaticField;
  66 
  67     VarHandle vhStaticFinalField;
  68 
  69     VarHandle vhArray;
  70 
  71 
  72     VarHandle[] allocate(boolean same) {
  73         List<VarHandle> vhs = new ArrayList<>();
  74 
  75         String postfix = same ? "" : "2";
  76         VarHandle vh;
  77         try {
  78             vh = MethodHandles.lookup().findVarHandle(
  79                     VarHandleTestAccessFloat.class, "final_v" + postfix, float.class);
  80             vhs.add(vh);
  81 
  82             vh = MethodHandles.lookup().findVarHandle(
  83                     VarHandleTestAccessFloat.class, "v" + postfix, float.class);
  84             vhs.add(vh);
  85 
  86             vh = MethodHandles.lookup().findStaticVarHandle(
  87                 VarHandleTestAccessFloat.class, "static_final_v" + postfix, float.class);
  88             vhs.add(vh);
  89 
  90             vh = MethodHandles.lookup().findStaticVarHandle(
  91                 VarHandleTestAccessFloat.class, "static_v" + postfix, float.class);
  92             vhs.add(vh);
  93 
  94             if (same) {
  95                 vh = MethodHandles.arrayElementVarHandle(float[].class);
  96             }
  97             else {
  98                 vh = MethodHandles.arrayElementVarHandle(String[].class);
  99             }
 100             vhs.add(vh);
 101         } catch (Exception e) {
 102             throw new InternalError(e);
 103         }
 104         return vhs.toArray(new VarHandle[0]);
 105     }
 106 
 107     @BeforeClass
 108     public void setup() throws Exception {
 109         vhFinalField = MethodHandles.lookup().findVarHandle(
 110                 VarHandleTestAccessFloat.class, "final_v", float.class);
 111 
 112         vhField = MethodHandles.lookup().findVarHandle(
 113                 VarHandleTestAccessFloat.class, "v", float.class);
 114 
 115         vhStaticFinalField = MethodHandles.lookup().findStaticVarHandle(
 116             VarHandleTestAccessFloat.class, "static_final_v", float.class);
 117 
 118         vhStaticField = MethodHandles.lookup().findStaticVarHandle(
 119             VarHandleTestAccessFloat.class, "static_v", float.class);
 120 
 121         vhArray = MethodHandles.arrayElementVarHandle(float[].class);
 122     }
 123 
 124 
 125     @DataProvider
 126     public Object[][] varHandlesProvider() throws Exception {
 127         List<VarHandle> vhs = new ArrayList<>();
 128         vhs.add(vhField);
 129         vhs.add(vhStaticField);
 130         vhs.add(vhArray);
 131 
 132         return vhs.stream().map(tc -> new Object[]{tc}).toArray(Object[][]::new);
 133     }
 134 
 135     @Test
 136     public void testEqualsAndHashCode() {
 137         VarHandle[] vhs1 = allocate(true);
 138         VarHandle[] vhs2 = allocate(true);
 139 
 140         for (int i = 0; i < vhs1.length; i++) {
 141             for (int j = 0; j < vhs1.length; j++) {
 142                 if (i == j) {
 143                     assertEquals(vhs1[i], vhs1[i]);
 144                     assertEquals(vhs1[i], vhs2[i]);
 145                     assertEquals(vhs1[i].hashCode(), vhs2[i].hashCode());
 146                 }
 147                 else {
 148                     assertNotEquals(vhs1[i], vhs1[j]);
 149                     assertNotEquals(vhs1[i], vhs2[j]);
 150                 }
 151             }
 152         }
 153 
 154         VarHandle[] vhs3 = allocate(false);
 155         for (int i = 0; i < vhs1.length; i++) {
 156             assertNotEquals(vhs1[i], vhs3[i]);
 157         }
 158     }
 159 
 160     @Test(dataProvider = "varHandlesProvider")
 161     public void testIsAccessModeSupported(VarHandle vh) {
 162         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
 163         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
 164         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_VOLATILE));
 165         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_VOLATILE));
 166         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_ACQUIRE));
 167         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_RELEASE));
 168         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_OPAQUE));
 169         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET_OPAQUE));
 170 
 171         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET));
 172         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE));
 173         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
 174         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
 175         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN));
 176         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
 177         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
 178         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
 179         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
 180         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE));
 181         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE));
 182 
 183         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
 184         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE));
 185         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE));
 186 
 187         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR));
 188         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE));
 189         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE));
 190         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND));
 191         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE));
 192         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE));
 193         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR));
 194         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE));
 195         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
 196     }
 197 
 198 
 199     @DataProvider
 200     public Object[][] typesProvider() throws Exception {
 201         List<Object[]> types = new ArrayList<>();
 202         types.add(new Object[] {vhField, Arrays.asList(VarHandleTestAccessFloat.class)});
 203         types.add(new Object[] {vhStaticField, Arrays.asList()});
 204         types.add(new Object[] {vhArray, Arrays.asList(float[].class, int.class)});
 205 
 206         return types.stream().toArray(Object[][]::new);
 207     }
 208 
 209     @Test(dataProvider = "typesProvider")
 210     public void testTypes(VarHandle vh, List<Class<?>> pts) {
 211         assertEquals(vh.varType(), float.class);
 212 
 213         assertEquals(vh.coordinateTypes(), pts);
 214 
 215         testTypes(vh);
 216     }
 217 
 218 
 219     @Test
 220     public void testLookupInstanceToStatic() {
 221         checkIAE("Lookup of static final field to instance final field", () -> {
 222             MethodHandles.lookup().findStaticVarHandle(
 223                     VarHandleTestAccessFloat.class, "final_v", float.class);
 224         });
 225 
 226         checkIAE("Lookup of static field to instance field", () -> {
 227             MethodHandles.lookup().findStaticVarHandle(
 228                     VarHandleTestAccessFloat.class, "v", float.class);
 229         });
 230     }
 231 
 232     @Test
 233     public void testLookupStaticToInstance() {
 234         checkIAE("Lookup of instance final field to static final field", () -> {
 235             MethodHandles.lookup().findVarHandle(
 236                 VarHandleTestAccessFloat.class, "static_final_v", float.class);
 237         });
 238 
 239         checkIAE("Lookup of instance field to static field", () -> {
 240             vhStaticField = MethodHandles.lookup().findVarHandle(
 241                 VarHandleTestAccessFloat.class, "static_v", float.class);
 242         });
 243     }
 244 
 245 
 246     @DataProvider
 247     public Object[][] accessTestCaseProvider() throws Exception {
 248         List<AccessTestCase<?>> cases = new ArrayList<>();
 249 
 250         cases.add(new VarHandleAccessTestCase("Instance final field",
 251                                               vhFinalField, vh -> testInstanceFinalField(this, vh)));
 252         cases.add(new VarHandleAccessTestCase("Instance final field unsupported",
 253                                               vhFinalField, vh -> testInstanceFinalFieldUnsupported(this, vh),
 254                                               false));
 255 
 256         cases.add(new VarHandleAccessTestCase("Static final field",
 257                                               vhStaticFinalField, VarHandleTestAccessFloat::testStaticFinalField));
 258         cases.add(new VarHandleAccessTestCase("Static final field unsupported",
 259                                               vhStaticFinalField, VarHandleTestAccessFloat::testStaticFinalFieldUnsupported,
 260                                               false));
 261 
 262         cases.add(new VarHandleAccessTestCase("Instance field",
 263                                               vhField, vh -> testInstanceField(this, vh)));
 264         cases.add(new VarHandleAccessTestCase("Instance field unsupported",
 265                                               vhField, vh -> testInstanceFieldUnsupported(this, vh),
 266                                               false));
 267 
 268         cases.add(new VarHandleAccessTestCase("Static field",
 269                                               vhStaticField, VarHandleTestAccessFloat::testStaticField));
 270         cases.add(new VarHandleAccessTestCase("Static field unsupported",
 271                                               vhStaticField, VarHandleTestAccessFloat::testStaticFieldUnsupported,
 272                                               false));
 273 
 274         cases.add(new VarHandleAccessTestCase("Array",
 275                                               vhArray, VarHandleTestAccessFloat::testArray));
 276         cases.add(new VarHandleAccessTestCase("Array unsupported",
 277                                               vhArray, VarHandleTestAccessFloat::testArrayUnsupported,
 278                                               false));
 279         cases.add(new VarHandleAccessTestCase("Array index out of bounds",
 280                                               vhArray, VarHandleTestAccessFloat::testArrayIndexOutOfBounds,
 281                                               false));
 282         // Work around issue with jtreg summary reporting which truncates
 283         // the String result of Object.toString to 30 characters, hence
 284         // the first dummy argument
 285         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
 286     }
 287 
 288     @Test(dataProvider = "accessTestCaseProvider")
 289     public <T> void testAccess(String desc, AccessTestCase<T> atc) throws Throwable {
 290         T t = atc.get();
 291         int iters = atc.requiresLoop() ? ITERS : 1;
 292         for (int c = 0; c < iters; c++) {
 293             atc.testAccess(t);
 294         }
 295     }
 296 
 297 
 298 
 299 
 300     static void testInstanceFinalField(VarHandleTestAccessFloat recv, VarHandle vh) {
 301         // Plain
 302         {
 303             float x = (float) vh.get(recv);
 304             assertEquals(x, 1.0f, "get float value");
 305         }
 306 
 307 
 308         // Volatile
 309         {
 310             float x = (float) vh.getVolatile(recv);
 311             assertEquals(x, 1.0f, "getVolatile float value");
 312         }
 313 
 314         // Lazy
 315         {
 316             float x = (float) vh.getAcquire(recv);
 317             assertEquals(x, 1.0f, "getRelease float value");
 318         }
 319 
 320         // Opaque
 321         {
 322             float x = (float) vh.getOpaque(recv);
 323             assertEquals(x, 1.0f, "getOpaque float value");
 324         }
 325     }
 326 
 327     static void testInstanceFinalFieldUnsupported(VarHandleTestAccessFloat recv, VarHandle vh) {
 328         checkUOE(() -> {
 329             vh.set(recv, 2.0f);
 330         });
 331 
 332         checkUOE(() -> {
 333             vh.setVolatile(recv, 2.0f);
 334         });
 335 
 336         checkUOE(() -> {
 337             vh.setRelease(recv, 2.0f);
 338         });
 339 
 340         checkUOE(() -> {
 341             vh.setOpaque(recv, 2.0f);
 342         });
 343 
 344 
 345 
 346         checkUOE(() -> {
 347             float o = (float) vh.getAndBitwiseOr(recv, 1.0f);
 348         });
 349 
 350         checkUOE(() -> {
 351             float o = (float) vh.getAndBitwiseOrAcquire(recv, 1.0f);
 352         });
 353 
 354         checkUOE(() -> {
 355             float o = (float) vh.getAndBitwiseOrRelease(recv, 1.0f);
 356         });
 357 
 358         checkUOE(() -> {
 359             float o = (float) vh.getAndBitwiseAnd(recv, 1.0f);
 360         });
 361 
 362         checkUOE(() -> {
 363             float o = (float) vh.getAndBitwiseAndAcquire(recv, 1.0f);
 364         });
 365 
 366         checkUOE(() -> {
 367             float o = (float) vh.getAndBitwiseAndRelease(recv, 1.0f);
 368         });
 369 
 370         checkUOE(() -> {
 371             float o = (float) vh.getAndBitwiseXor(recv, 1.0f);
 372         });
 373 
 374         checkUOE(() -> {
 375             float o = (float) vh.getAndBitwiseXorAcquire(recv, 1.0f);
 376         });
 377 
 378         checkUOE(() -> {
 379             float o = (float) vh.getAndBitwiseXorRelease(recv, 1.0f);
 380         });
 381     }
 382 
 383 
 384     static void testStaticFinalField(VarHandle vh) {
 385         // Plain
 386         {
 387             float x = (float) vh.get();
 388             assertEquals(x, 1.0f, "get float value");
 389         }
 390 
 391 
 392         // Volatile
 393         {
 394             float x = (float) vh.getVolatile();
 395             assertEquals(x, 1.0f, "getVolatile float value");
 396         }
 397 
 398         // Lazy
 399         {
 400             float x = (float) vh.getAcquire();
 401             assertEquals(x, 1.0f, "getRelease float value");
 402         }
 403 
 404         // Opaque
 405         {
 406             float x = (float) vh.getOpaque();
 407             assertEquals(x, 1.0f, "getOpaque float value");
 408         }
 409     }
 410 
 411     static void testStaticFinalFieldUnsupported(VarHandle vh) {
 412         checkUOE(() -> {
 413             vh.set(2.0f);
 414         });
 415 
 416         checkUOE(() -> {
 417             vh.setVolatile(2.0f);
 418         });
 419 
 420         checkUOE(() -> {
 421             vh.setRelease(2.0f);
 422         });
 423 
 424         checkUOE(() -> {
 425             vh.setOpaque(2.0f);
 426         });
 427 
 428 
 429 
 430         checkUOE(() -> {
 431             float o = (float) vh.getAndBitwiseOr(1.0f);
 432         });
 433 
 434         checkUOE(() -> {
 435             float o = (float) vh.getAndBitwiseOrAcquire(1.0f);
 436         });
 437 
 438         checkUOE(() -> {
 439             float o = (float) vh.getAndBitwiseOrRelease(1.0f);
 440         });
 441 
 442         checkUOE(() -> {
 443             float o = (float) vh.getAndBitwiseAnd(1.0f);
 444         });
 445 
 446         checkUOE(() -> {
 447             float o = (float) vh.getAndBitwiseAndAcquire(1.0f);
 448         });
 449 
 450         checkUOE(() -> {
 451             float o = (float) vh.getAndBitwiseAndRelease(1.0f);
 452         });
 453 
 454         checkUOE(() -> {
 455             float o = (float) vh.getAndBitwiseXor(1.0f);
 456         });
 457 
 458         checkUOE(() -> {
 459             float o = (float) vh.getAndBitwiseXorAcquire(1.0f);
 460         });
 461 
 462         checkUOE(() -> {
 463             float o = (float) vh.getAndBitwiseXorRelease(1.0f);
 464         });
 465     }
 466 
 467 
 468     static void testInstanceField(VarHandleTestAccessFloat recv, VarHandle vh) {
 469         // Plain
 470         {
 471             vh.set(recv, 1.0f);
 472             float x = (float) vh.get(recv);
 473             assertEquals(x, 1.0f, "set float value");
 474         }
 475 
 476 
 477         // Volatile
 478         {
 479             vh.setVolatile(recv, 2.0f);
 480             float x = (float) vh.getVolatile(recv);
 481             assertEquals(x, 2.0f, "setVolatile float value");
 482         }
 483 
 484         // Lazy
 485         {
 486             vh.setRelease(recv, 1.0f);
 487             float x = (float) vh.getAcquire(recv);
 488             assertEquals(x, 1.0f, "setRelease float value");
 489         }
 490 
 491         // Opaque
 492         {
 493             vh.setOpaque(recv, 2.0f);
 494             float x = (float) vh.getOpaque(recv);
 495             assertEquals(x, 2.0f, "setOpaque float value");
 496         }
 497 
 498         vh.set(recv, 1.0f);
 499 
 500         // Compare
 501         {
 502             boolean r = vh.compareAndSet(recv, 1.0f, 2.0f);
 503             assertEquals(r, true, "success compareAndSet float");
 504             float x = (float) vh.get(recv);
 505             assertEquals(x, 2.0f, "success compareAndSet float value");
 506         }
 507 
 508         {
 509             boolean r = vh.compareAndSet(recv, 1.0f, 3.0f);
 510             assertEquals(r, false, "failing compareAndSet float");
 511             float x = (float) vh.get(recv);
 512             assertEquals(x, 2.0f, "failing compareAndSet float value");
 513         }
 514 
 515         {
 516             float r = (float) vh.compareAndExchange(recv, 2.0f, 1.0f);
 517             assertEquals(r, 2.0f, "success compareAndExchange float");
 518             float x = (float) vh.get(recv);
 519             assertEquals(x, 1.0f, "success compareAndExchange float value");
 520         }
 521 
 522         {
 523             float r = (float) vh.compareAndExchange(recv, 2.0f, 3.0f);
 524             assertEquals(r, 1.0f, "failing compareAndExchange float");
 525             float x = (float) vh.get(recv);
 526             assertEquals(x, 1.0f, "failing compareAndExchange float value");
 527         }
 528 
 529         {
 530             float r = (float) vh.compareAndExchangeAcquire(recv, 1.0f, 2.0f);
 531             assertEquals(r, 1.0f, "success compareAndExchangeAcquire float");
 532             float x = (float) vh.get(recv);
 533             assertEquals(x, 2.0f, "success compareAndExchangeAcquire float value");
 534         }
 535 
 536         {
 537             float r = (float) vh.compareAndExchangeAcquire(recv, 1.0f, 3.0f);
 538             assertEquals(r, 2.0f, "failing compareAndExchangeAcquire float");
 539             float x = (float) vh.get(recv);
 540             assertEquals(x, 2.0f, "failing compareAndExchangeAcquire float value");
 541         }
 542 
 543         {
 544             float r = (float) vh.compareAndExchangeRelease(recv, 2.0f, 1.0f);
 545             assertEquals(r, 2.0f, "success compareAndExchangeRelease float");
 546             float x = (float) vh.get(recv);
 547             assertEquals(x, 1.0f, "success compareAndExchangeRelease float value");
 548         }
 549 
 550         {
 551             float r = (float) vh.compareAndExchangeRelease(recv, 2.0f, 3.0f);
 552             assertEquals(r, 1.0f, "failing compareAndExchangeRelease float");
 553             float x = (float) vh.get(recv);
 554             assertEquals(x, 1.0f, "failing compareAndExchangeRelease float value");
 555         }
 556 
 557         {
 558             boolean success = false;
 559             for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
 560                 success = vh.weakCompareAndSetPlain(recv, 1.0f, 2.0f);
 561             }
 562             assertEquals(success, true, "weakCompareAndSetPlain float");
 563             float x = (float) vh.get(recv);
 564             assertEquals(x, 2.0f, "weakCompareAndSetPlain float value");
 565         }
 566 
 567         {
 568             boolean success = false;
 569             for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
 570                 success = vh.weakCompareAndSetAcquire(recv, 2.0f, 1.0f);
 571             }
 572             assertEquals(success, true, "weakCompareAndSetAcquire float");
 573             float x = (float) vh.get(recv);
 574             assertEquals(x, 1.0f, "weakCompareAndSetAcquire float");
 575         }
 576 
 577         {
 578             boolean success = false;
 579             for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
 580                 success = vh.weakCompareAndSetRelease(recv, 1.0f, 2.0f);
 581             }
 582             assertEquals(success, true, "weakCompareAndSetRelease float");
 583             float x = (float) vh.get(recv);
 584             assertEquals(x, 2.0f, "weakCompareAndSetRelease float");
 585         }
 586 
 587         {
 588             boolean success = false;
 589             for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
 590                 success = vh.weakCompareAndSet(recv, 2.0f, 1.0f);
 591             }
 592             assertEquals(success, true, "weakCompareAndSet float");
 593             float x = (float) vh.get(recv);
 594             assertEquals(x, 1.0f, "weakCompareAndSet float value");
 595         }
 596 
 597         // Compare set and get
 598         {
 599             vh.set(recv, 1.0f);
 600 
 601             float o = (float) vh.getAndSet(recv, 2.0f);
 602             assertEquals(o, 1.0f, "getAndSet float");
 603             float x = (float) vh.get(recv);
 604             assertEquals(x, 2.0f, "getAndSet float value");
 605         }
 606 
 607         {
 608             vh.set(recv, 1.0f);
 609 
 610             float o = (float) vh.getAndSetAcquire(recv, 2.0f);
 611             assertEquals(o, 1.0f, "getAndSetAcquire float");
 612             float x = (float) vh.get(recv);
 613             assertEquals(x, 2.0f, "getAndSetAcquire float value");
 614         }
 615 
 616         {
 617             vh.set(recv, 1.0f);
 618 
 619             float o = (float) vh.getAndSetRelease(recv, 2.0f);
 620             assertEquals(o, 1.0f, "getAndSetRelease float");
 621             float x = (float) vh.get(recv);
 622             assertEquals(x, 2.0f, "getAndSetRelease float value");
 623         }
 624 
 625         // get and add, add and get
 626         {
 627             vh.set(recv, 1.0f);
 628 
 629             float o = (float) vh.getAndAdd(recv, 2.0f);
 630             assertEquals(o, 1.0f, "getAndAdd float");
 631             float x = (float) vh.get(recv);
 632             assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value");
 633         }
 634 
 635         {
 636             vh.set(recv, 1.0f);
 637 
 638             float o = (float) vh.getAndAddAcquire(recv, 2.0f);
 639             assertEquals(o, 1.0f, "getAndAddAcquire float");
 640             float x = (float) vh.get(recv);
 641             assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
 642         }
 643 
 644         {
 645             vh.set(recv, 1.0f);
 646 
 647             float o = (float) vh.getAndAddRelease(recv, 2.0f);
 648             assertEquals(o, 1.0f, "getAndAddReleasefloat");
 649             float x = (float) vh.get(recv);
 650             assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
 651         }
 652 
 653     }
 654 
 655     static void testInstanceFieldUnsupported(VarHandleTestAccessFloat recv, VarHandle vh) {
 656 
 657 
 658         checkUOE(() -> {
 659             float o = (float) vh.getAndBitwiseOr(recv, 1.0f);
 660         });
 661 
 662         checkUOE(() -> {
 663             float o = (float) vh.getAndBitwiseOrAcquire(recv, 1.0f);
 664         });
 665 
 666         checkUOE(() -> {
 667             float o = (float) vh.getAndBitwiseOrRelease(recv, 1.0f);
 668         });
 669 
 670         checkUOE(() -> {
 671             float o = (float) vh.getAndBitwiseAnd(recv, 1.0f);
 672         });
 673 
 674         checkUOE(() -> {
 675             float o = (float) vh.getAndBitwiseAndAcquire(recv, 1.0f);
 676         });
 677 
 678         checkUOE(() -> {
 679             float o = (float) vh.getAndBitwiseAndRelease(recv, 1.0f);
 680         });
 681 
 682         checkUOE(() -> {
 683             float o = (float) vh.getAndBitwiseXor(recv, 1.0f);
 684         });
 685 
 686         checkUOE(() -> {
 687             float o = (float) vh.getAndBitwiseXorAcquire(recv, 1.0f);
 688         });
 689 
 690         checkUOE(() -> {
 691             float o = (float) vh.getAndBitwiseXorRelease(recv, 1.0f);
 692         });
 693     }
 694 
 695 
 696     static void testStaticField(VarHandle vh) {
 697         // Plain
 698         {
 699             vh.set(1.0f);
 700             float x = (float) vh.get();
 701             assertEquals(x, 1.0f, "set float value");
 702         }
 703 
 704 
 705         // Volatile
 706         {
 707             vh.setVolatile(2.0f);
 708             float x = (float) vh.getVolatile();
 709             assertEquals(x, 2.0f, "setVolatile float value");
 710         }
 711 
 712         // Lazy
 713         {
 714             vh.setRelease(1.0f);
 715             float x = (float) vh.getAcquire();
 716             assertEquals(x, 1.0f, "setRelease float value");
 717         }
 718 
 719         // Opaque
 720         {
 721             vh.setOpaque(2.0f);
 722             float x = (float) vh.getOpaque();
 723             assertEquals(x, 2.0f, "setOpaque float value");
 724         }
 725 
 726         vh.set(1.0f);
 727 
 728         // Compare
 729         {
 730             boolean r = vh.compareAndSet(1.0f, 2.0f);
 731             assertEquals(r, true, "success compareAndSet float");
 732             float x = (float) vh.get();
 733             assertEquals(x, 2.0f, "success compareAndSet float value");
 734         }
 735 
 736         {
 737             boolean r = vh.compareAndSet(1.0f, 3.0f);
 738             assertEquals(r, false, "failing compareAndSet float");
 739             float x = (float) vh.get();
 740             assertEquals(x, 2.0f, "failing compareAndSet float value");
 741         }
 742 
 743         {
 744             float r = (float) vh.compareAndExchange(2.0f, 1.0f);
 745             assertEquals(r, 2.0f, "success compareAndExchange float");
 746             float x = (float) vh.get();
 747             assertEquals(x, 1.0f, "success compareAndExchange float value");
 748         }
 749 
 750         {
 751             float r = (float) vh.compareAndExchange(2.0f, 3.0f);
 752             assertEquals(r, 1.0f, "failing compareAndExchange float");
 753             float x = (float) vh.get();
 754             assertEquals(x, 1.0f, "failing compareAndExchange float value");
 755         }
 756 
 757         {
 758             float r = (float) vh.compareAndExchangeAcquire(1.0f, 2.0f);
 759             assertEquals(r, 1.0f, "success compareAndExchangeAcquire float");
 760             float x = (float) vh.get();
 761             assertEquals(x, 2.0f, "success compareAndExchangeAcquire float value");
 762         }
 763 
 764         {
 765             float r = (float) vh.compareAndExchangeAcquire(1.0f, 3.0f);
 766             assertEquals(r, 2.0f, "failing compareAndExchangeAcquire float");
 767             float x = (float) vh.get();
 768             assertEquals(x, 2.0f, "failing compareAndExchangeAcquire float value");
 769         }
 770 
 771         {
 772             float r = (float) vh.compareAndExchangeRelease(2.0f, 1.0f);
 773             assertEquals(r, 2.0f, "success compareAndExchangeRelease float");
 774             float x = (float) vh.get();
 775             assertEquals(x, 1.0f, "success compareAndExchangeRelease float value");
 776         }
 777 
 778         {
 779             float r = (float) vh.compareAndExchangeRelease(2.0f, 3.0f);
 780             assertEquals(r, 1.0f, "failing compareAndExchangeRelease float");
 781             float x = (float) vh.get();
 782             assertEquals(x, 1.0f, "failing compareAndExchangeRelease float value");
 783         }
 784 
 785         {
 786             boolean success = false;
 787             for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
 788                 success = vh.weakCompareAndSetPlain(1.0f, 2.0f);
 789             }
 790             assertEquals(success, true, "weakCompareAndSetPlain float");
 791             float x = (float) vh.get();
 792             assertEquals(x, 2.0f, "weakCompareAndSetPlain float value");
 793         }
 794 
 795         {
 796             boolean success = false;
 797             for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
 798                 success = vh.weakCompareAndSetAcquire(2.0f, 1.0f);
 799             }
 800             assertEquals(success, true, "weakCompareAndSetAcquire float");
 801             float x = (float) vh.get();
 802             assertEquals(x, 1.0f, "weakCompareAndSetAcquire float");
 803         }
 804 
 805         {
 806             boolean success = false;
 807             for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
 808                 success = vh.weakCompareAndSetRelease(1.0f, 2.0f);
 809             }
 810             assertEquals(success, true, "weakCompareAndSetRelease float");
 811             float x = (float) vh.get();
 812             assertEquals(x, 2.0f, "weakCompareAndSetRelease float");
 813         }
 814 
 815         {
 816             boolean success = false;
 817             for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
 818                 success = vh.weakCompareAndSet(2.0f, 1.0f);
 819             }
 820             assertEquals(success, true, "weakCompareAndSet float");
 821             float x = (float) vh.get();
 822             assertEquals(x, 1.0f, "weakCompareAndSet float");
 823         }
 824 
 825         // Compare set and get
 826         {
 827             vh.set(1.0f);
 828 
 829             float o = (float) vh.getAndSet(2.0f);
 830             assertEquals(o, 1.0f, "getAndSet float");
 831             float x = (float) vh.get();
 832             assertEquals(x, 2.0f, "getAndSet float value");
 833         }
 834 
 835         {
 836             vh.set(1.0f);
 837 
 838             float o = (float) vh.getAndSetAcquire(2.0f);
 839             assertEquals(o, 1.0f, "getAndSetAcquire float");
 840             float x = (float) vh.get();
 841             assertEquals(x, 2.0f, "getAndSetAcquire float value");
 842         }
 843 
 844         {
 845             vh.set(1.0f);
 846 
 847             float o = (float) vh.getAndSetRelease(2.0f);
 848             assertEquals(o, 1.0f, "getAndSetRelease float");
 849             float x = (float) vh.get();
 850             assertEquals(x, 2.0f, "getAndSetRelease float value");
 851         }
 852 
 853         // get and add, add and get
 854         {
 855             vh.set(1.0f);
 856 
 857             float o = (float) vh.getAndAdd(2.0f);
 858             assertEquals(o, 1.0f, "getAndAdd float");
 859             float x = (float) vh.get();
 860             assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value");
 861         }
 862 
 863         {
 864             vh.set(1.0f);
 865 
 866             float o = (float) vh.getAndAddAcquire(2.0f);
 867             assertEquals(o, 1.0f, "getAndAddAcquire float");
 868             float x = (float) vh.get();
 869             assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
 870         }
 871 
 872         {
 873             vh.set(1.0f);
 874 
 875             float o = (float) vh.getAndAddRelease(2.0f);
 876             assertEquals(o, 1.0f, "getAndAddReleasefloat");
 877             float x = (float) vh.get();
 878             assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
 879         }
 880 
 881     }
 882 
 883     static void testStaticFieldUnsupported(VarHandle vh) {
 884 
 885 
 886         checkUOE(() -> {
 887             float o = (float) vh.getAndBitwiseOr(1.0f);
 888         });
 889 
 890         checkUOE(() -> {
 891             float o = (float) vh.getAndBitwiseOrAcquire(1.0f);
 892         });
 893 
 894         checkUOE(() -> {
 895             float o = (float) vh.getAndBitwiseOrRelease(1.0f);
 896         });
 897 
 898         checkUOE(() -> {
 899             float o = (float) vh.getAndBitwiseAnd(1.0f);
 900         });
 901 
 902         checkUOE(() -> {
 903             float o = (float) vh.getAndBitwiseAndAcquire(1.0f);
 904         });
 905 
 906         checkUOE(() -> {
 907             float o = (float) vh.getAndBitwiseAndRelease(1.0f);
 908         });
 909 
 910         checkUOE(() -> {
 911             float o = (float) vh.getAndBitwiseXor(1.0f);
 912         });
 913 
 914         checkUOE(() -> {
 915             float o = (float) vh.getAndBitwiseXorAcquire(1.0f);
 916         });
 917 
 918         checkUOE(() -> {
 919             float o = (float) vh.getAndBitwiseXorRelease(1.0f);
 920         });
 921     }
 922 
 923 
 924     static void testArray(VarHandle vh) {
 925         float[] array = new float[10];
 926 
 927         for (int i = 0; i < array.length; i++) {
 928             // Plain
 929             {
 930                 vh.set(array, i, 1.0f);
 931                 float x = (float) vh.get(array, i);
 932                 assertEquals(x, 1.0f, "get float value");
 933             }
 934 
 935 
 936             // Volatile
 937             {
 938                 vh.setVolatile(array, i, 2.0f);
 939                 float x = (float) vh.getVolatile(array, i);
 940                 assertEquals(x, 2.0f, "setVolatile float value");
 941             }
 942 
 943             // Lazy
 944             {
 945                 vh.setRelease(array, i, 1.0f);
 946                 float x = (float) vh.getAcquire(array, i);
 947                 assertEquals(x, 1.0f, "setRelease float value");
 948             }
 949 
 950             // Opaque
 951             {
 952                 vh.setOpaque(array, i, 2.0f);
 953                 float x = (float) vh.getOpaque(array, i);
 954                 assertEquals(x, 2.0f, "setOpaque float value");
 955             }
 956 
 957             vh.set(array, i, 1.0f);
 958 
 959             // Compare
 960             {
 961                 boolean r = vh.compareAndSet(array, i, 1.0f, 2.0f);
 962                 assertEquals(r, true, "success compareAndSet float");
 963                 float x = (float) vh.get(array, i);
 964                 assertEquals(x, 2.0f, "success compareAndSet float value");
 965             }
 966 
 967             {
 968                 boolean r = vh.compareAndSet(array, i, 1.0f, 3.0f);
 969                 assertEquals(r, false, "failing compareAndSet float");
 970                 float x = (float) vh.get(array, i);
 971                 assertEquals(x, 2.0f, "failing compareAndSet float value");
 972             }
 973 
 974             {
 975                 float r = (float) vh.compareAndExchange(array, i, 2.0f, 1.0f);
 976                 assertEquals(r, 2.0f, "success compareAndExchange float");
 977                 float x = (float) vh.get(array, i);
 978                 assertEquals(x, 1.0f, "success compareAndExchange float value");
 979             }
 980 
 981             {
 982                 float r = (float) vh.compareAndExchange(array, i, 2.0f, 3.0f);
 983                 assertEquals(r, 1.0f, "failing compareAndExchange float");
 984                 float x = (float) vh.get(array, i);
 985                 assertEquals(x, 1.0f, "failing compareAndExchange float value");
 986             }
 987 
 988             {
 989                 float r = (float) vh.compareAndExchangeAcquire(array, i, 1.0f, 2.0f);
 990                 assertEquals(r, 1.0f, "success compareAndExchangeAcquire float");
 991                 float x = (float) vh.get(array, i);
 992                 assertEquals(x, 2.0f, "success compareAndExchangeAcquire float value");
 993             }
 994 
 995             {
 996                 float r = (float) vh.compareAndExchangeAcquire(array, i, 1.0f, 3.0f);
 997                 assertEquals(r, 2.0f, "failing compareAndExchangeAcquire float");
 998                 float x = (float) vh.get(array, i);
 999                 assertEquals(x, 2.0f, "failing compareAndExchangeAcquire float value");
1000             }
1001 
1002             {
1003                 float r = (float) vh.compareAndExchangeRelease(array, i, 2.0f, 1.0f);
1004                 assertEquals(r, 2.0f, "success compareAndExchangeRelease float");
1005                 float x = (float) vh.get(array, i);
1006                 assertEquals(x, 1.0f, "success compareAndExchangeRelease float value");
1007             }
1008 
1009             {
1010                 float r = (float) vh.compareAndExchangeRelease(array, i, 2.0f, 3.0f);
1011                 assertEquals(r, 1.0f, "failing compareAndExchangeRelease float");
1012                 float x = (float) vh.get(array, i);
1013                 assertEquals(x, 1.0f, "failing compareAndExchangeRelease float value");
1014             }
1015 
1016             {
1017                 boolean success = false;
1018                 for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
1019                     success = vh.weakCompareAndSetPlain(array, i, 1.0f, 2.0f);
1020                 }
1021                 assertEquals(success, true, "weakCompareAndSetPlain float");
1022                 float x = (float) vh.get(array, i);
1023                 assertEquals(x, 2.0f, "weakCompareAndSetPlain float value");
1024             }
1025 
1026             {
1027                 boolean success = false;
1028                 for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
1029                     success = vh.weakCompareAndSetAcquire(array, i, 2.0f, 1.0f);
1030                 }
1031                 assertEquals(success, true, "weakCompareAndSetAcquire float");
1032                 float x = (float) vh.get(array, i);
1033                 assertEquals(x, 1.0f, "weakCompareAndSetAcquire float");
1034             }
1035 
1036             {
1037                 boolean success = false;
1038                 for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
1039                     success = vh.weakCompareAndSetRelease(array, i, 1.0f, 2.0f);
1040                 }
1041                 assertEquals(success, true, "weakCompareAndSetRelease float");
1042                 float x = (float) vh.get(array, i);
1043                 assertEquals(x, 2.0f, "weakCompareAndSetRelease float");
1044             }
1045 
1046             {
1047                 boolean success = false;
1048                 for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
1049                     success = vh.weakCompareAndSet(array, i, 2.0f, 1.0f);
1050                 }
1051                 assertEquals(success, true, "weakCompareAndSet float");
1052                 float x = (float) vh.get(array, i);
1053                 assertEquals(x, 1.0f, "weakCompareAndSet float");
1054             }
1055 
1056             // Compare set and get
1057             {
1058                 vh.set(array, i, 1.0f);
1059 
1060                 float o = (float) vh.getAndSet(array, i, 2.0f);
1061                 assertEquals(o, 1.0f, "getAndSet float");
1062                 float x = (float) vh.get(array, i);
1063                 assertEquals(x, 2.0f, "getAndSet float value");
1064             }
1065 
1066             {
1067                 vh.set(array, i, 1.0f);
1068 
1069                 float o = (float) vh.getAndSetAcquire(array, i, 2.0f);
1070                 assertEquals(o, 1.0f, "getAndSetAcquire float");
1071                 float x = (float) vh.get(array, i);
1072                 assertEquals(x, 2.0f, "getAndSetAcquire float value");
1073             }
1074 
1075             {
1076                 vh.set(array, i, 1.0f);
1077 
1078                 float o = (float) vh.getAndSetRelease(array, i, 2.0f);
1079                 assertEquals(o, 1.0f, "getAndSetRelease float");
1080                 float x = (float) vh.get(array, i);
1081                 assertEquals(x, 2.0f, "getAndSetRelease float value");
1082             }
1083 
1084             // get and add, add and get
1085             {
1086                 vh.set(array, i, 1.0f);
1087 
1088                 float o = (float) vh.getAndAdd(array, i, 2.0f);
1089                 assertEquals(o, 1.0f, "getAndAdd float");
1090                 float x = (float) vh.get(array, i);
1091                 assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value");
1092             }
1093 
1094             {
1095                 vh.set(array, i, 1.0f);
1096 
1097                 float o = (float) vh.getAndAddAcquire(array, i, 2.0f);
1098                 assertEquals(o, 1.0f, "getAndAddAcquire float");
1099                 float x = (float) vh.get(array, i);
1100                 assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
1101             }
1102 
1103             {
1104                 vh.set(array, i, 1.0f);
1105 
1106                 float o = (float) vh.getAndAddRelease(array, i, 2.0f);
1107                 assertEquals(o, 1.0f, "getAndAddReleasefloat");
1108                 float x = (float) vh.get(array, i);
1109                 assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
1110             }
1111 
1112         }
1113     }
1114 
1115     static void testArrayUnsupported(VarHandle vh) {
1116         float[] array = new float[10];
1117 
1118         int i = 0;
1119 
1120 
1121         checkUOE(() -> {
1122             float o = (float) vh.getAndBitwiseOr(array, i, 1.0f);
1123         });
1124 
1125         checkUOE(() -> {
1126             float o = (float) vh.getAndBitwiseOrAcquire(array, i, 1.0f);
1127         });
1128 
1129         checkUOE(() -> {
1130             float o = (float) vh.getAndBitwiseOrRelease(array, i, 1.0f);
1131         });
1132 
1133         checkUOE(() -> {
1134             float o = (float) vh.getAndBitwiseAnd(array, i, 1.0f);
1135         });
1136 
1137         checkUOE(() -> {
1138             float o = (float) vh.getAndBitwiseAndAcquire(array, i, 1.0f);
1139         });
1140 
1141         checkUOE(() -> {
1142             float o = (float) vh.getAndBitwiseAndRelease(array, i, 1.0f);
1143         });
1144 
1145         checkUOE(() -> {
1146             float o = (float) vh.getAndBitwiseXor(array, i, 1.0f);
1147         });
1148 
1149         checkUOE(() -> {
1150             float o = (float) vh.getAndBitwiseXorAcquire(array, i, 1.0f);
1151         });
1152 
1153         checkUOE(() -> {
1154             float o = (float) vh.getAndBitwiseXorRelease(array, i, 1.0f);
1155         });
1156     }
1157 
1158     static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable {
1159         float[] array = new float[10];
1160 
1161         for (int i : new int[]{-1, Integer.MIN_VALUE, 10, 11, Integer.MAX_VALUE}) {
1162             final int ci = i;
1163 
1164             checkIOOBE(() -> {
1165                 float x = (float) vh.get(array, ci);
1166             });
1167 
1168             checkIOOBE(() -> {
1169                 vh.set(array, ci, 1.0f);
1170             });
1171 
1172             checkIOOBE(() -> {
1173                 float x = (float) vh.getVolatile(array, ci);
1174             });
1175 
1176             checkIOOBE(() -> {
1177                 vh.setVolatile(array, ci, 1.0f);
1178             });
1179 
1180             checkIOOBE(() -> {
1181                 float x = (float) vh.getAcquire(array, ci);
1182             });
1183 
1184             checkIOOBE(() -> {
1185                 vh.setRelease(array, ci, 1.0f);
1186             });
1187 
1188             checkIOOBE(() -> {
1189                 float x = (float) vh.getOpaque(array, ci);
1190             });
1191 
1192             checkIOOBE(() -> {
1193                 vh.setOpaque(array, ci, 1.0f);
1194             });
1195 
1196             checkIOOBE(() -> {
1197                 boolean r = vh.compareAndSet(array, ci, 1.0f, 2.0f);
1198             });
1199 
1200             checkIOOBE(() -> {
1201                 float r = (float) vh.compareAndExchange(array, ci, 2.0f, 1.0f);
1202             });
1203 
1204             checkIOOBE(() -> {
1205                 float r = (float) vh.compareAndExchangeAcquire(array, ci, 2.0f, 1.0f);
1206             });
1207 
1208             checkIOOBE(() -> {
1209                 float r = (float) vh.compareAndExchangeRelease(array, ci, 2.0f, 1.0f);
1210             });
1211 
1212             checkIOOBE(() -> {
1213                 boolean r = vh.weakCompareAndSetPlain(array, ci, 1.0f, 2.0f);
1214             });
1215 
1216             checkIOOBE(() -> {
1217                 boolean r = vh.weakCompareAndSet(array, ci, 1.0f, 2.0f);
1218             });
1219 
1220             checkIOOBE(() -> {
1221                 boolean r = vh.weakCompareAndSetAcquire(array, ci, 1.0f, 2.0f);
1222             });
1223 
1224             checkIOOBE(() -> {
1225                 boolean r = vh.weakCompareAndSetRelease(array, ci, 1.0f, 2.0f);
1226             });
1227 
1228             checkIOOBE(() -> {
1229                 float o = (float) vh.getAndSet(array, ci, 1.0f);
1230             });
1231 
1232             checkIOOBE(() -> {
1233                 float o = (float) vh.getAndSetAcquire(array, ci, 1.0f);
1234             });
1235 
1236             checkIOOBE(() -> {
1237                 float o = (float) vh.getAndSetRelease(array, ci, 1.0f);
1238             });
1239 
1240             checkIOOBE(() -> {
1241                 float o = (float) vh.getAndAdd(array, ci, 1.0f);
1242             });
1243 
1244             checkIOOBE(() -> {
1245                 float o = (float) vh.getAndAddAcquire(array, ci, 1.0f);
1246             });
1247 
1248             checkIOOBE(() -> {
1249                 float o = (float) vh.getAndAddRelease(array, ci, 1.0f);
1250             });
1251 
1252         }
1253     }
1254 
1255 }
1256