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