changeset 296:c47a1a95f97d

Chapter 1.c: Remove superfluous VarHandle instantiations.
author shade
date Fri, 10 Jun 2016 15:36:00 +0300
parents ed33da548c5c
children 2cb629dfc2be
files jcstress-test-gen/src/main/resources/fences/X-LoadLoadFenceTest.java.template jcstress-test-gen/src/main/resources/fences/X-LoadStoreFenceTest1.java.template jcstress-test-gen/src/main/resources/fences/X-LoadStoreFenceTest2.java.template jcstress-test-gen/src/main/resources/fences/X-StoreLoadFenceTest.java.template jcstress-test-gen/src/main/resources/fences/X-StoreStoreFenceTest1.java.template jcstress-test-gen/src/main/resources/fences/X-StoreStoreFenceTest2.java.template
diffstat 6 files changed, 14 insertions(+), 140 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-test-gen/src/main/resources/fences/X-LoadLoadFenceTest.java.template	Fri Jun 10 15:29:27 2016 +0300
+++ b/jcstress-test-gen/src/main/resources/fences/X-LoadLoadFenceTest.java.template	Fri Jun 10 15:36:00 2016 +0300
@@ -24,21 +24,10 @@
  */
 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.annotations.*;
 import org.openjdk.jcstress.infra.results.$Type$Result2;
 
-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("Tests VarHandle methods which take effect of load load fence.")
@@ -60,16 +49,6 @@
 
     $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() {
         x = $valueLiteral1$;
--- a/jcstress-test-gen/src/main/resources/fences/X-LoadStoreFenceTest1.java.template	Fri Jun 10 15:29:27 2016 +0300
+++ b/jcstress-test-gen/src/main/resources/fences/X-LoadStoreFenceTest1.java.template	Fri Jun 10 15:36:00 2016 +0300
@@ -24,18 +24,8 @@
  */
 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.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.annotations.*;
 import org.openjdk.jcstress.infra.results.$Type$Result2;
 
 
@@ -55,27 +45,16 @@
 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$Result2 r) {
         $type$ i = x;
         %LoadStoreFenceSet<$valueLiteral1$>%
         r.r2 = i;
     }
-    
+
     @Actor
     public void actor2($Type$Result2 r) {
         r.r1 = field;
--- a/jcstress-test-gen/src/main/resources/fences/X-LoadStoreFenceTest2.java.template	Fri Jun 10 15:29:27 2016 +0300
+++ b/jcstress-test-gen/src/main/resources/fences/X-LoadStoreFenceTest2.java.template	Fri Jun 10 15:36:00 2016 +0300
@@ -24,18 +24,8 @@
  */
 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.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.annotations.*;
 import org.openjdk.jcstress.infra.results.$Type$Result2;
 
 
@@ -55,27 +45,16 @@
 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$Result2 r) {
         $type$ i = %GetLoadStoreFence<>%
         y = $valueLiteral1$;
         r.r2 = i;
     }
-    
+
     @Actor
     public void actor2($Type$Result2 r) {
         r.r1 = y;
--- a/jcstress-test-gen/src/main/resources/fences/X-StoreLoadFenceTest.java.template	Fri Jun 10 15:29:27 2016 +0300
+++ b/jcstress-test-gen/src/main/resources/fences/X-StoreLoadFenceTest.java.template	Fri Jun 10 15:36:00 2016 +0300
@@ -24,20 +24,9 @@
  */
 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.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.annotations.*;
 import org.openjdk.jcstress.infra.results.$Type$Result2;
 
 
@@ -59,25 +48,15 @@
 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$Result2 r) {
         %SetStoreLoadFence<$valueLiteral1$>%
         r.r1 = x;
     }
-    
+
     @Actor
     public void actor2($Type$Result2 r) {
         x = $valueLiteral1$;
--- a/jcstress-test-gen/src/main/resources/fences/X-StoreStoreFenceTest1.java.template	Fri Jun 10 15:29:27 2016 +0300
+++ b/jcstress-test-gen/src/main/resources/fences/X-StoreStoreFenceTest1.java.template	Fri Jun 10 15:36:00 2016 +0300
@@ -24,20 +24,10 @@
  */
 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.annotations.*;
 import org.openjdk.jcstress.infra.results.$Type$Result2;
 
-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
@@ -57,20 +47,9 @@
 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() {
         x = $valueLiteral1$;
--- a/jcstress-test-gen/src/main/resources/fences/X-StoreStoreFenceTest2.java.template	Fri Jun 10 15:29:27 2016 +0300
+++ b/jcstress-test-gen/src/main/resources/fences/X-StoreStoreFenceTest2.java.template	Fri Jun 10 15:36:00 2016 +0300
@@ -24,20 +24,10 @@
  */
 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.annotations.*;
 import org.openjdk.jcstress.infra.results.$Type$Result2;
 
-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
@@ -57,20 +47,9 @@
 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() {
         %SetStoreStoreFence<$valueLiteral1$>%