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