test/compiler/whitebox/CompilerWhiteBoxTest.java

Print this page

        

@@ -35,10 +35,12 @@
     protected static final Method METHOD = getMethod("method");
     protected static final int COMPILE_THRESHOLD
             = Integer.parseInt(getVMOption("CompileThreshold", "10000"));
     protected static final boolean BACKGROUND_COMPILATION
             = Boolean.valueOf(getVMOption("BackgroundCompilation", "true"));
+    protected static final boolean TIERED_COMPILATION
+            = Boolean.valueOf(getVMOption("TieredCompilation", "false"));
 
     protected static Method getMethod(String name) {
         try {
             return CompilerWhiteBoxTest.class.getDeclaredMethod(name);
         } catch (NoSuchMethodException | SecurityException e) {

@@ -79,10 +81,13 @@
         System.out.println("at test's end:");
         printInfo(METHOD);
     }
 
     protected static void checkNotCompiled(Method method) {
+        if (WHITE_BOX.isMethodQueuedForCompilation(METHOD)) {
+            throw new RuntimeException(METHOD + " must not be in queue");
+        }
         if (WHITE_BOX.isMethodCompiled(method)) {
             throw new RuntimeException(method + " must be not compiled");
         }
         if (WHITE_BOX.getMethodCompilationLevel(method) != 0) {
             throw new RuntimeException(method + " comp_level must be == 0");

@@ -137,12 +142,15 @@
     }
 
     protected abstract void test() throws Exception;
 
     protected final int compile() {
+        return compile(Math.max(COMPILE_THRESHOLD, 150000));
+    }
+
+    protected final int compile(int count) {
         int result = 0;
-        int count = Math.max(COMPILE_THRESHOLD, 150000);
         for (int i = 0; i < count; ++i) {
             result += method();
         }
         System.out.println("method was invoked " + count + " times");
         return result;