test/compiler/whitebox/CompilerWhiteBoxTest.java

changeset 9689
89dcef434423
parent 9479
b4ee249eb1c4
child 9690
61d955db2a5b
     1.1 --- a/test/compiler/whitebox/CompilerWhiteBoxTest.java	Sun Mar 31 16:57:21 2019 -0700
     1.2 +++ b/test/compiler/whitebox/CompilerWhiteBoxTest.java	Mon Jun 03 16:14:54 2019 +0100
     1.3 @@ -41,19 +41,19 @@
     1.4   */
     1.5  public abstract class CompilerWhiteBoxTest {
     1.6      /** {@code CompLevel::CompLevel_none} -- Interpreter */
     1.7 -    protected static int COMP_LEVEL_NONE = 0;
     1.8 +    protected static final int COMP_LEVEL_NONE = 0;
     1.9      /** {@code CompLevel::CompLevel_any}, {@code CompLevel::CompLevel_all} */
    1.10 -    protected static int COMP_LEVEL_ANY = -1;
    1.11 +    protected static final int COMP_LEVEL_ANY = -1;
    1.12      /** {@code CompLevel::CompLevel_simple} -- C1 */
    1.13 -    protected static int COMP_LEVEL_SIMPLE = 1;
    1.14 +    protected static final int COMP_LEVEL_SIMPLE = 1;
    1.15      /** {@code CompLevel::CompLevel_limited_profile} -- C1, invocation & backedge counters */
    1.16 -    protected static int COMP_LEVEL_LIMITED_PROFILE = 2;
    1.17 +    protected static final int COMP_LEVEL_LIMITED_PROFILE = 2;
    1.18      /** {@code CompLevel::CompLevel_full_profile} -- C1, invocation & backedge counters + mdo */
    1.19 -    protected static int COMP_LEVEL_FULL_PROFILE = 3;
    1.20 +    protected static final int COMP_LEVEL_FULL_PROFILE = 3;
    1.21      /** {@code CompLevel::CompLevel_full_optimization} -- C2 or Shark */
    1.22 -    protected static int COMP_LEVEL_FULL_OPTIMIZATION = 4;
    1.23 +    protected static final int COMP_LEVEL_FULL_OPTIMIZATION = 4;
    1.24      /** Maximal value for CompLevel */
    1.25 -    protected static int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION;
    1.26 +    protected static final int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION;
    1.27  
    1.28      /** Instance of WhiteBox */
    1.29      protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
    1.30 @@ -347,14 +347,22 @@
    1.31          System.out.printf("%n%s:%n", method);
    1.32          System.out.printf("\tcompilable:\t%b%n",
    1.33                  WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, false));
    1.34 -        System.out.printf("\tcompiled:\t%b%n",
    1.35 -                WHITE_BOX.isMethodCompiled(method, false));
    1.36 +        boolean isCompiled = WHITE_BOX.isMethodCompiled(method, false);
    1.37 +        System.out.printf("\tcompiled:\t%b%n", isCompiled);
    1.38 +        if (isCompiled) {
    1.39 +            System.out.printf("\tcompile_id:\t%d%n",
    1.40 +                    NMethod.get(method, false).compile_id);
    1.41 +        }
    1.42          System.out.printf("\tcomp_level:\t%d%n",
    1.43                  WHITE_BOX.getMethodCompilationLevel(method, false));
    1.44          System.out.printf("\tosr_compilable:\t%b%n",
    1.45                  WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, true));
    1.46 -        System.out.printf("\tosr_compiled:\t%b%n",
    1.47 -                WHITE_BOX.isMethodCompiled(method, true));
    1.48 +        isCompiled = WHITE_BOX.isMethodCompiled(method, true);
    1.49 +        System.out.printf("\tosr_compiled:\t%b%n", isCompiled);
    1.50 +        if (isCompiled) {
    1.51 +            System.out.printf("\tosr_compile_id:\t%d%n",
    1.52 +                    NMethod.get(method, true).compile_id);
    1.53 +        }
    1.54          System.out.printf("\tosr_comp_level:\t%d%n",
    1.55                  WHITE_BOX.getMethodCompilationLevel(method, true));
    1.56          System.out.printf("\tin_queue:\t%b%n",
    1.57 @@ -437,6 +445,22 @@
    1.58          }
    1.59          return result;
    1.60      }
    1.61 +
    1.62 +    /**
    1.63 +     * Skip the test for the specified value of Tiered Compilation
    1.64 +     * @param value of TieredCompilation the test should not run with
    1.65 +     * @return {@code true} if the test should be skipped,
    1.66 +     *         {@code false} otherwise
    1.67 +     */
    1.68 +    protected static boolean skipOnTieredCompilation(boolean value) {
    1.69 +        if (value == CompilerWhiteBoxTest.TIERED_COMPILATION) {
    1.70 +            System.err.println("Test isn't applicable w/ "
    1.71 +                    + (value ? "enabled" : "disabled")
    1.72 +                    + "TieredCompilation. Skip test.");
    1.73 +            return true;
    1.74 +        }
    1.75 +        return false;
    1.76 +    }
    1.77  }
    1.78  
    1.79  enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {

mercurial