39 * |
39 * |
40 * @author igor.ignatyev@oracle.com |
40 * @author igor.ignatyev@oracle.com |
41 */ |
41 */ |
42 public abstract class CompilerWhiteBoxTest { |
42 public abstract class CompilerWhiteBoxTest { |
43 /** {@code CompLevel::CompLevel_none} -- Interpreter */ |
43 /** {@code CompLevel::CompLevel_none} -- Interpreter */ |
44 protected static int COMP_LEVEL_NONE = 0; |
44 protected static final int COMP_LEVEL_NONE = 0; |
45 /** {@code CompLevel::CompLevel_any}, {@code CompLevel::CompLevel_all} */ |
45 /** {@code CompLevel::CompLevel_any}, {@code CompLevel::CompLevel_all} */ |
46 protected static int COMP_LEVEL_ANY = -1; |
46 protected static final int COMP_LEVEL_ANY = -1; |
47 /** {@code CompLevel::CompLevel_simple} -- C1 */ |
47 /** {@code CompLevel::CompLevel_simple} -- C1 */ |
48 protected static int COMP_LEVEL_SIMPLE = 1; |
48 protected static final int COMP_LEVEL_SIMPLE = 1; |
49 /** {@code CompLevel::CompLevel_limited_profile} -- C1, invocation & backedge counters */ |
49 /** {@code CompLevel::CompLevel_limited_profile} -- C1, invocation & backedge counters */ |
50 protected static int COMP_LEVEL_LIMITED_PROFILE = 2; |
50 protected static final int COMP_LEVEL_LIMITED_PROFILE = 2; |
51 /** {@code CompLevel::CompLevel_full_profile} -- C1, invocation & backedge counters + mdo */ |
51 /** {@code CompLevel::CompLevel_full_profile} -- C1, invocation & backedge counters + mdo */ |
52 protected static int COMP_LEVEL_FULL_PROFILE = 3; |
52 protected static final int COMP_LEVEL_FULL_PROFILE = 3; |
53 /** {@code CompLevel::CompLevel_full_optimization} -- C2 or Shark */ |
53 /** {@code CompLevel::CompLevel_full_optimization} -- C2 or Shark */ |
54 protected static int COMP_LEVEL_FULL_OPTIMIZATION = 4; |
54 protected static final int COMP_LEVEL_FULL_OPTIMIZATION = 4; |
55 /** Maximal value for CompLevel */ |
55 /** Maximal value for CompLevel */ |
56 protected static int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION; |
56 protected static final int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION; |
57 |
57 |
58 /** Instance of WhiteBox */ |
58 /** Instance of WhiteBox */ |
59 protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); |
59 protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); |
60 /** Value of {@code -XX:CompileThreshold} */ |
60 /** Value of {@code -XX:CompileThreshold} */ |
61 protected static final int COMPILE_THRESHOLD |
61 protected static final int COMPILE_THRESHOLD |
345 */ |
345 */ |
346 protected final void printInfo() { |
346 protected final void printInfo() { |
347 System.out.printf("%n%s:%n", method); |
347 System.out.printf("%n%s:%n", method); |
348 System.out.printf("\tcompilable:\t%b%n", |
348 System.out.printf("\tcompilable:\t%b%n", |
349 WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, false)); |
349 WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, false)); |
350 System.out.printf("\tcompiled:\t%b%n", |
350 boolean isCompiled = WHITE_BOX.isMethodCompiled(method, false); |
351 WHITE_BOX.isMethodCompiled(method, false)); |
351 System.out.printf("\tcompiled:\t%b%n", isCompiled); |
|
352 if (isCompiled) { |
|
353 System.out.printf("\tcompile_id:\t%d%n", |
|
354 NMethod.get(method, false).compile_id); |
|
355 } |
352 System.out.printf("\tcomp_level:\t%d%n", |
356 System.out.printf("\tcomp_level:\t%d%n", |
353 WHITE_BOX.getMethodCompilationLevel(method, false)); |
357 WHITE_BOX.getMethodCompilationLevel(method, false)); |
354 System.out.printf("\tosr_compilable:\t%b%n", |
358 System.out.printf("\tosr_compilable:\t%b%n", |
355 WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, true)); |
359 WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, true)); |
356 System.out.printf("\tosr_compiled:\t%b%n", |
360 isCompiled = WHITE_BOX.isMethodCompiled(method, true); |
357 WHITE_BOX.isMethodCompiled(method, true)); |
361 System.out.printf("\tosr_compiled:\t%b%n", isCompiled); |
|
362 if (isCompiled) { |
|
363 System.out.printf("\tosr_compile_id:\t%d%n", |
|
364 NMethod.get(method, true).compile_id); |
|
365 } |
358 System.out.printf("\tosr_comp_level:\t%d%n", |
366 System.out.printf("\tosr_comp_level:\t%d%n", |
359 WHITE_BOX.getMethodCompilationLevel(method, true)); |
367 WHITE_BOX.getMethodCompilationLevel(method, true)); |
360 System.out.printf("\tin_queue:\t%b%n", |
368 System.out.printf("\tin_queue:\t%b%n", |
361 WHITE_BOX.isMethodQueuedForCompilation(method)); |
369 WHITE_BOX.isMethodQueuedForCompilation(method)); |
362 System.out.printf("compile_queues_size:\t%d%n%n", |
370 System.out.printf("compile_queues_size:\t%d%n%n", |
434 if (result && IS_VERBOSE) { |
442 if (result && IS_VERBOSE) { |
435 System.err.printf("Warning: %s is not applicable in %s%n", |
443 System.err.printf("Warning: %s is not applicable in %s%n", |
436 testCase.name(), CompilerWhiteBoxTest.MODE); |
444 testCase.name(), CompilerWhiteBoxTest.MODE); |
437 } |
445 } |
438 return result; |
446 return result; |
|
447 } |
|
448 |
|
449 /** |
|
450 * Skip the test for the specified value of Tiered Compilation |
|
451 * @param value of TieredCompilation the test should not run with |
|
452 * @return {@code true} if the test should be skipped, |
|
453 * {@code false} otherwise |
|
454 */ |
|
455 protected static boolean skipOnTieredCompilation(boolean value) { |
|
456 if (value == CompilerWhiteBoxTest.TIERED_COMPILATION) { |
|
457 System.err.println("Test isn't applicable w/ " |
|
458 + (value ? "enabled" : "disabled") |
|
459 + "TieredCompilation. Skip test."); |
|
460 return true; |
|
461 } |
|
462 return false; |
439 } |
463 } |
440 } |
464 } |
441 |
465 |
442 enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase { |
466 enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase { |
443 /** constructor test case */ |
467 /** constructor test case */ |