test/compiler/whitebox/CompilerWhiteBoxTest.java

Print this page

        

@@ -36,23 +36,23 @@
  *
  * @author igor.ignatyev@oracle.com
  */
 public abstract class CompilerWhiteBoxTest {
     /** {@code CompLevel::CompLevel_none} -- Interpreter */
-    protected static int COMP_LEVEL_NONE = 0;
+    protected static final int COMP_LEVEL_NONE = 0;
     /** {@code CompLevel::CompLevel_any}, {@code CompLevel::CompLevel_all} */
-    protected static int COMP_LEVEL_ANY = -1;
+    protected static final int COMP_LEVEL_ANY = -1;
     /** {@code CompLevel::CompLevel_simple} -- C1 */
-    protected static int COMP_LEVEL_SIMPLE = 1;
+    protected static final int COMP_LEVEL_SIMPLE = 1;
     /** {@code CompLevel::CompLevel_limited_profile} -- C1, invocation & backedge counters */
-    protected static int COMP_LEVEL_LIMITED_PROFILE = 2;
+    protected static final int COMP_LEVEL_LIMITED_PROFILE = 2;
     /** {@code CompLevel::CompLevel_full_profile} -- C1, invocation & backedge counters + mdo */
-    protected static int COMP_LEVEL_FULL_PROFILE = 3;
+    protected static final int COMP_LEVEL_FULL_PROFILE = 3;
     /** {@code CompLevel::CompLevel_full_optimization} -- C2 or Shark */
-    protected static int COMP_LEVEL_FULL_OPTIMIZATION = 4;
+    protected static final int COMP_LEVEL_FULL_OPTIMIZATION = 4;
     /** Maximal value for CompLevel */
-    protected static int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION;
+    protected static final int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION;
 
     /** Instance of WhiteBox */
     protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
     /** Value of {@code -XX:CompileThreshold} */
     protected static final int COMPILE_THRESHOLD

@@ -334,18 +334,26 @@
      */
     protected final void printInfo() {
         System.out.printf("%n%s:%n", method);
         System.out.printf("\tcompilable:\t%b%n",
                 WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, false));
-        System.out.printf("\tcompiled:\t%b%n",
-                WHITE_BOX.isMethodCompiled(method, false));
+        boolean isCompiled = WHITE_BOX.isMethodCompiled(method, false);
+        System.out.printf("\tcompiled:\t%b%n", isCompiled);
+        if (isCompiled) {
+            System.out.printf("\tcompile_id:\t%d%n",
+                    NMethod.get(method, false).compile_id);
+        }
         System.out.printf("\tcomp_level:\t%d%n",
                 WHITE_BOX.getMethodCompilationLevel(method, false));
         System.out.printf("\tosr_compilable:\t%b%n",
                 WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, true));
-        System.out.printf("\tosr_compiled:\t%b%n",
-                WHITE_BOX.isMethodCompiled(method, true));
+        isCompiled = WHITE_BOX.isMethodCompiled(method, true);
+        System.out.printf("\tosr_compiled:\t%b%n", isCompiled);
+        if (isCompiled) {
+            System.out.printf("\tosr_compile_id:\t%d%n",
+                    NMethod.get(method, true).compile_id);
+        }
         System.out.printf("\tosr_comp_level:\t%d%n",
                 WHITE_BOX.getMethodCompilationLevel(method, true));
         System.out.printf("\tin_queue:\t%b%n",
                 WHITE_BOX.isMethodQueuedForCompilation(method));
         System.out.printf("compile_queues_size:\t%d%n%n",

@@ -424,10 +432,26 @@
             System.err.printf("Warning: %s is not applicable in %s%n",
                     testCase.name(), CompilerWhiteBoxTest.MODE);
         }
         return result;
     }
+
+    /**
+     * Skip the test for the specified value of Tiered Compilation
+     * @param value of TieredCompilation the test should not run with
+     * @return {@code true} if the test should be skipped,
+     *         {@code false} otherwise
+     */
+    protected static boolean skipOnTieredCompilation(boolean value) {
+        if (value == CompilerWhiteBoxTest.TIERED_COMPILATION) {
+            System.err.println("Test isn't applicable w/ "
+                    + (value ? "enabled" : "disabled")
+                    + "TieredCompilation. Skip test.");
+            return true;
+        }
+        return false;
+    }
 }
 
 enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
     /** constructor test case */
     CONSTRUCTOR_TEST(Helper.CONSTRUCTOR, Helper.CONSTRUCTOR_CALLABLE, false),