changeset 109:49f7af8a9a04

Migrate tearing.* tests to new API.
author shade
date Fri, 14 Mar 2014 03:26:33 +0400
parents fd9cb15e9cad
children 0326782f47a3
files tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/ArrayInterleaveTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/UnsafeArrayInterleaveTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/UnsafeIntTearingTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/ByteBufferInterleaveTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/CharBufferInterleaveTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/DirectByteBufferInterleaveTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/DoubleBufferInterleaveTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/FloatBufferInterleaveTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/IntBufferInterleaveTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/LongBufferInterleaveTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/ShortBufferInterleaveTest.java
diffstat 11 files changed, 220 insertions(+), 243 deletions(-) [+]
line wrap: on
line diff
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/ArrayInterleaveTest.java	Fri Mar 14 02:59:43 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/ArrayInterleaveTest.java	Fri Mar 14 03:26:33 2014 +0400
@@ -24,37 +24,40 @@
  */
 package org.openjdk.jcstress.tests.tearing;
 
+import org.openjdk.jcstress.infra.annotations.Actor;
+import org.openjdk.jcstress.infra.annotations.Arbiter;
+import org.openjdk.jcstress.infra.annotations.ConcurrencyStressTest;
+import org.openjdk.jcstress.infra.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult3;
 import org.openjdk.jcstress.tests.Actor2_Arbiter1_Test;
 
-public class ArrayInterleaveTest implements Actor2_Arbiter1_Test<byte[], IntResult3> {
+@ConcurrencyStressTest
+@State
+public class ArrayInterleaveTest {
 
     /** Array size: 256 bytes inevitably crosses the cache line on most implementations */
     public static final int SIZE = 256;
 
-    @Override
-    public byte[] newState() {
-        return new byte[SIZE];
-    }
+    byte[] ss = new byte[SIZE];
 
-    @Override
-    public void actor1(byte[] s, IntResult3 r) {
-        for (int i = 0; i < s.length; i += 2) {
-            s[i] = 1;
+    @Actor
+    public void actor1() {
+        for (int i = 0; i < ss.length; i += 2) {
+            ss[i] = 1;
         }
     }
 
-    @Override
-    public void actor2(byte[] s, IntResult3 r) {
-        for (int i = 1; i < s.length; i += 2) {
-            s[i] = 2;
+    @Actor
+    public void actor2() {
+        for (int i = 1; i < ss.length; i += 2) {
+            ss[i] = 2;
         }
     }
 
-    @Override
-    public void arbiter1(byte[] state, IntResult3 r) {
+    @Arbiter
+    public void arbiter1(IntResult3 r) {
         r.r1 = r.r2 = r.r3 = 0;
-        for (byte s : state) {
+        for (byte s : ss) {
             switch (s) {
                 case 0:
                     r.r1++;
@@ -71,9 +74,4 @@
         }
     }
 
-    @Override
-    public IntResult3 newResult() {
-        return new IntResult3();
-    }
-
 }
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/UnsafeArrayInterleaveTest.java	Fri Mar 14 02:59:43 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/UnsafeArrayInterleaveTest.java	Fri Mar 14 03:26:33 2014 +0400
@@ -24,11 +24,17 @@
  */
 package org.openjdk.jcstress.tests.tearing;
 
+import org.openjdk.jcstress.infra.annotations.Actor;
+import org.openjdk.jcstress.infra.annotations.Arbiter;
+import org.openjdk.jcstress.infra.annotations.ConcurrencyStressTest;
+import org.openjdk.jcstress.infra.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult3;
 import org.openjdk.jcstress.tests.Actor2_Arbiter1_Test;
 import org.openjdk.jcstress.util.UnsafeHolder;
 
-public class UnsafeArrayInterleaveTest implements Actor2_Arbiter1_Test<byte[], IntResult3> {
+@ConcurrencyStressTest
+@State
+public class UnsafeArrayInterleaveTest {
 
     /** Array size: 256 bytes inevitably crosses the cache line on most implementations */
     public static final int SIZE = 256;
@@ -36,30 +42,27 @@
     public static final int ARRAY_BASE_OFFSET = UnsafeHolder.U.arrayBaseOffset(byte[].class);
     public static final int ARRAY_BASE_SCALE = UnsafeHolder.U.arrayIndexScale(byte[].class);
 
-    @Override
-    public byte[] newState() {
-        return new byte[SIZE];
-    }
+    byte[] ss = new byte[SIZE];
 
-    @Override
-    public void actor1(byte[] s, IntResult3 r) {
-        for (int i = 0; i < s.length; i += 2) {
-            UnsafeHolder.U.putByte(s, (long)(ARRAY_BASE_OFFSET + ARRAY_BASE_SCALE*i), (byte)1);
+    @Actor
+    public void actor1() {
+        for (int i = 0; i < ss.length; i += 2) {
+            UnsafeHolder.U.putByte(ss, (long)(ARRAY_BASE_OFFSET + ARRAY_BASE_SCALE*i), (byte)1);
         }
     }
 
-    @Override
-    public void actor2(byte[] s, IntResult3 r) {
-        for (int i = 1; i < s.length; i += 2) {
-            UnsafeHolder.U.putByte(s, (long)(ARRAY_BASE_OFFSET + ARRAY_BASE_SCALE*i), (byte)2);
+    @Actor
+    public void actor2() {
+        for (int i = 1; i < ss.length; i += 2) {
+            UnsafeHolder.U.putByte(ss, (long)(ARRAY_BASE_OFFSET + ARRAY_BASE_SCALE*i), (byte)2);
         }
     }
 
-    @Override
-    public void arbiter1(byte[] state, IntResult3 r) {
+    @Arbiter
+    public void arbiter1(IntResult3 r) {
         r.r1 = r.r2 = r.r3 = 0;
 
-        for (byte s : state) {
+        for (byte s : ss) {
             switch (s) {
                 case 0:
                     r.r1++;
@@ -76,9 +79,4 @@
         }
     }
 
-    @Override
-    public IntResult3 newResult() {
-        return new IntResult3();
-    }
-
 }
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/UnsafeIntTearingTest.java	Fri Mar 14 02:59:43 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/UnsafeIntTearingTest.java	Fri Mar 14 03:26:33 2014 +0400
@@ -24,66 +24,60 @@
  */
 package org.openjdk.jcstress.tests.tearing;
 
+import org.openjdk.jcstress.infra.annotations.Actor;
+import org.openjdk.jcstress.infra.annotations.ConcurrencyStressTest;
+import org.openjdk.jcstress.infra.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult2;
 import org.openjdk.jcstress.tests.Actor2_Arbiter1_Test;
 import org.openjdk.jcstress.util.UnsafeHolder;
 
 import java.util.Random;
 
-public class UnsafeIntTearingTest implements Actor2_Arbiter1_Test<UnsafeIntTearingTest.State, IntResult2> {
-
-    @Override
-    public State newState() {
-        return new State();
-    }
-
-    @Override
-    public void actor1(State s, IntResult2 r) {
-        UnsafeHolder.U.putInt(s.bytes, s.offset1, 0xAAAAAAAA);
-    }
-
-    @Override
-    public void actor2(State s, IntResult2 r) {
-        UnsafeHolder.U.putInt(s.bytes, s.offset2, 0x55555555);
-    }
-
-    @Override
-    public void arbiter1(State s, IntResult2 r) {
-        r.r1 = UnsafeHolder.U.getInt(s.bytes, s.offset1);
-        r.r2 = UnsafeHolder.U.getInt(s.bytes, s.offset2);
-    }
-
-    @Override
-    public IntResult2 newResult() {
-        return new IntResult2();
-    }
+@ConcurrencyStressTest
+@State
+public class UnsafeIntTearingTest {
 
     /**
      * We don't have the alignment information, so we would try to read/write to the
      * random offset within the byte array.
      */
-    public static class State {
-        /** Array size: 256 bytes inevitably crosses the cache line on most implementations */
-        public static final int SIZE = 256;
 
-        public static final Random RANDOM = new Random();
-        public static final int ARRAY_BASE_OFFSET = UnsafeHolder.U.arrayBaseOffset(byte[].class);
-        public static final int ARRAY_BASE_SCALE = UnsafeHolder.U.arrayIndexScale(byte[].class);
-        public static final int COMPONENT_SIZE = 4;
+    /** Array size: 256 bytes inevitably crosses the cache line on most implementations */
+    public static final int SIZE = 256;
 
-        /** Alignment constraint: 4-bytes is default, for integers */
-        public static final int ALIGN = Integer.getInteger("align", COMPONENT_SIZE);
+    public static final Random RANDOM = new Random();
+    public static final int ARRAY_BASE_OFFSET = UnsafeHolder.U.arrayBaseOffset(byte[].class);
+    public static final int ARRAY_BASE_SCALE = UnsafeHolder.U.arrayIndexScale(byte[].class);
+    public static final int COMPONENT_SIZE = 4;
 
-        public final byte[] bytes;
-        public final long offset1;
-        public final long offset2;
+    /** Alignment constraint: 4-bytes is default, for integers */
+    public static final int ALIGN = Integer.getInteger("align", COMPONENT_SIZE);
 
-        public State() {
-            bytes = new byte[SIZE];
-            int index = RANDOM.nextInt((SIZE - COMPONENT_SIZE*2)/ALIGN)*ALIGN;
-            offset1 = ARRAY_BASE_OFFSET + ARRAY_BASE_SCALE*index;
-            offset2 = offset1 + COMPONENT_SIZE;
-        }
+    public final byte[] bytes;
+    public final long offset1;
+    public final long offset2;
+
+    public UnsafeIntTearingTest() {
+        bytes = new byte[SIZE];
+        int index = RANDOM.nextInt((SIZE - COMPONENT_SIZE*2)/ALIGN)*ALIGN;
+        offset1 = ARRAY_BASE_OFFSET + ARRAY_BASE_SCALE*index;
+        offset2 = offset1 + COMPONENT_SIZE;
+    }
+
+    @Actor
+    public void actor1() {
+        UnsafeHolder.U.putInt(bytes, offset1, 0xAAAAAAAA);
+    }
+
+    @Actor
+    public void actor2() {
+        UnsafeHolder.U.putInt(bytes, offset2, 0x55555555);
+    }
+
+    @Actor
+    public void arbiter1(IntResult2 r) {
+        r.r1 = UnsafeHolder.U.getInt(bytes, offset1);
+        r.r2 = UnsafeHolder.U.getInt(bytes, offset2);
     }
 
 }
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/ByteBufferInterleaveTest.java	Fri Mar 14 02:59:43 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/ByteBufferInterleaveTest.java	Fri Mar 14 03:26:33 2014 +0400
@@ -24,43 +24,49 @@
  */
 package org.openjdk.jcstress.tests.tearing.buffers;
 
+import org.openjdk.jcstress.infra.annotations.Actor;
+import org.openjdk.jcstress.infra.annotations.Arbiter;
+import org.openjdk.jcstress.infra.annotations.ConcurrencyStressTest;
+import org.openjdk.jcstress.infra.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult3;
 import org.openjdk.jcstress.tests.Actor2_Arbiter1_Test;
 
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 
-public class ByteBufferInterleaveTest implements Actor2_Arbiter1_Test<ByteBuffer, IntResult3> {
+@ConcurrencyStressTest
+@State
+public class ByteBufferInterleaveTest {
 
     /** Array size: 256 bytes inevitably crosses the cache line on most implementations */
     public static final int SIZE = 256;
 
-    @Override
-    public ByteBuffer newState() {
-        ByteBuffer buffer = ByteBuffer.allocate(SIZE);
+    private final ByteBuffer buffer;
+
+    public ByteBufferInterleaveTest() {
+        buffer = ByteBuffer.allocate(SIZE);
         buffer.order(ByteOrder.nativeOrder());
-        return buffer;
     }
 
-    @Override
-    public void actor1(ByteBuffer s, IntResult3 r) {
+    @Actor
+    public void actor1() {
         for (int i = 0; i < SIZE; i += 2) {
-            s.put(i, (byte)1);
+            buffer.put(i, (byte)1);
         }
     }
 
-    @Override
-    public void actor2(ByteBuffer s, IntResult3 r) {
+    @Actor
+    public void actor2() {
         for (int i = 1; i < SIZE; i += 2) {
-            s.put(i, (byte)2);
+            buffer.put(i, (byte)2);
         }
     }
 
-    @Override
-    public void arbiter1(ByteBuffer state, IntResult3 r) {
+    @Arbiter
+    public void arbiter1(IntResult3 r) {
         r.r1 = r.r2 = r.r3 = 0;
         for (int i = 0; i < SIZE; i++) {
-            byte s = state.get(i);
+            byte s = buffer.get(i);
             switch (s) {
                 case 0:
                     r.r1++;
@@ -77,9 +83,4 @@
         }
     }
 
-    @Override
-    public IntResult3 newResult() {
-        return new IntResult3();
-    }
-
 }
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/CharBufferInterleaveTest.java	Fri Mar 14 02:59:43 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/CharBufferInterleaveTest.java	Fri Mar 14 03:26:33 2014 +0400
@@ -24,40 +24,43 @@
  */
 package org.openjdk.jcstress.tests.tearing.buffers;
 
+import org.openjdk.jcstress.infra.annotations.Actor;
+import org.openjdk.jcstress.infra.annotations.Arbiter;
+import org.openjdk.jcstress.infra.annotations.ConcurrencyStressTest;
+import org.openjdk.jcstress.infra.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult3;
 import org.openjdk.jcstress.tests.Actor2_Arbiter1_Test;
 
 import java.nio.CharBuffer;
 
-public class CharBufferInterleaveTest implements Actor2_Arbiter1_Test<CharBuffer, IntResult3> {
+@ConcurrencyStressTest
+@State
+public class CharBufferInterleaveTest {
 
     /** Array size: 256 bytes inevitably crosses the cache line on most implementations */
     public static final int SIZE = 256;
 
-    @Override
-    public CharBuffer newState() {
-        return CharBuffer.allocate(SIZE);
-    }
+    private final CharBuffer buffer = CharBuffer.allocate(SIZE);
 
-    @Override
-    public void actor1(CharBuffer s, IntResult3 r) {
+    @Actor
+    public void actor1() {
         for (int i = 0; i < SIZE; i += 2) {
-            s.put(i, 'a');
+            buffer.put(i, 'a');
         }
     }
 
-    @Override
-    public void actor2(CharBuffer s, IntResult3 r) {
+    @Actor
+    public void actor2() {
         for (int i = 1; i < SIZE; i += 2) {
-            s.put(i, 'b');
+            buffer.put(i, 'b');
         }
     }
 
-    @Override
-    public void arbiter1(CharBuffer s, IntResult3 r) {
+    @Arbiter
+    public void arbiter1(IntResult3 r) {
         r.r1 = r.r2 = r.r3 = 0;
         for (int i = 0; i < SIZE; i++) {
-            switch (s.get(i)) {
+            switch (buffer.get(i)) {
                 case 'a': r.r2++; break;
                 case 'b': r.r3++; break;
                 default: r.r1++; break;
@@ -65,9 +68,4 @@
         }
     }
 
-    @Override
-    public IntResult3 newResult() {
-        return new IntResult3();
-    }
-
 }
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/DirectByteBufferInterleaveTest.java	Fri Mar 14 02:59:43 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/DirectByteBufferInterleaveTest.java	Fri Mar 14 03:26:33 2014 +0400
@@ -24,43 +24,49 @@
  */
 package org.openjdk.jcstress.tests.tearing.buffers;
 
+import org.openjdk.jcstress.infra.annotations.Actor;
+import org.openjdk.jcstress.infra.annotations.Arbiter;
+import org.openjdk.jcstress.infra.annotations.ConcurrencyStressTest;
+import org.openjdk.jcstress.infra.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult3;
 import org.openjdk.jcstress.tests.Actor2_Arbiter1_Test;
 
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 
-public class DirectByteBufferInterleaveTest implements Actor2_Arbiter1_Test<ByteBuffer, IntResult3> {
+@ConcurrencyStressTest
+@State
+public class DirectByteBufferInterleaveTest {
 
     /** Array size: 256 bytes inevitably crosses the cache line on most implementations */
     public static final int SIZE = 256;
 
-    @Override
-    public ByteBuffer newState() {
-        ByteBuffer buffer = ByteBuffer.allocateDirect(SIZE);
+    private final ByteBuffer buffer;
+
+    public DirectByteBufferInterleaveTest() {
+        buffer = ByteBuffer.allocateDirect(SIZE);
         buffer.order(ByteOrder.nativeOrder());
-        return buffer;
     }
 
-    @Override
-    public void actor1(ByteBuffer s, IntResult3 r) {
+    @Actor
+    public void actor1() {
         for (int i = 0; i < SIZE; i += 2) {
-            s.put(i, (byte)1);
+            buffer.put(i, (byte)1);
         }
     }
 
-    @Override
-    public void actor2(ByteBuffer s, IntResult3 r) {
+    @Actor
+    public void actor2() {
         for (int i = 1; i < SIZE; i += 2) {
-            s.put(i, (byte)2);
+            buffer.put(i, (byte) 2);
         }
     }
 
-    @Override
-    public void arbiter1(ByteBuffer s, IntResult3 r) {
+    @Arbiter
+    public void arbiter1(IntResult3 r) {
         r.r1 = r.r2 = r.r3 = 0;
         for (int i = 0; i < SIZE; i++) {
-            switch (s.get(i)) {
+            switch (buffer.get(i)) {
                 case 0:
                     r.r1++;
                     break;
@@ -71,14 +77,9 @@
                     r.r3++;
                     break;
                 default:
-                    throw new IllegalStateException(String.valueOf(s.get(i)));
+                    throw new IllegalStateException(String.valueOf(buffer.get(i)));
             }
         }
     }
 
-    @Override
-    public IntResult3 newResult() {
-        return new IntResult3();
-    }
-
 }
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/DoubleBufferInterleaveTest.java	Fri Mar 14 02:59:43 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/DoubleBufferInterleaveTest.java	Fri Mar 14 03:26:33 2014 +0400
@@ -24,13 +24,18 @@
  */
 package org.openjdk.jcstress.tests.tearing.buffers;
 
+import org.openjdk.jcstress.infra.annotations.Actor;
+import org.openjdk.jcstress.infra.annotations.Arbiter;
+import org.openjdk.jcstress.infra.annotations.ConcurrencyStressTest;
+import org.openjdk.jcstress.infra.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult3;
 import org.openjdk.jcstress.tests.Actor2_Arbiter1_Test;
 
 import java.nio.DoubleBuffer;
 
-
-public class DoubleBufferInterleaveTest implements Actor2_Arbiter1_Test<DoubleBuffer, IntResult3> {
+@ConcurrencyStressTest
+@State
+public class DoubleBufferInterleaveTest {
 
     /** Array size: 256 bytes inevitably crosses the cache line on most implementations */
     public static final int SIZE = 256;
@@ -38,30 +43,27 @@
     public static final double D1 = Math.PI * 1;
     public static final double D2 = Math.PI * 2;
 
-    @Override
-    public DoubleBuffer newState() {
-        return DoubleBuffer.allocate(SIZE);
-    }
+    private final DoubleBuffer buffer = DoubleBuffer.allocate(SIZE);
 
-    @Override
-    public void actor1(DoubleBuffer s, IntResult3 r) {
+    @Actor
+    public void actor1() {
         for (int i = 0; i < SIZE; i += 2) {
-            s.put(i, D1);
+            buffer.put(i, D1);
         }
     }
 
-    @Override
-    public void actor2(DoubleBuffer s, IntResult3 r) {
+    @Actor
+    public void actor2() {
         for (int i = 1; i < SIZE; i += 2) {
-            s.put(i, D2);
+            buffer.put(i, D2);
         }
     }
 
-    @Override
-    public void arbiter1(DoubleBuffer s, IntResult3 r) {
+    @Arbiter
+    public void arbiter1(IntResult3 r) {
         r.r1 = r.r2 = r.r3 = 0;
         for (int i = 0; i < SIZE; i++) {
-            double d = s.get(i);
+            double d = buffer.get(i);
             if (d == D1)
                 r.r2++;
             else if (d == D2)
@@ -71,9 +73,4 @@
         }
     }
 
-    @Override
-    public IntResult3 newResult() {
-        return new IntResult3();
-    }
-
 }
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/FloatBufferInterleaveTest.java	Fri Mar 14 02:59:43 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/FloatBufferInterleaveTest.java	Fri Mar 14 03:26:33 2014 +0400
@@ -24,12 +24,18 @@
  */
 package org.openjdk.jcstress.tests.tearing.buffers;
 
+import org.openjdk.jcstress.infra.annotations.Actor;
+import org.openjdk.jcstress.infra.annotations.Arbiter;
+import org.openjdk.jcstress.infra.annotations.ConcurrencyStressTest;
+import org.openjdk.jcstress.infra.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult3;
 import org.openjdk.jcstress.tests.Actor2_Arbiter1_Test;
 
 import java.nio.FloatBuffer;
 
-public class FloatBufferInterleaveTest implements Actor2_Arbiter1_Test<FloatBuffer, IntResult3> {
+@ConcurrencyStressTest
+@State
+public class FloatBufferInterleaveTest {
 
     /** Array size: 256 bytes inevitably crosses the cache line on most implementations */
     public static final int SIZE = 256;
@@ -37,30 +43,27 @@
     public static final float F1 = (float) (Math.PI * 1);
     public static final float F2 = (float) (Math.PI * 2);
 
-    @Override
-    public FloatBuffer newState() {
-        return FloatBuffer.allocate(SIZE);
-    }
+    private final FloatBuffer buffer = FloatBuffer.allocate(SIZE);
 
-    @Override
-    public void actor1(FloatBuffer s, IntResult3 r) {
+    @Actor
+    public void actor1() {
         for (int i = 0; i < SIZE; i += 2) {
-            s.put(i, F1);
+            buffer.put(i, F1);
         }
     }
 
-    @Override
-    public void actor2(FloatBuffer s, IntResult3 r) {
+    @Actor
+    public void actor2() {
         for (int i = 1; i < SIZE; i += 2) {
-            s.put(i, F2);
+            buffer.put(i, F2);
         }
     }
 
-    @Override
-    public void arbiter1(FloatBuffer s, IntResult3 r) {
+    @Arbiter
+    public void arbiter1(IntResult3 r) {
         r.r1 = r.r2 = r.r3 = 0;
         for (int i = 0; i < SIZE; i++) {
-            float f = s.get(i);
+            float f = buffer.get(i);
             if (f == F1)
                 r.r2++;
             else if (f == F2)
@@ -70,9 +73,4 @@
         }
     }
 
-    @Override
-    public IntResult3 newResult() {
-        return new IntResult3();
-    }
-
 }
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/IntBufferInterleaveTest.java	Fri Mar 14 02:59:43 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/IntBufferInterleaveTest.java	Fri Mar 14 03:26:33 2014 +0400
@@ -24,40 +24,43 @@
  */
 package org.openjdk.jcstress.tests.tearing.buffers;
 
+import org.openjdk.jcstress.infra.annotations.Actor;
+import org.openjdk.jcstress.infra.annotations.Arbiter;
+import org.openjdk.jcstress.infra.annotations.ConcurrencyStressTest;
+import org.openjdk.jcstress.infra.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult3;
 import org.openjdk.jcstress.tests.Actor2_Arbiter1_Test;
 
 import java.nio.IntBuffer;
 
-public class IntBufferInterleaveTest implements Actor2_Arbiter1_Test<IntBuffer, IntResult3> {
+@ConcurrencyStressTest
+@State
+public class IntBufferInterleaveTest {
 
     /** Array size: 256 bytes inevitably crosses the cache line on most implementations */
     public static final int SIZE = 256;
 
-    @Override
-    public IntBuffer newState() {
-        return IntBuffer.allocate(SIZE);
-    }
+    private final IntBuffer buffer = IntBuffer.allocate(SIZE);
 
-    @Override
-    public void actor1(IntBuffer s, IntResult3 r) {
+    @Actor
+    public void actor1() {
         for (int i = 0; i < SIZE; i += 2) {
-            s.put(i, 1);
+            buffer.put(i, 1);
         }
     }
 
-    @Override
-    public void actor2(IntBuffer s, IntResult3 r) {
+    @Actor
+    public void actor2() {
         for (int i = 1; i < SIZE; i += 2) {
-            s.put(i, 2);
+            buffer.put(i, 2);
         }
     }
 
-    @Override
-    public void arbiter1(IntBuffer state, IntResult3 r) {
+    @Arbiter
+    public void arbiter1(IntResult3 r) {
         r.r1 = r.r2 = r.r3 = 0;
         for (int i = 0; i < SIZE; i++) {
-            int s = state.get(i);
+            int s = buffer.get(i);
             switch (s) {
                 case 0:
                     r.r1++;
@@ -74,9 +77,4 @@
         }
     }
 
-    @Override
-    public IntResult3 newResult() {
-        return new IntResult3();
-    }
-
 }
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/LongBufferInterleaveTest.java	Fri Mar 14 02:59:43 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/LongBufferInterleaveTest.java	Fri Mar 14 03:26:33 2014 +0400
@@ -24,41 +24,43 @@
  */
 package org.openjdk.jcstress.tests.tearing.buffers;
 
+import org.openjdk.jcstress.infra.annotations.Actor;
+import org.openjdk.jcstress.infra.annotations.Arbiter;
+import org.openjdk.jcstress.infra.annotations.ConcurrencyStressTest;
+import org.openjdk.jcstress.infra.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult3;
 import org.openjdk.jcstress.tests.Actor2_Arbiter1_Test;
 
 import java.nio.LongBuffer;
 
-
-public class LongBufferInterleaveTest implements Actor2_Arbiter1_Test<LongBuffer, IntResult3> {
+@ConcurrencyStressTest
+@State
+public class LongBufferInterleaveTest {
 
     /** Array size: 256 bytes inevitably crosses the cache line on most implementations */
     public static final int SIZE = 256;
 
-    @Override
-    public LongBuffer newState() {
-        return LongBuffer.allocate(SIZE);
-    }
+    private final LongBuffer buffer = LongBuffer.allocate(SIZE);
 
-    @Override
-    public void actor1(LongBuffer s, IntResult3 r) {
+    @Actor
+    public void actor1() {
         for (int i = 0; i < SIZE; i += 2) {
-            s.put(i, 1);
+            buffer.put(i, 1);
         }
     }
 
-    @Override
-    public void actor2(LongBuffer s, IntResult3 r) {
+    @Actor
+    public void actor2() {
         for (int i = 1; i < SIZE; i += 2) {
-            s.put(i, 2);
+            buffer.put(i, 2);
         }
     }
 
-    @Override
-    public void arbiter1(LongBuffer state, IntResult3 r) {
+    @Arbiter
+    public void arbiter1(IntResult3 r) {
         r.r1 = r.r2 = r.r3 = 0;
         for (int i = 0; i < SIZE; i++) {
-            long s = state.get(i);
+            long s = buffer.get(i);
             if (s == 0)
                 r.r1++;
             else if (s == 1)
@@ -68,9 +70,4 @@
         }
     }
 
-    @Override
-    public IntResult3 newResult() {
-        return new IntResult3();
-    }
-
 }
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/ShortBufferInterleaveTest.java	Fri Mar 14 02:59:43 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/tearing/buffers/ShortBufferInterleaveTest.java	Fri Mar 14 03:26:33 2014 +0400
@@ -24,40 +24,43 @@
  */
 package org.openjdk.jcstress.tests.tearing.buffers;
 
+import org.openjdk.jcstress.infra.annotations.Actor;
+import org.openjdk.jcstress.infra.annotations.Arbiter;
+import org.openjdk.jcstress.infra.annotations.ConcurrencyStressTest;
+import org.openjdk.jcstress.infra.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult3;
 import org.openjdk.jcstress.tests.Actor2_Arbiter1_Test;
 
 import java.nio.ShortBuffer;
 
-public class ShortBufferInterleaveTest implements Actor2_Arbiter1_Test<ShortBuffer, IntResult3> {
+@ConcurrencyStressTest
+@State
+public class ShortBufferInterleaveTest {
 
     /** Array size: 256 bytes inevitably crosses the cache line on most implementations */
     public static final int SIZE = 256;
 
-    @Override
-    public ShortBuffer newState() {
-        return ShortBuffer.allocate(SIZE);
-    }
+    private final ShortBuffer buffer = ShortBuffer.allocate(SIZE);
 
-    @Override
-    public void actor1(ShortBuffer s, IntResult3 r) {
+    @Actor
+    public void actor1() {
         for (int i = 0; i < SIZE; i += 2) {
-            s.put(i, (short)1);
+            buffer.put(i, (short) 1);
         }
     }
 
-    @Override
-    public void actor2(ShortBuffer s, IntResult3 r) {
+    @Actor
+    public void actor2() {
         for (int i = 1; i < SIZE; i += 2) {
-            s.put(i, (short)2);
+            buffer.put(i, (short) 2);
         }
     }
 
-    @Override
-    public void arbiter1(ShortBuffer state, IntResult3 r) {
+    @Arbiter
+    public void arbiter1(IntResult3 r) {
         r.r1 = r.r2 = r.r3 = 0;
         for (int i = 0; i < SIZE; i++) {
-            short s = state.get(i);
+            short s = buffer.get(i);
             switch (s) {
                 case 0:
                     r.r1++;
@@ -73,10 +76,4 @@
             }
         }
     }
-
-    @Override
-    public IntResult3 newResult() {
-        return new IntResult3();
-    }
-
 }