changeset 37:fe25a061722e

Deoptimize infrastructure methods only.
author shade
date Wed, 07 Aug 2013 13:03:43 +0400
parents b5caaed49020
children 4bc0cc31b700
files harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor1_Runner.java harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor2_Arbiter1_Runner.java harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor2_Runner.java harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor3_Runner.java harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor4_Runner.java harness/src/main/java/org/openjdk/jcstress/infra/runners/TerminationRunner.java harness/src/main/java/org/openjdk/jcstress/util/Reflections.java harness/src/main/java/org/openjdk/jcstress/util/VMSupport.java
diffstat 8 files changed, 58 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor1_Runner.java	Fri Aug 02 02:52:05 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor1_Runner.java	Wed Aug 07 13:03:43 2013 +0400
@@ -76,7 +76,7 @@
         testLog.print("Iterations ");
         for (int c = 0; c < iters; c++) {
             if (c % deoptEachIter == 0) {
-                VMSupport.tryDeoptimizeAll();
+                VMSupport.tryDeoptimizeAllInfra();
             }
 
             testLog.print(".");
--- a/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor2_Arbiter1_Runner.java	Fri Aug 02 02:52:05 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor2_Arbiter1_Runner.java	Wed Aug 07 13:03:43 2013 +0400
@@ -68,7 +68,7 @@
         testLog.print("Iterations ");
         for (int c = 0; c < iters; c++) {
             if (c % deoptEachIter == 0) {
-                VMSupport.tryDeoptimizeAll();
+                VMSupport.tryDeoptimizeAllInfra();
             }
 
             testLog.print(".");
--- a/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor2_Runner.java	Fri Aug 02 02:52:05 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor2_Runner.java	Wed Aug 07 13:03:43 2013 +0400
@@ -76,7 +76,7 @@
         testLog.print("Iterations ");
         for (int c = 0; c < iters; c++) {
             if (c % deoptEachIter == 0) {
-                VMSupport.tryDeoptimizeAll();
+                VMSupport.tryDeoptimizeAllInfra();
             }
 
             testLog.print(".");
--- a/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor3_Runner.java	Fri Aug 02 02:52:05 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor3_Runner.java	Wed Aug 07 13:03:43 2013 +0400
@@ -76,7 +76,7 @@
         testLog.print("Iterations ");
         for (int c = 0; c < iters; c++) {
             if (c % deoptEachIter == 0) {
-                VMSupport.tryDeoptimizeAll();
+                VMSupport.tryDeoptimizeAllInfra();
             }
 
             testLog.print(".");
--- a/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor4_Runner.java	Fri Aug 02 02:52:05 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor4_Runner.java	Wed Aug 07 13:03:43 2013 +0400
@@ -76,7 +76,7 @@
         testLog.print("Iterations ");
         for (int c = 0; c < iters; c++) {
             if (c % deoptEachIter == 0) {
-                VMSupport.tryDeoptimizeAll();
+                VMSupport.tryDeoptimizeAllInfra();
             }
 
             testLog.print(".");
--- a/harness/src/main/java/org/openjdk/jcstress/infra/runners/TerminationRunner.java	Fri Aug 02 02:52:05 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/infra/runners/TerminationRunner.java	Wed Aug 07 13:03:43 2013 +0400
@@ -64,7 +64,7 @@
         testLog.print("Iterations ");
         for (int c = 0; c < iters; c++) {
             if (c % deoptEachIter == 0) {
-                VMSupport.tryDeoptimizeAll();
+                VMSupport.tryDeoptimizeAllInfra();
             }
 
             testLog.print(".");
--- a/harness/src/main/java/org/openjdk/jcstress/util/Reflections.java	Fri Aug 02 02:52:05 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/util/Reflections.java	Wed Aug 07 13:03:43 2013 +0400
@@ -96,19 +96,27 @@
         }
     }
 
-    private static Collection<Class> getClasses(final String filter) throws IOException {
+    public static Collection<Class> getClasses(final String filter) throws IOException {
+        final List<Class> newClasses = new ArrayList<Class>();
+        for (String name : getClassNames(filter)) {
+            try {
+                newClasses.add(Class.forName(name));
+            } catch (ClassNotFoundException e) {
+                throw new IllegalStateException(e.getMessage(), e);
+            }
+        }
+        return newClasses;
+    }
+
+    public static Collection<String> getClassNames(final String filter) throws IOException {
         ensureInited();
 
-        final List<Class> newClasses = new ArrayList<Class>();
+        final List<String> newClasses = new ArrayList<String>();
         for (String name : RESOURCES) {
             name = name.replaceAll("\\\\", ".");
             name = name.replaceAll("/", ".");
             if (name.contains(filter) && name.endsWith(".class")) {
-                try {
-                    newClasses.add(Class.forName(name.substring(name.indexOf(filter), name.length() - 6)));
-                } catch (ClassNotFoundException e) {
-                    throw new IllegalStateException(e.getMessage(), e);
-                }
+                newClasses.add(name.substring(name.indexOf(filter), name.length() - 6));
             }
         }
 
--- a/harness/src/main/java/org/openjdk/jcstress/util/VMSupport.java	Fri Aug 02 02:52:05 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/util/VMSupport.java	Wed Aug 07 13:03:43 2013 +0400
@@ -26,10 +26,17 @@
 
 import sun.hotspot.WhiteBox;
 
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
 public class VMSupport {
 
     private static WhiteBox whiteBox;
     private static volatile boolean inited;
+    private static volatile Collection<Method> infraMethods;
 
     public static boolean tryInit() {
         if (inited) return true;
@@ -46,6 +53,36 @@
         }
     }
 
+    public static void tryDeoptimizeAllInfra() {
+        WhiteBox w = whiteBox;
+        if (w != null) {
+            try {
+                Collection<Method> im = infraMethods;
+                if (im == null) {
+                    im = new ArrayList<Method>();
+                    Collection<String> infraNames = new ArrayList<String>();
+                    infraNames.addAll(Reflections.getClassNames("org.openjdk.jcstress.infra"));
+                    infraNames.addAll(Reflections.getClassNames("org.openjdk.jcstress.util"));
+                    for (String name : infraNames) {
+                        try {
+                            Class<?> aClass = Class.forName(name);
+                            Collections.addAll(im, aClass.getMethods());
+                        } catch (ClassNotFoundException e) {
+                            throw new IllegalStateException();
+                        }
+                    }
+                    infraMethods = im;
+                }
+
+                for (Method m : im) {
+                    w.deoptimizeMethod(m);
+                }
+            } catch (IOException e) {
+                throw new IllegalStateException();
+            }
+        }
+    }
+
     public static void tryDeoptimizeAll() {
         WhiteBox w = whiteBox;
         if (w != null) {