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