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