comparison test/compiler/whitebox/EnqueueMethodForCompilationTest.java @ 12073:f99558245e5c

8022832: Add WB APIs for OSR compilation Reviewed-by: kvn
author iignatyev
date Wed, 14 Aug 2013 23:50:23 +0400
parents 11237ee74aae
children 303826f477c6
comparison
equal deleted inserted replaced
12072:6c72125a2f40 12073:f99558245e5c
21 * questions. 21 * questions.
22 */ 22 */
23 23
24 /* 24 /*
25 * @test EnqueueMethodForCompilationTest 25 * @test EnqueueMethodForCompilationTest
26 * @bug 8006683 8007288 8022832
26 * @library /testlibrary /testlibrary/whitebox 27 * @library /testlibrary /testlibrary/whitebox
27 * @build EnqueueMethodForCompilationTest 28 * @build EnqueueMethodForCompilationTest
28 * @run main ClassFileInstaller sun.hotspot.WhiteBox 29 * @run main ClassFileInstaller sun.hotspot.WhiteBox
29 * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* EnqueueMethodForCompilationTest 30 * @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* EnqueueMethodForCompilationTest
30 * @summary testing of WB::enqueueMethodForCompilation() 31 * @summary testing of WB::enqueueMethodForCompilation()
31 * @author igor.ignatyev@oracle.com 32 * @author igor.ignatyev@oracle.com
32 */ 33 */
33 public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest { 34 public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest {
34 35
48 protected void test() throws Exception { 49 protected void test() throws Exception {
49 checkNotCompiled(); 50 checkNotCompiled();
50 51
51 // method can not be compiled on level 'none' 52 // method can not be compiled on level 'none'
52 WHITE_BOX.enqueueMethodForCompilation(method, COMP_LEVEL_NONE); 53 WHITE_BOX.enqueueMethodForCompilation(method, COMP_LEVEL_NONE);
53 if (WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_NONE)) { 54 if (isCompilable(COMP_LEVEL_NONE)) {
54 throw new RuntimeException(method 55 throw new RuntimeException(method
55 + " is compilable at level COMP_LEVEL_NONE"); 56 + " is compilable at level COMP_LEVEL_NONE");
56 } 57 }
57 checkNotCompiled(); 58 checkNotCompiled();
58 59
59 // COMP_LEVEL_ANY is inapplicable as level for compilation 60 // COMP_LEVEL_ANY is inapplicable as level for compilation
60 WHITE_BOX.enqueueMethodForCompilation(method, COMP_LEVEL_ANY); 61 WHITE_BOX.enqueueMethodForCompilation(method, COMP_LEVEL_ANY);
61 checkNotCompiled(); 62 checkNotCompiled();
62 63
63 WHITE_BOX.enqueueMethodForCompilation(method, 5); 64 // not existing comp level
64 if (!WHITE_BOX.isMethodCompilable(method, 5)) { 65 WHITE_BOX.enqueueMethodForCompilation(method, 42);
65 checkNotCompiled();
66 compile();
67 checkCompiled();
68 } else {
69 checkCompiled();
70 }
71
72 int compLevel = WHITE_BOX.getMethodCompilationLevel(method);
73 WHITE_BOX.deoptimizeMethod(method);
74 checkNotCompiled();
75
76 WHITE_BOX.enqueueMethodForCompilation(method, compLevel);
77 checkCompiled();
78 WHITE_BOX.deoptimizeMethod(method);
79 checkNotCompiled(); 66 checkNotCompiled();
80 67
81 compile(); 68 compile();
82 checkCompiled(); 69 checkCompiled();
83 WHITE_BOX.deoptimizeMethod(method); 70
71 int compLevel = getCompLevel();
72 int bci = WHITE_BOX.getMethodEntryBci(method);
73 System.out.println("bci = " + bci);
74 printInfo();
75 deoptimize();
76 printInfo();
77 checkNotCompiled();
78 printInfo();
79 WHITE_BOX.enqueueMethodForCompilation(method, compLevel, bci);
80 checkCompiled();
81 deoptimize();
82 checkNotCompiled();
83
84 compile();
85 checkCompiled();
86 deoptimize();
84 checkNotCompiled(); 87 checkNotCompiled();
85 } 88 }
86 } 89 }