changeset 317:162fe8f8a34c

Chapter 1.b: Sync up with VarHandles API, at JDK 9b135.
author shade
date Fri, 16 Sep 2016 13:00:41 +0200
parents 5938d81bff44
children 3040c983b52c
files jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter1bTestGenerator.java jcstress-test-gen/src/main/resources/operationAtomic/arrays/X-AddAndGetTest.java.template jcstress-test-gen/src/main/resources/operationAtomic/byteArray/X-AddAndGetTest.java.template jcstress-test-gen/src/main/resources/operationAtomic/byteBuffer/X-AddAndGetTest.java.template jcstress-test-gen/src/main/resources/operationAtomic/fields/X-AddAndGetTest.java.template
diffstat 5 files changed, 31 insertions(+), 381 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter1bTestGenerator.java	Fri Sep 16 12:37:26 2016 +0200
+++ b/jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter1bTestGenerator.java	Fri Sep 16 13:00:41 2016 +0200
@@ -27,6 +27,7 @@
 
 import static java.util.Map.entry;
 import static java.util.Set.of;
+import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.*;
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Source.DATA_SOURCE;
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Source.VIEW_SOURCE;
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.*;
@@ -37,26 +38,6 @@
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Type.LONG;
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Type.FLOAT;
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Type.DOUBLE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Type.STRING;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.Get;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.GetVolatile;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.GetOpaque;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.GetAcquire;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.Set;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.SetVolatile;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.SetOpaque;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.SetRelease;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.GetAndAdd;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.AddAndGet;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.CompareAndSet;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.CompareAndExchangeVolatile;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.CompareAndExchangeAcquire;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.CompareAndExchangeRelease;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.WeakCompareAndSet;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.WeakCompareAndSetAcquire;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.WeakCompareAndSetRelease;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.WeakCompareAndSetVolatile;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.GetAndSet;
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.Type.GET_SET;
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.Type.ATOMIC_UPDATE;
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.Type.NUMERIC_ATOMIC_UPDATE;
@@ -386,18 +367,19 @@
         SetRelease(GET_SET),
 
         CompareAndSet(ATOMIC_UPDATE),
-        CompareAndExchangeVolatile(ATOMIC_UPDATE),
+
+        CompareAndExchange(ATOMIC_UPDATE),
         CompareAndExchangeAcquire(ATOMIC_UPDATE),
         CompareAndExchangeRelease(ATOMIC_UPDATE),
 
         WeakCompareAndSet(ATOMIC_UPDATE),
         WeakCompareAndSetAcquire(ATOMIC_UPDATE),
         WeakCompareAndSetRelease(ATOMIC_UPDATE),
-        WeakCompareAndSetVolatile(ATOMIC_UPDATE),
+        WeakCompareAndSetPlain(ATOMIC_UPDATE),
+
         GetAndSet(ATOMIC_UPDATE),
-
         GetAndAdd(NUMERIC_ATOMIC_UPDATE),
-        AddAndGet(NUMERIC_ATOMIC_UPDATE);
+        ;
 
         Method(Type type) {
             this.type = type;
@@ -413,11 +395,6 @@
     private static final String LNSEP = System.getProperty("line.separator");
 
     enum Target {
-        T_ADDANDGET(
-                "%AddAndGet<(.+)>%",
-                of(ADDANDGET)
-        ),
-
         T_GETANDADD(
                 "%GetAndAdd<(.+)>%",
                 of(GETANDADD)
@@ -430,7 +407,7 @@
 
         T_CAE(
                 "%CAE<(.+), (.+)>%",
-                of(COMPAREANDEXCHANGEVOLATILE, COMPAREANDEXCHANGERELEASE, COMPAREANDEXCHANGEACQUIRE)
+                of(COMPAREANDEXCHANGE, COMPAREANDEXCHANGERELEASE, COMPAREANDEXCHANGEACQUIRE)
         ),
 
         T_CAS(
@@ -440,12 +417,12 @@
 
         T_WEAKCAS(
                 "%WeakCAS<(.+), (.+)>%",
-                of(WEAKCOMPAREANDSETRELEASE, WEAKCOMPAREANDSETACQUIRE, WEAKCOMPAREANDSET, WEAKCOMPAREANDSETVOLATILE)
+                of(WEAKCOMPAREANDSET, WEAKCOMPAREANDSETRELEASE, WEAKCOMPAREANDSETACQUIRE, WEAKCOMPAREANDSETPLAIN)
         ),
 
         T_GET(
                 "%Get<>%",
-                of(GET, COMPAREANDEXCHANGERELEASE_FAIL, WEAKCOMPAREANDSET_RETURN, WEAKCOMPAREANDSETRELEASE_RETURN)
+                of(GET, COMPAREANDEXCHANGERELEASE_FAIL, WEAKCOMPAREANDSETPLAIN_RETURN, WEAKCOMPAREANDSETRELEASE_RETURN)
         ),
 
         T_SET(
@@ -488,9 +465,9 @@
                     CompareAndSet
             ),
 
-            COMPAREANDEXCHANGEVOLATILE_SUC(
+            COMPAREANDEXCHANGE_SUC(
                     "vh.compareAndExchange(\\$object\\$\\$index_para\\$, \\$valueLiteral0\\$, $1);",
-                    CompareAndExchangeVolatile
+                    CompareAndExchange
             ),
 
             COMPAREANDEXCHANGERELEASE_SUC(
@@ -503,14 +480,9 @@
                     WeakCompareAndSetRelease
             ),
 
-            WEAKCOMPAREANDSETVOLATILE_SUC(
-                    "vh.weakCompareAndSetVolatile(\\$object\\$\\$index_para\\$, \\$valueLiteral0\\$, $1);",
-                    WeakCompareAndSetVolatile
-            ),
-
-            ADDANDGET(
-                    "vh.addAndGet(\\$object\\$\\$index_para\\$, $1);",
-                    AddAndGet
+            WEAKCOMPAREANDSET_SUC(
+                    "vh.weakCompareAndSet(\\$object\\$\\$index_para\\$, \\$valueLiteral0\\$, $1);",
+                    WeakCompareAndSet
             ),
 
             GETANDADD(
@@ -538,11 +510,6 @@
                     CompareAndSet
             ),
 
-            ADDANDGET_ZERO(
-                    "(\\$type\\$) vh.addAndGet(\\$object\\$\\$index_para\\$, 0);",
-                    AddAndGet
-            ),
-
             GETANDADD_ZERO(
                     "(\\$type\\$) vh.getAndAdd(\\$object\\$\\$index_para\\$, 0);",
                     GetAndAdd
@@ -553,9 +520,9 @@
                     GetAndSet
             ),
 
-            COMPAREANDEXCHANGEVOLATILE(
+            COMPAREANDEXCHANGE(
                     "(\\$type\\$) vh.compareAndExchange(\\$object\\$\\$index_para\\$, $1, $2);",
-                    CompareAndExchangeVolatile
+                    CompareAndExchange
             ),
 
             COMPAREANDEXCHANGERELEASE(
@@ -573,9 +540,9 @@
                     CompareAndSet
             ),
 
-            WEAKCOMPAREANDSETRELEASE(
-                    "vh.weakCompareAndSetRelease(\\$object\\$\\$index_para\\$, $1, $2);",
-                    WeakCompareAndSetRelease
+            WEAKCOMPAREANDSET(
+                    "vh.weakCompareAndSet(\\$object\\$\\$index_para\\$, $1, $2);",
+                    WeakCompareAndSet
             ),
 
             WEAKCOMPAREANDSETACQUIRE(
@@ -583,14 +550,14 @@
                     WeakCompareAndSetAcquire
             ),
 
-            WEAKCOMPAREANDSET(
-                    "vh.weakCompareAndSet(\\$object\\$\\$index_para\\$, $1, $2);",
-                    WeakCompareAndSet
+            WEAKCOMPAREANDSETRELEASE(
+                    "vh.weakCompareAndSetRelease(\\$object\\$\\$index_para\\$, $1, $2);",
+                    WeakCompareAndSetRelease
             ),
 
-            WEAKCOMPAREANDSETVOLATILE(
-                    "vh.weakCompareAndSetVolatile(\\$object\\$\\$index_para\\$, $1, $2);",
-                    WeakCompareAndSetVolatile
+            WEAKCOMPAREANDSETPLAIN(
+                    "vh.weakCompareAndSetPlain(\\$object\\$\\$index_para\\$, $1, $2);",
+                    WeakCompareAndSetPlain
             ),
 
             SET(
@@ -598,9 +565,9 @@
                     Set
             ),
 
-            WEAKCOMPAREANDSET_SUC(
-                    "vh.weakCompareAndSet(\\$object\\$\\$index_para\\$, \\$valueLiteral0\\$, $1);",
-                    WeakCompareAndSet
+            WEAKCOMPAREANDSETPLAIN_SUC(
+                    "vh.weakCompareAndSetPlain(\\$object\\$\\$index_para\\$, \\$valueLiteral0\\$, $1);",
+                    WeakCompareAndSetPlain
             ),
 
             COMPAREANDEXCHANGEACQUIRE_SUC(
@@ -623,9 +590,9 @@
                     CompareAndExchangeRelease
             ),
 
-            WEAKCOMPAREANDSET_RETURN(
-                    "vh.weakCompareAndSet(\\$object\\$\\$index_para\\$, \\$valueLiteral1\\$, \\$valueLiteral3\\$) ? \\$valueLiteral1\\$ : \\$valueLiteral0\\$;",
-                    WeakCompareAndSet
+            WEAKCOMPAREANDSETPLAIN_RETURN(
+                    "vh.weakCompareAndSetPlain(\\$object\\$\\$index_para\\$, \\$valueLiteral1\\$, \\$valueLiteral3\\$) ? \\$valueLiteral1\\$ : \\$valueLiteral0\\$;",
+                    WeakCompareAndSetPlain
             ),
 
             WEAKCOMPAREANDSETRELEASE_RETURN(
@@ -674,7 +641,6 @@
     }
 
     private static final Map<String, Target> TEMPLATES = Map.ofEntries(
-            entry("X-AddAndGetTest", T_ADDANDGET),
             entry("X-CAETest", T_CAE),
             entry("X-CASTest", T_CAS),
             entry("X-GetAndAddTest", T_GETANDADD),
--- a/jcstress-test-gen/src/main/resources/operationAtomic/arrays/X-AddAndGetTest.java.template	Fri Sep 16 12:37:26 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import static java.nio.ByteOrder.BIG_ENDIAN;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
-import java.util.Random;
-import java.nio.ByteBuffer;
-
-import org.openjdk.jcstress.annotations.Actor;
-import org.openjdk.jcstress.annotations.Arbiter;
-import org.openjdk.jcstress.annotations.Expect;
-import org.openjdk.jcstress.annotations.JCStressTest;
-import org.openjdk.jcstress.annotations.Outcome;
-import org.openjdk.jcstress.annotations.State;
-import org.openjdk.jcstress.annotations.Description;
-import org.openjdk.jcstress.infra.results.$Type$Result3;
-
-
-@JCStressTest
-@Description("Tests atomicity of addAndGet.")
-@Outcome(id = "$value2$, $value1$, $value2$", expect = Expect.ACCEPTABLE,  desc = "actor1 execute after actor2")
-@Outcome(id = "$value1$, $value2$, $value2$", expect = Expect.ACCEPTABLE,  desc = "actor1 execute before actor2")
-@Outcome(id = "$value1$, $value1$, $value1$", expect = Expect.FORBIDDEN, desc = "This won't happen because addAndGet is atomic")
-@State
-public class $TestClassName$ {
-
-    $type$[] array = new $type$[1];
-
-    static final VarHandle vh;
-
-    static {
-        try {
-            vh = MethodHandles.arrayElementVarHandle($type$[].class);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    @Actor
-    public void actor1($Type$Result3 r) {
-        r.r1 = ($type$) %AddAndGet<$valueLiteral1$>%
-    }
-
-    @Actor
-    public void actor2($Type$Result3 r) {
-        r.r2 = ($type$) %AddAndGet<$valueLiteral1$>%
-    }
-
-    @Arbiter
-    public void arbiter1($Type$Result3 r) {
-        r.r3 = array[0];
-    }
-
-}
\ No newline at end of file
--- a/jcstress-test-gen/src/main/resources/operationAtomic/byteArray/X-AddAndGetTest.java.template	Fri Sep 16 12:37:26 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
-import java.util.Random;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.openjdk.jcstress.annotations.Actor;
-import org.openjdk.jcstress.annotations.Arbiter;
-import org.openjdk.jcstress.annotations.Expect;
-import org.openjdk.jcstress.annotations.JCStressTest;
-import org.openjdk.jcstress.annotations.Outcome;
-import org.openjdk.jcstress.annotations.State;
-import org.openjdk.jcstress.annotations.Description;
-import org.openjdk.jcstress.infra.results.$Type$Result3;
-
-
-@JCStressTest
-@Description("Tests atomicity of addAndGet.")
-@Outcome(id = "$value2$, $value1$, $value2$", expect = Expect.ACCEPTABLE,  desc = "actor1 execute after actor2")
-@Outcome(id = "$value1$, $value2$, $value2$", expect = Expect.ACCEPTABLE,  desc = "actor1 execute before actor2")
-@Outcome(id = "$value1$, $value1$, $value1$", expect = Expect.FORBIDDEN, desc = "This won't happen because addAndGet is atomic")
-@State
-public class $TestClassName$ {
-
-    static final int OFF = ByteBuffer.wrap(new byte[128]).alignmentOffset(0, 8);
-
-    static final VarHandle vh;
-
-    static {
-        try {
-            vh = MethodHandles.byteArrayViewVarHandle($type$[].class, ByteOrder.$byte_order$);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    byte[] byteArray = new byte[OFF + 8];
-
-    @Actor
-    public void actor1($Type$Result3 r) {
-        r.r1 = ($type$) %AddAndGet<$valueLiteral1$>%
-    }
-
-    @Actor
-    public void actor2($Type$Result3 r) {
-        r.r2 = ($type$) %AddAndGet<$valueLiteral1$>%
-    }
-
-    @Arbiter
-    public void arbiter1($Type$Result3 r) {
-        r.r3 = ($type$) vh.get(byteArray, OFF);
-    }
-
-}
\ No newline at end of file
--- a/jcstress-test-gen/src/main/resources/operationAtomic/byteBuffer/X-AddAndGetTest.java.template	Fri Sep 16 12:37:26 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
-import java.util.Random;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.openjdk.jcstress.annotations.Actor;
-import org.openjdk.jcstress.annotations.Arbiter;
-import org.openjdk.jcstress.annotations.Expect;
-import org.openjdk.jcstress.annotations.JCStressTest;
-import org.openjdk.jcstress.annotations.Outcome;
-import org.openjdk.jcstress.annotations.State;
-import org.openjdk.jcstress.annotations.Description;
-import org.openjdk.jcstress.infra.results.$Type$Result3;
-
-
-@JCStressTest
-@Description("Tests atomicity of addAndGet.")
-@Outcome(id = "$value2$, $value1$, $value2$", expect = Expect.ACCEPTABLE,  desc = "actor1 execute after actor2")
-@Outcome(id = "$value1$, $value2$, $value2$", expect = Expect.ACCEPTABLE,  desc = "actor1 execute before actor2")
-@Outcome(id = "$value1$, $value1$, $value1$", expect = Expect.FORBIDDEN, desc = "This won't happen because addAndGet is atomic")
-@State
-public class $TestClassName$ {
-
-    static final int OFF = $buffer_allocate$(128).alignmentOffset(0, 8);
-
-    static final VarHandle vh;
-
-    static {
-        try {
-            vh = MethodHandles.byteBufferViewVarHandle($type$[].class, ByteOrder.$byte_order$);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    ByteBuffer byteBuffer = $buffer_allocate$(OFF + 8);
-
-    @Actor
-    public void actor1($Type$Result3 r) {
-        r.r1 = ($type$) %AddAndGet<$valueLiteral1$>%
-    }
-
-    @Actor
-    public void actor2($Type$Result3 r) {
-        r.r2 = ($type$) %AddAndGet<$valueLiteral1$>%
-    }
-
-    @Arbiter
-    public void arbiter1($Type$Result3 r) {
-        r.r3 = ($type$) vh.get(byteBuffer, OFF);
-    }
-
-}
\ No newline at end of file
--- a/jcstress-test-gen/src/main/resources/operationAtomic/fields/X-AddAndGetTest.java.template	Fri Sep 16 12:37:26 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import static java.nio.ByteOrder.BIG_ENDIAN;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
-import java.util.Random;
-import java.nio.ByteBuffer;
-
-import org.openjdk.jcstress.annotations.Actor;
-import org.openjdk.jcstress.annotations.Arbiter;
-import org.openjdk.jcstress.annotations.Expect;
-import org.openjdk.jcstress.annotations.JCStressTest;
-import org.openjdk.jcstress.annotations.Outcome;
-import org.openjdk.jcstress.annotations.State;
-import org.openjdk.jcstress.annotations.Description;
-import org.openjdk.jcstress.infra.results.$Type$Result3;
-
-
-@JCStressTest
-@Description("Tests atomicity of addAndGet.")
-@Outcome(id = "$value2$, $value1$, $value2$", expect = Expect.ACCEPTABLE,  desc = "actor1 execute after actor2")
-@Outcome(id = "$value1$, $value2$, $value2$", expect = Expect.ACCEPTABLE,  desc = "actor1 execute before actor2")
-@Outcome(id = "$value1$, $value1$, $value1$", expect = Expect.FORBIDDEN, desc = "This won't happen because addAndGet is atomic")
-@State
-public class $TestClassName$ {
-
-    $type$ field;
-
-    static final VarHandle vh;
-
-    static {
-        try {
-            vh = MethodHandles.lookup().findVarHandle($TestClassName$.class, "field", $type$.class);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-    
-    @Actor
-    public void actor1($Type$Result3 r) {
-        r.r1 = ($type$) %AddAndGet<$valueLiteral1$>%
-    }
-    
-    @Actor
-    public void actor2($Type$Result3 r) {
-        r.r2 = ($type$) %AddAndGet<$valueLiteral1$>%
-    }
-
-    @Arbiter 
-    public void arbiter1($Type$Result3 r) {
-        r.r3 = field;
-    }
-
-}
\ No newline at end of file