changeset 293:3a067ac9ecac

Chapter 1.b: Fences tests should only use fences, not the operations (which have more relaxed semantics).
author shade
date Fri, 10 Jun 2016 13:51:01 +0300
parents 1be98bc60f39
children 806179cda48d
files jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter1bTestGenerator.java jcstress-test-gen/src/main/resources/chapter1b/arrays/StoreLoadFenceTestWeak.java.template jcstress-test-gen/src/main/resources/chapter1b/arrays/StoreStoreFenceTest2Weak.java.template jcstress-test-gen/src/main/resources/chapter1b/byteArray/StoreLoadFenceTestWeak.java.template jcstress-test-gen/src/main/resources/chapter1b/byteArray/StoreStoreFenceTest2Weak.java.template jcstress-test-gen/src/main/resources/chapter1b/byteBuffer/StoreStoreFenceTest2Weak.java.template jcstress-test-gen/src/main/resources/chapter1b/fields/StoreLoadFenceTestWeak.java.template jcstress-test-gen/src/main/resources/chapter1b/fields/StoreStoreFenceTest2Weak.java.template
diffstat 8 files changed, 99 insertions(+), 850 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter1bTestGenerator.java	Fri Jun 10 10:56:33 2016 +0300
+++ b/jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter1bTestGenerator.java	Fri Jun 10 13:51:01 2016 +0300
@@ -29,6 +29,8 @@
 import static java.util.Set.of;
 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.*;
+import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.*;
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Type.SHORT;
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Type.CHAR;
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Type.INT;
@@ -64,69 +66,9 @@
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.Type.STATIC_FENCE;
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.Type.ATOMIC_UPDATE;
 import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Method.Type.NUMERIC_ATOMIC_UPDATE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.T_ADDANDGET;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.T_GETANDADD;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.T_GETANDSET;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.T_CAE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.T_CAS;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.T_WEAKCAS;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.T_GETLOADLOADFENCE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.T_LOADSTOREFENCESET;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.T_GETLOADSTOREFENCE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.T_STORESTOREFENCESET;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.T_SETSTORESTOREFENCE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.T_SETSTORELOADFENCE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.T_WEAKSETSTORELOADFENCE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.T_WEAKSETSTORESTOREFENCE;
 
 import org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation;
 
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.SETVOLATILE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.SETRELEASE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.RELEASEFENCE_SET;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.FULLFENCE_SET;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.COMPAREANDSET_SUC;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.COMPAREANDEXCHANGEVOLATILE_SUC;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.COMPAREANDEXCHANGERELEASE_SUC;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.WEAKCOMPAREANDSETRELEASE_SUC;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.WEAKCOMPAREANDSETVOLATILE_SUC;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.ADDANDGET;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.GETANDADD;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.GETANDSET;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.STORESTOREFENCE_SET;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.GETVOLATILE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.GETACQUIRE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.GET_ACQUIREFENCE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.GET_FULLFENCE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.GET_COMPAREANDSET_FAIL;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.COMPAREANDEXCHANGEVOLATILE_FAIL;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.COMPAREANDEXCHANGEACQUIRE_FAIL;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.WEAKCOMPAREANDSETACQUIRE_FAIL;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.WEAKCOMPAREANDSETVOLATILE_FAIL;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.ADDANDGET_ZERO;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.GETANDADD_ZERO;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.GETANDSET_OUT;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.GET_LOADLOADFENCE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.SET_FULLFENCE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.COMPAREANDEXCHANGEVOLATILE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.COMPAREANDEXCHANGERELEASE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.COMPAREANDEXCHANGEACQUIRE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.COMPAREANDSET;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.WEAKCOMPAREANDSETRELEASE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.WEAKCOMPAREANDSETACQUIRE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.WEAKCOMPAREANDSET;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.WEAKCOMPAREANDSETVOLATILE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.SET;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.WEAKCOMPAREANDSET_SUC;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.COMPAREANDEXCHANGEACQUIRE_SUC;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.WEAKCOMPAREANDSETACQUIRE_SUC;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.GET;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.COMPAREANDEXCHANGERELEASE_FAIL;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.WEAKCOMPAREANDSET_RETURN;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.WEAKCOMPAREANDSETRELEASE_RETURN;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.SETOPAQUE;
-import static org.openjdk.jcstress.chapters.Chapter1bTestGenerator.Target.Operation.GETOPAQUE;
-
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
@@ -511,60 +453,6 @@
                 of(WEAKCOMPAREANDSETRELEASE, WEAKCOMPAREANDSETACQUIRE, WEAKCOMPAREANDSET, WEAKCOMPAREANDSETVOLATILE)
         ),
 
-        T_GETLOADLOADFENCE(
-                "%GetLoadLoadFence<>%",
-                of(GETVOLATILE, GETACQUIRE, GET_ACQUIREFENCE, GET_LOADLOADFENCE,
-                        GET_FULLFENCE, GET_COMPAREANDSET_FAIL, COMPAREANDEXCHANGEVOLATILE_FAIL,
-                        COMPAREANDEXCHANGEACQUIRE_FAIL, WEAKCOMPAREANDSETACQUIRE_FAIL,
-                        WEAKCOMPAREANDSETVOLATILE_FAIL, ADDANDGET_ZERO, GETANDADD_ZERO, GETANDSET_OUT)
-        ),
-
-        T_LOADSTOREFENCESET(
-                "%LoadStoreFenceSet<(.+)>%",
-                of(SETVOLATILE, SETRELEASE, RELEASEFENCE_SET, FULLFENCE_SET, COMPAREANDSET_SUC,
-                        COMPAREANDEXCHANGEVOLATILE_SUC, COMPAREANDEXCHANGERELEASE_SUC,
-                        WEAKCOMPAREANDSETRELEASE_SUC, WEAKCOMPAREANDSETVOLATILE_SUC,
-                        ADDANDGET, GETANDADD, GETANDSET)
-        ),
-
-        T_GETLOADSTOREFENCE(
-                "%GetLoadStoreFence<>%",
-                of(GETVOLATILE, GETACQUIRE, GET_ACQUIREFENCE, GET_COMPAREANDSET_FAIL,
-                        COMPAREANDEXCHANGEVOLATILE_FAIL, COMPAREANDEXCHANGEACQUIRE_FAIL,
-                        WEAKCOMPAREANDSETACQUIRE_FAIL, WEAKCOMPAREANDSETVOLATILE_FAIL,
-                        ADDANDGET_ZERO, GETANDADD_ZERO, GETANDSET_OUT)
-        ),
-
-        T_STORESTOREFENCESET(
-                "%StoreStoreFenceSet<(.+)>%",
-                of(SETVOLATILE, SETRELEASE, RELEASEFENCE_SET, STORESTOREFENCE_SET,
-                        FULLFENCE_SET, COMPAREANDSET_SUC, COMPAREANDEXCHANGEVOLATILE_SUC,
-                        COMPAREANDEXCHANGERELEASE_SUC, WEAKCOMPAREANDSETRELEASE_SUC,
-                        WEAKCOMPAREANDSETVOLATILE_SUC,
-                        ADDANDGET, GETANDADD, GETANDSET)
-        ),
-
-        T_SETSTORESTOREFENCE(
-                "%SetStoreStoreFence<(.+)>%",
-                of(SETVOLATILE, COMPAREANDSET_SUC, COMPAREANDEXCHANGEVOLATILE_SUC,
-                        ADDANDGET, GETANDADD, GETANDSET)
-        ),
-
-        T_SETSTORELOADFENCE(
-                "%SetStoreLoadFence<(.+)>%",
-                of(SETVOLATILE, SET_FULLFENCE, COMPAREANDSET_SUC, COMPAREANDEXCHANGEVOLATILE_SUC,
-                        ADDANDGET, GETANDADD, GETANDSET)),
-
-        T_WEAKSETSTORELOADFENCE(
-                "%WeakSetStoreLoadFence<(.+)>%",
-                of(WEAKCOMPAREANDSETVOLATILE_SUC)
-        ),
-
-        T_WEAKSETSTORESTOREFENCE(
-                "%WeakSetStoreStoreFence<(.+)>%",
-                of(WEAKCOMPAREANDSETVOLATILE_SUC)
-        ),
-
         T_GET(
                 "%Get<>%",
                 of(GET, COMPAREANDEXCHANGERELEASE_FAIL, WEAKCOMPAREANDSET_RETURN, WEAKCOMPAREANDSETRELEASE_RETURN)
@@ -582,7 +470,39 @@
         T_GETOPAQUE(
                 "%GetOpaque<>%",
                 of(GETOPAQUE)
-        );
+        ),
+
+        T_GET_LOADLOADFENCE(
+                "%GetLoadLoadFence<>%",
+                of(GET_ACQUIREFENCE, GET_LOADLOADFENCE, GET_FULLFENCE)
+        ),
+
+        T_LOADSTOREFENCE_SET(
+                "%LoadStoreFenceSet<(.+)>%",
+                of(RELEASEFENCE_SET, FULLFENCE_SET)
+        ),
+
+        T_GET_LOADSTOREFENCE(
+                "%GetLoadStoreFence<>%",
+                of(GET_ACQUIREFENCE, GET_FULLFENCE)
+        ),
+
+        T_STORESTOREFENCE_SET(
+                "%StoreStoreFenceSet<(.+)>%",
+                of(RELEASEFENCE_SET, STORESTOREFENCE_SET, FULLFENCE_SET)
+        ),
+
+        T_SET_STORESTOREFENCE(
+                "%SetStoreStoreFence<(.+)>%",
+                of(SET_RELEASEFENCE, SET_STORESTOREFENCE, SET_FULLFENCE)
+        ),
+
+        T_SET_STORELOADFENCE(
+                "%SetStoreLoadFence<(.+)>%",
+                of(SET_FULLFENCE)
+        ),
+
+        ;
 
         Target(String target, Set<Operation> operations) {
             this.target = target;
@@ -603,16 +523,6 @@
                     SetRelease
             ),
 
-            RELEASEFENCE_SET(
-                    "VarHandle.releaseFence();" + LNSEP + "%SetVar<$1>%",
-                    ReleaseFence
-            ),
-
-            FULLFENCE_SET(
-                    "VarHandle.fullFence();" + LNSEP + "%SetVar<$1>%",
-                    FullFence
-            ),
-
             COMPAREANDSET_SUC(
                     "vh.compareAndSet(\\$object\\$\\$index_para\\$, \\$valueLiteral0\\$, $1);",
                     CompareAndSet
@@ -653,11 +563,6 @@
                     GetAndSet
             ),
 
-            STORESTOREFENCE_SET(
-                    "VarHandle.storeStoreFence();" + LNSEP + "%SetVar<$1>%",
-                    StoreStoreFence
-            ),
-
             GETVOLATILE(
                     "(\\$type\\$) vh.getVolatile(\\$object\\$\\$index_para\\$);",
                     GetVolatile
@@ -668,41 +573,11 @@
                     GetAcquire
             ),
 
-            GET_ACQUIREFENCE(
-                    "%GetVar%;" + LNSEP + "VarHandle.acquireFence();",
-                    AcquireFence
-            ),
-
-            GET_FULLFENCE(
-                    "%GetVar%;" + LNSEP + "VarHandle.fullFence();",
-                    FullFence
-            ),
-
             GET_COMPAREANDSET_FAIL(
                     "%GetVar%;" + LNSEP + "vh.compareAndSet(\\$object\\$\\$index_para\\$, \\$valueLiteral3\\$, \\$valueLiteral3\\$);",
                     CompareAndSet
             ),
 
-            COMPAREANDEXCHANGEVOLATILE_FAIL(
-                    "(\\$type\\$) vh.compareAndExchangeVolatile(\\$object\\$\\$index_para\\$, \\$valueLiteral3\\$, \\$valueLiteral3\\$);",
-                    CompareAndExchangeVolatile
-            ),
-
-            COMPAREANDEXCHANGEACQUIRE_FAIL(
-                    "(\\$type\\$) vh.compareAndExchangeAcquire(\\$object\\$\\$index_para\\$, \\$valueLiteral3\\$, \\$valueLiteral3\\$);",
-                    CompareAndExchangeAcquire
-            ),
-
-            WEAKCOMPAREANDSETACQUIRE_FAIL(
-                    "%GetVar%;" + LNSEP + "vh.weakCompareAndSetAcquire(\\$object\\$\\$index_para\\$, \\$valueLiteral3\\$, \\$valueLiteral3\\$);",
-                    WeakCompareAndSetAcquire
-            ),
-
-            WEAKCOMPAREANDSETVOLATILE_FAIL(
-                    "%GetVar%;" + LNSEP + "vh.weakCompareAndSetVolatile(\\$object\\$\\$index_para\\$, \\$valueLiteral3\\$, \\$valueLiteral3\\$);",
-                    WeakCompareAndSetVolatile
-            ),
-
             ADDANDGET_ZERO(
                     "(\\$type\\$) vh.addAndGet(\\$object\\$\\$index_para\\$, 0);",
                     AddAndGet
@@ -718,16 +593,6 @@
                     GetAndSet
             ),
 
-            GET_LOADLOADFENCE(
-                    "%GetVar%;" + LNSEP + "VarHandle.loadLoadFence();",
-                    LoadLoadFence
-            ),
-
-            SET_FULLFENCE(
-                    "%SetVar<$1>%" + LNSEP + "VarHandle.fullFence();",
-                    FullFence
-            ),
-
             COMPAREANDEXCHANGEVOLATILE(
                     "(\\$type\\$) vh.compareAndExchangeVolatile(\\$object\\$\\$index_para\\$, $1, $2);",
                     CompareAndExchangeVolatile
@@ -816,7 +681,61 @@
             GETOPAQUE(
                     "(\\$type\\$) vh.getOpaque(\\$object\\$\\$index_para\\$);",
                     GetOpaque
-            );
+            ),
+
+            /* -------------------------------- fences -------------------------------- */
+
+            GET_LOADLOADFENCE(
+                    "%GetVar%;" + LNSEP + "VarHandle.loadLoadFence();",
+                    LoadLoadFence
+            ),
+
+            STORESTOREFENCE_SET(
+                    "VarHandle.storeStoreFence();" + LNSEP + "%SetVar<$1>%",
+                    StoreStoreFence
+            ),
+
+            SET_STORESTOREFENCE(
+                    "%SetVar<$1>%" + LNSEP + "VarHandle.storeStoreFence();",
+                    StoreStoreFence
+            ),
+
+            GET_ACQUIREFENCE(
+                    "%GetVar%;" + LNSEP + "VarHandle.acquireFence();",
+                    AcquireFence
+            ),
+
+            RELEASEFENCE_SET(
+                    "VarHandle.releaseFence();" + LNSEP + "%SetVar<$1>%",
+                    ReleaseFence
+            ),
+
+            SET_RELEASEFENCE(
+                    "%SetVar<$1>%" + LNSEP + "VarHandle.releaseFence();",
+                    ReleaseFence
+            ),
+
+            SET_FULLFENCE(
+                    "%SetVar<$1>%" + LNSEP + "VarHandle.fullFence();",
+                    FullFence
+            ),
+
+            FULLFENCE_SET(
+                    "VarHandle.fullFence();" + LNSEP + "%SetVar<$1>%",
+                    FullFence
+            ),
+
+            GET_FULLFENCE(
+                    "%GetVar%;" + LNSEP + "VarHandle.fullFence();",
+                    FullFence
+            ),
+
+            FULLFENCE_GET(
+                    "VarHandle.fullFence();" + LNSEP + "%GetVar%;",
+                    FullFence
+            ),
+
+            ;
 
             Operation(String operation, Method method) {
                 this.operation = operation;
@@ -852,16 +771,16 @@
             entry("CASTest", T_CAS),
             entry("GetAndAddTest", T_GETANDADD),
             entry("GetAndSetTest", T_GETANDSET),
-            entry("LoadLoadFenceTest", T_GETLOADLOADFENCE),
-            entry("LoadStoreFenceTest1", T_LOADSTOREFENCESET),
-            entry("LoadStoreFenceTest2", T_GETLOADSTOREFENCE),
-            entry("StoreLoadFenceTest", T_SETSTORELOADFENCE),
-            entry("StoreLoadFenceTestWeak", T_WEAKSETSTORELOADFENCE),
-            entry("StoreStoreFenceTest1", T_STORESTOREFENCESET),
-            entry("StoreStoreFenceTest2", T_SETSTORESTOREFENCE),
-            entry("StoreStoreFenceTest2Weak", T_WEAKSETSTORESTOREFENCE),
             entry("WeakCASTest", T_WEAKCAS),
-            entry("WeakCASContendStrongTest", T_WEAKCAS));
+            entry("WeakCASContendStrongTest", T_WEAKCAS),
+            entry("LoadLoadFenceTest", T_GET_LOADLOADFENCE),
+            entry("LoadStoreFenceTest1", T_LOADSTOREFENCE_SET),
+            entry("LoadStoreFenceTest2", T_GET_LOADSTOREFENCE),
+            entry("StoreLoadFenceTest", T_SET_STORELOADFENCE),
+            entry("StoreStoreFenceTest1", T_STORESTOREFENCE_SET),
+            entry("StoreStoreFenceTest2", T_SET_STORESTOREFENCE)
+    );
+
 
     private static final String BASE_PKG = "org.openjdk.jcstress.tests.varHandles";
 
--- a/jcstress-test-gen/src/main/resources/chapter1b/arrays/StoreLoadFenceTestWeak.java.template	Fri Jun 10 10:56:33 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +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 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.Ref;
-import org.openjdk.jcstress.annotations.State;
-import org.openjdk.jcstress.annotations.Description;
-import org.openjdk.jcstress.infra.results.$Type$Result3;
-
-
-@JCStressTest
-@Description("weakCompareAndSetVolatile can take effect of store load fence, but may fail spuriously, so has different Outcomes with common StoreLoadFenceTest.")
-//when weak cas succeed
-@Outcome(id = "$value1$, $value0$, $value1$", expect = Expect.ACCEPTABLE, desc = "actor1 observe actor2 update, actor2 not yet observe actor1 update")
-@Outcome(id = "$value0$, $value1$, $value1$", expect = Expect.ACCEPTABLE,  desc = "actor2 observe actor1 update, actor1 not yet observe actor2 update")
-@Outcome(id = "$value1$, $value1$, $value1$", expect = Expect.ACCEPTABLE,  desc = "both actor1 and actor2 observe each other update")
-@Outcome(id = "$value0$, $value0$, $value1$", expect = Expect.FORBIDDEN, desc = "if r1 = 0, store var must be submitted already before fullFence in actor2, r2 must get the update")
-//when weak cas fail, r2 can only be $value0$
-@Outcome(id = "$value0$, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "actor1 not observe x is updated")
-@Outcome(id = "$value1$, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "actor1 observe x is updated")
-#if[alwaysAtomic]
-@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
-#else[alwaysAtomic]
-//when weak cas succeed, if r1 is half-value or value0, store var is submitted before fullFence in actor2, r2 must be full-value, vice versa.
-@Outcome(id = "$value1$, .*, $value1$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec.")
-@Outcome(id = ".*, $value1$, $value1$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
-//when weak cas fail
-@Outcome(id = ".*, $value0$, $value0$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec, r1 may read half of x")
-@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
-#end[alwaysAtomic]
-@State
-public class $TestClassName$ {
-
-    $type$ x;
-
-    $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) {
-        boolean result = %WeakSetStoreLoadFence<$valueLiteral1$>%
-        r.r1 = x;
-        r.r3 = result ? $valueLiteral1$ : $valueLiteral0$;
-    }
-
-    @Actor
-    public void actor2($Type$Result3 r) {
-        x = $valueLiteral1$;
-        VarHandle.fullFence();
-        r.r2 = array[0];
-    }
-}
\ No newline at end of file
--- a/jcstress-test-gen/src/main/resources/chapter1b/arrays/StoreStoreFenceTest2Weak.java.template	Fri Jun 10 10:56:33 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +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 org.openjdk.jcstress.annotations.Actor;
-import org.openjdk.jcstress.annotations.Expect;
-import org.openjdk.jcstress.annotations.JCStressTest;
-import org.openjdk.jcstress.annotations.Outcome;
-import org.openjdk.jcstress.annotations.Ref;
-import org.openjdk.jcstress.annotations.State;
-import org.openjdk.jcstress.annotations.Description;
-import org.openjdk.jcstress.infra.results.$Type$Result3;
-
-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;
-
-
-@JCStressTest
-@Description("weakCompareAndSetVolatile can take effect of store store fence, but may fail spuriously, so has different Outcomes with common StoreStoreFenceTest2.")
-//when weak cas succeed
-@Outcome(id = "$value0$, $value0$, $value1$", expect = Expect.ACCEPTABLE, desc = "actor2 observe the variables before actor1 update")
-@Outcome(id = "$value0$, $value1$, $value1$", expect = Expect.ACCEPTABLE, desc = "actor2 observe the variables after var is already updated but y hasn't yet")
-@Outcome(id = "$value1$, $value0$, $value1$", expect = Expect.FORBIDDEN,  desc = "y won't be observed to be updated before var is updated")
-@Outcome(id = "$value1$, $value1$, $value1$", expect = Expect.ACCEPTABLE,  desc = "actor2 observe the variables after actor1 update completely")
-//when weak cas fail, r2 can only be $value0$
-@Outcome(id = "$value0$, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "actor2 not observe y is updated")
-@Outcome(id = "$value1$, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "actor2 observe y is updated")
-#if[alwaysAtomic]
-@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
-#else[alwaysAtomic]
-//when weak cas succeed
-@Outcome(id = "$value0$, .*, $value1$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec, when load var in actor2 before storestore Fence in actor1")
-@Outcome(id = ".*, $value1$, $value1$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec, if r1 is half-value, load var must get a full-value")
-//when weak cas fail
-@Outcome(id = ".*, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "r1 may read half of y")
-@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
-#end[alwaysAtomic]
-@State
-public class $TestClassName$ {
-
-    $type$ y;
-
-    $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) {
-        boolean result = %WeakSetStoreStoreFence<$valueLiteral1$>%
-        y = $valueLiteral1$;
-        r.r3 = result ? $valueLiteral1$ : $valueLiteral0$;
-    }
-
-    @Actor
-    public void actor2($Type$Result3 r) {
-        r.r1 = y;
-        VarHandle.fullFence();
-        r.r2 = array[0];
-    }
-
-}
\ No newline at end of file
--- a/jcstress-test-gen/src/main/resources/chapter1b/byteArray/StoreLoadFenceTestWeak.java.template	Fri Jun 10 10:56:33 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +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 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.Ref;
-import org.openjdk.jcstress.annotations.State;
-import org.openjdk.jcstress.annotations.Description;
-import org.openjdk.jcstress.infra.results.$Type$Result3;
-
-
-@JCStressTest
-@Description("weakCompareAndSetVolatile can take effect of store load fence, but may fail spuriously, so has different Outcomes with common StoreLoadFenceTest.")
-//when weak cas succeed
-@Outcome(id = "$value1$, $value0$, $value1$", expect = Expect.ACCEPTABLE, desc = "actor1 observe actor2 update, actor2 not yet observe actor1 update")
-@Outcome(id = "$value0$, $value1$, $value1$", expect = Expect.ACCEPTABLE,  desc = "actor2 observe actor1 update, actor1 not yet observe actor2 update")
-@Outcome(id = "$value1$, $value1$, $value1$", expect = Expect.ACCEPTABLE,  desc = "both actor1 and actor2 observe each other update")
-@Outcome(id = "$value0$, $value0$, $value1$", expect = Expect.FORBIDDEN, desc = "if r1 = 0, store var must be submitted already before fullFence in actor2, r2 must get the update")
-//when weak cas fail, r2 can only be $value0$
-@Outcome(id = "$value0$, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "actor1 not observe x is updated")
-@Outcome(id = "$value1$, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "actor1 observe x is updated")
-#if[alwaysAtomic]
-@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
-#else[alwaysAtomic]
-//when weak cas succeed, if r1 is half-value or value0, store var is submitted before fullFence in actor2, r2 must be full-value, vice versa.
-@Outcome(id = "$value1$, .*, $value1$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec.")
-@Outcome(id = ".*, $value1$, $value1$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
-//when weak cas fail
-@Outcome(id = ".*, $value0$, $value0$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec, r1 may read half of x")
-@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
-#end[alwaysAtomic]
-@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, BIG_ENDIAN);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    byte[] byteArray = new byte[OFF + 8];
-
-    $type$ x;
-
-    @Actor
-    public void actor1($Type$Result3 r) {
-        boolean result = %WeakSetStoreLoadFence<$valueLiteral1$>%
-        r.r1 = x;
-        r.r3 = result ? $valueLiteral1$ : $valueLiteral0$;
-    }
-
-    @Actor
-    public void actor2($Type$Result3 r) {
-        x = $valueLiteral1$;
-        VarHandle.fullFence();
-        r.r2 = ($type$) vh.get(byteArray, OFF);
-    }
-}
\ No newline at end of file
--- a/jcstress-test-gen/src/main/resources/chapter1b/byteArray/StoreStoreFenceTest2Weak.java.template	Fri Jun 10 10:56:33 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +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 org.openjdk.jcstress.annotations.Actor;
-import org.openjdk.jcstress.annotations.Expect;
-import org.openjdk.jcstress.annotations.JCStressTest;
-import org.openjdk.jcstress.annotations.Outcome;
-import org.openjdk.jcstress.annotations.Ref;
-import org.openjdk.jcstress.annotations.State;
-import org.openjdk.jcstress.annotations.Description;
-import org.openjdk.jcstress.infra.results.$Type$Result3;
-
-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;
-
-
-@JCStressTest
-@Description("weakCompareAndSetVolatile can take effect of store store fence, but may fail spuriously, so has different Outcomes with common StoreStoreFenceTest2.")
-//when weak cas succeed
-@Outcome(id = "$value0$, $value0$, $value1$", expect = Expect.ACCEPTABLE, desc = "actor2 observe the variables before actor1 update")
-@Outcome(id = "$value0$, $value1$, $value1$", expect = Expect.ACCEPTABLE, desc = "actor2 observe the variables after var is already updated but y hasn't yet")
-@Outcome(id = "$value1$, $value0$, $value1$", expect = Expect.FORBIDDEN,  desc = "y won't be observed to be updated before var is updated")
-@Outcome(id = "$value1$, $value1$, $value1$", expect = Expect.ACCEPTABLE,  desc = "actor2 observe the variables after actor1 update completely")
-//when weak cas fail, r2 can only be $value0$
-@Outcome(id = "$value0$, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "actor2 not observe y is updated")
-@Outcome(id = "$value1$, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "actor2 observe y is updated")
-#if[alwaysAtomic]
-@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
-#else[alwaysAtomic]
-//when weak cas succeed
-@Outcome(id = "$value0$, .*, $value1$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec, when load var in actor2 before storestore Fence in actor1")
-@Outcome(id = ".*, $value1$, $value1$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec, if r1 is half-value, load var must get a full-value")
-//when weak cas fail
-@Outcome(id = ".*, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "r1 may read half of y")
-@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
-#end[alwaysAtomic]
-@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, BIG_ENDIAN);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    byte[] byteArray = new byte[OFF + 8];
-
-    $type$ y;
-
-    @Actor
-    public void actor1($Type$Result3 r) {
-        boolean result = %WeakSetStoreStoreFence<$valueLiteral1$>%
-        y = $valueLiteral1$;
-        r.r3 = result ? $valueLiteral1$ : $valueLiteral0$;
-    }
-
-    @Actor
-    public void actor2($Type$Result3 r) {
-        r.r1 = y;
-        VarHandle.fullFence();
-        r.r2 = ($type$) vh.get(byteArray, OFF);
-    }
-
-}
\ No newline at end of file
--- a/jcstress-test-gen/src/main/resources/chapter1b/byteBuffer/StoreStoreFenceTest2Weak.java.template	Fri Jun 10 10:56:33 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +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 org.openjdk.jcstress.annotations.Actor;
-import org.openjdk.jcstress.annotations.Expect;
-import org.openjdk.jcstress.annotations.JCStressTest;
-import org.openjdk.jcstress.annotations.Outcome;
-import org.openjdk.jcstress.annotations.Ref;
-import org.openjdk.jcstress.annotations.State;
-import org.openjdk.jcstress.annotations.Description;
-import org.openjdk.jcstress.infra.results.$Type$Result3;
-
-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;
-
-
-@JCStressTest
-@Description("weakCompareAndSetVolatile can take effect of store store fence, but may fail spuriously, so has different Outcomes with common StoreStoreFenceTest2.")
-//when weak cas succeed
-@Outcome(id = "$value0$, $value0$, $value1$", expect = Expect.ACCEPTABLE, desc = "actor2 observe the variables before actor1 update")
-@Outcome(id = "$value0$, $value1$, $value1$", expect = Expect.ACCEPTABLE, desc = "actor2 observe the variables after var is already updated but y hasn't yet")
-@Outcome(id = "$value1$, $value0$, $value1$", expect = Expect.FORBIDDEN,  desc = "y won't be observed to be updated before var is updated")
-@Outcome(id = "$value1$, $value1$, $value1$", expect = Expect.ACCEPTABLE,  desc = "actor2 observe the variables after actor1 update completely")
-//when weak cas fail, r2 can only be $value0$
-@Outcome(id = "$value0$, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "actor2 not observe y is updated")
-@Outcome(id = "$value1$, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "actor2 observe y is updated")
-#if[alwaysAtomic]
-@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
-#else[alwaysAtomic]
-//when weak cas succeed
-@Outcome(id = "$value0$, .*, $value1$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec, when load var in actor2 before storestore Fence in actor1")
-@Outcome(id = ".*, $value1$, $value1$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec, if r1 is half-value, load var must get a full-value")
-//when weak cas fail
-@Outcome(id = ".*, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "r1 may read half of y")
-@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
-#end[alwaysAtomic]
-@State
-public class $TestClassName$ {
-
-    static final int OFF = ByteBuffer.wrap(new byte[128]).alignmentOffset(0, 8);
-
-    static final VarHandle vh;
-
-    static {
-        try {
-            vh = MethodHandles.byteBufferViewVarHandle($type$[].class, BIG_ENDIAN);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    ByteBuffer byteBuffer = $buffer_allocate$(OFF + 8);
-
-    $type$ y;
-
-    @Actor
-    public void actor1($Type$Result3 r) {
-        boolean result = %WeakSetStoreStoreFence<$valueLiteral1$>%
-        y = $valueLiteral1$;
-        r.r3 = result ? $valueLiteral1$ : $valueLiteral0$;
-    }
-
-    @Actor
-    public void actor2($Type$Result3 r) {
-        r.r1 = y;
-        VarHandle.fullFence();
-        r.r2 = ($type$) vh.get(byteBuffer, OFF);
-    }
-
-}
\ No newline at end of file
--- a/jcstress-test-gen/src/main/resources/chapter1b/fields/StoreLoadFenceTestWeak.java.template	Fri Jun 10 10:56:33 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +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 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.Ref;
-import org.openjdk.jcstress.annotations.State;
-import org.openjdk.jcstress.annotations.Description;
-import org.openjdk.jcstress.infra.results.$Type$Result3;
-
-
-@JCStressTest
-@Description("weakCompareAndSetVolatile can take effect of store load fence, but may fail spuriously, so has different Outcomes with common StoreLoadFenceTest.")
-//when weak cas succeed
-@Outcome(id = "$value1$, $value0$, $value1$", expect = Expect.ACCEPTABLE, desc = "actor1 observe actor2 update, actor2 not yet observe actor1 update")
-@Outcome(id = "$value0$, $value1$, $value1$", expect = Expect.ACCEPTABLE,  desc = "actor2 observe actor1 update, actor1 not yet observe actor2 update")
-@Outcome(id = "$value1$, $value1$, $value1$", expect = Expect.ACCEPTABLE,  desc = "both actor1 and actor2 observe each other update")
-@Outcome(id = "$value0$, $value0$, $value1$", expect = Expect.FORBIDDEN, desc = "if r1 = 0, store var must be submitted already before fullFence in actor2, r2 must get the update")
-//when weak cas fail, r2 can only be $value0$
-@Outcome(id = "$value0$, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "actor1 not observe x is updated")
-@Outcome(id = "$value1$, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "actor1 observe x is updated")
-#if[alwaysAtomic]
-@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
-#else[alwaysAtomic]
-//when weak cas succeed, if r1 is half-value or value0, store var is submitted before fullFence in actor2, r2 must be full-value, vice versa.
-@Outcome(id = "$value1$, .*, $value1$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec.")
-@Outcome(id = ".*, $value1$, $value1$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
-//when weak cas fail
-@Outcome(id = ".*, $value0$, $value0$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec, r1 may read half of x")
-@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
-#end[alwaysAtomic]
-@State
-public class $TestClassName$ {
-
-    $type$ x;
-    
-    $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) {
-        boolean result = %WeakSetStoreLoadFence<$valueLiteral1$>%
-        r.r1 = x;
-        r.r3 = result ? $valueLiteral1$ : $valueLiteral0$;
-    }
-    
-    @Actor
-    public void actor2($Type$Result3 r) {
-        x = $valueLiteral1$;
-        VarHandle.fullFence();
-        r.r2 = field;
-    }
-}
\ No newline at end of file
--- a/jcstress-test-gen/src/main/resources/chapter1b/fields/StoreStoreFenceTest2Weak.java.template	Fri Jun 10 10:56:33 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +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 org.openjdk.jcstress.annotations.Actor;
-import org.openjdk.jcstress.annotations.Expect;
-import org.openjdk.jcstress.annotations.JCStressTest;
-import org.openjdk.jcstress.annotations.Outcome;
-import org.openjdk.jcstress.annotations.Ref;
-import org.openjdk.jcstress.annotations.State;
-import org.openjdk.jcstress.annotations.Description;
-import org.openjdk.jcstress.infra.results.$Type$Result3;
-
-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;
-
-
-@JCStressTest
-@Description("weakCompareAndSetVolatile can take effect of store store fence, but may fail spuriously, so has different Outcomes with common StoreStoreFenceTest2.")
-//when weak cas succeed
-@Outcome(id = "$value0$, $value0$, $value1$", expect = Expect.ACCEPTABLE, desc = "actor2 observe the variables before actor1 update")
-@Outcome(id = "$value0$, $value1$, $value1$", expect = Expect.ACCEPTABLE, desc = "actor2 observe the variables after var is already updated but y hasn't yet")
-@Outcome(id = "$value1$, $value0$, $value1$", expect = Expect.FORBIDDEN,  desc = "y won't be observed to be updated before var is updated")
-@Outcome(id = "$value1$, $value1$, $value1$", expect = Expect.ACCEPTABLE,  desc = "actor2 observe the variables after actor1 update completely")
-//when weak cas fail, r2 can only be $value0$
-@Outcome(id = "$value0$, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "actor2 not observe y is updated")
-@Outcome(id = "$value1$, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "actor2 observe y is updated")
-#if[alwaysAtomic]
-@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
-#else[alwaysAtomic]
-//when weak cas succeed
-@Outcome(id = "$value0$, .*, $value1$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec, when load var in actor2 before storestore Fence in actor1")
-@Outcome(id = ".*, $value1$, $value1$", expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec, if r1 is half-value, load var must get a full-value")
-//when weak cas fail
-@Outcome(id = ".*, $value0$, $value0$", expect = Expect.ACCEPTABLE, desc = "r1 may read half of y")
-@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
-#end[alwaysAtomic]
-@State
-public class $TestClassName$ {
-
-    $type$ y;
-    
-    $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) {
-        boolean result = %WeakSetStoreStoreFence<$valueLiteral1$>%
-        y = $valueLiteral1$;
-        
-        r.r3 = result ? $valueLiteral1$ : $valueLiteral0$;
-    }
-
-    @Actor
-    public void actor2($Type$Result3 r) {
-        r.r1 = y;
-        VarHandle.fullFence();
-        r.r2 = field;
-    }
-
-}
\ No newline at end of file