changeset 158:c963288a9190

Remove obsolete StateHolder.loops.
author shade
date Tue, 05 Aug 2014 02:12:45 +0400
parents 2299f218159a
children 7b7c084bd05f
files jcstress-core/src/main/java/org/openjdk/jcstress/infra/processors/JCStressTestProcessor.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/runners/StateHolder.java
diffstat 2 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/processors/JCStressTestProcessor.java	Tue Aug 05 02:07:58 2014 +0400
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/processors/JCStressTestProcessor.java	Tue Aug 05 02:12:45 2014 +0400
@@ -319,8 +319,8 @@
         pw.println();
         pw.println("        public void newEpoch(StateHolder<Pair> holder) {");
 
-        pw.println("            int loops = holder.loops;");
         pw.println("            Pair[] pairs = holder.pairs;");
+        pw.println("            int len = pairs.length;");
 
         if (info.getArbiter() != null) {
             pw.println();
@@ -337,7 +337,7 @@
         pw.println("                counter.record(p.r);");
         pw.println("            }");
         pw.println();
-        pw.println("            int newLoops = holder.hasLaggedWorkers ? Math.max(control.minStride, Math.min(loops * 2, control.maxStride)) : loops;");
+        pw.println("            int newLen = holder.hasLaggedWorkers ? Math.max(control.minStride, Math.min(len * 2, control.maxStride)) : len;");
         pw.println();
         pw.println("            for (Pair p : pairs) {");
         pw.println("                " + r + " r = p.r;");
@@ -362,9 +362,9 @@
         pw.println("            }");
         pw.println();
         pw.println("            Pair[] newPairs = pairs;");
-        pw.println("            if (newLoops > loops) {");
-        pw.println("                newPairs = Arrays.copyOf(pairs, newLoops);");
-        pw.println("                for (int c = loops; c < newLoops; c++) {");
+        pw.println("            if (newLen > len) {");
+        pw.println("                newPairs = Arrays.copyOf(pairs, newLen);");
+        pw.println("                for (int c = len; c < newLen; c++) {");
         pw.println("                    newPairs[c] = new Pair();");
         pw.println("                    newPairs[c].r = new " + r + "();");
         pw.println("                }");
@@ -396,7 +396,6 @@
             pw.println("                    return null;");
             pw.println("                }");
             pw.println();
-            pw.println("                int loops = holder.loops;");
             pw.println("                Pair[] pairs = holder.pairs;");
             pw.println();
             pw.println("                holder.preRun(control.shouldYield);");
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/runners/StateHolder.java	Tue Aug 05 02:07:58 2014 +0400
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/runners/StateHolder.java	Tue Aug 05 02:12:45 2014 +0400
@@ -32,7 +32,6 @@
 public class StateHolder<P> {
     public final boolean stopped;
     public final P[] pairs;
-    public final int loops;
     public final int countWorkers;
     public final AtomicInteger started, ready, finished, consumed;
     public volatile boolean notAllStarted, notAllReady, notAllFinished, notAllConsumed;
@@ -41,7 +40,6 @@
     public StateHolder(boolean stopped, P[] pairs, int expectedWorkers) {
         this.stopped = stopped;
         this.pairs = pairs;
-        this.loops = pairs.length;
         this.countWorkers = expectedWorkers;
         this.ready = new AtomicInteger(expectedWorkers);
         this.started = new AtomicInteger(expectedWorkers);