2013-04-09 16:54:17 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @test EnqueueMethodForCompilationTest
|
2013-08-14 19:50:23 +00:00
|
|
|
* @bug 8006683 8007288 8022832
|
2013-04-09 16:54:17 +00:00
|
|
|
* @library /testlibrary /testlibrary/whitebox
|
|
|
|
* @build EnqueueMethodForCompilationTest
|
|
|
|
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
2013-08-14 19:50:23 +00:00
|
|
|
* @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* EnqueueMethodForCompilationTest
|
2013-04-16 17:04:01 +00:00
|
|
|
* @summary testing of WB::enqueueMethodForCompilation()
|
2013-04-09 16:54:17 +00:00
|
|
|
* @author igor.ignatyev@oracle.com
|
|
|
|
*/
|
|
|
|
public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest {
|
2013-04-16 17:04:01 +00:00
|
|
|
|
2013-04-09 16:54:17 +00:00
|
|
|
public static void main(String[] args) throws Exception {
|
2013-04-16 17:04:01 +00:00
|
|
|
for (TestCase test : TestCase.values()) {
|
|
|
|
new EnqueueMethodForCompilationTest(test).runTest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public EnqueueMethodForCompilationTest(TestCase testCase) {
|
|
|
|
super(testCase);
|
|
|
|
// to prevent inlining of #method
|
|
|
|
WHITE_BOX.testSetDontInlineMethod(method, true);
|
2013-04-09 16:54:17 +00:00
|
|
|
}
|
|
|
|
|
2013-04-16 17:04:01 +00:00
|
|
|
@Override
|
2013-04-09 16:54:17 +00:00
|
|
|
protected void test() throws Exception {
|
2013-04-16 17:04:01 +00:00
|
|
|
checkNotCompiled();
|
2013-04-09 16:54:17 +00:00
|
|
|
|
2013-04-16 17:04:01 +00:00
|
|
|
// method can not be compiled on level 'none'
|
|
|
|
WHITE_BOX.enqueueMethodForCompilation(method, COMP_LEVEL_NONE);
|
2013-08-14 19:50:23 +00:00
|
|
|
if (isCompilable(COMP_LEVEL_NONE)) {
|
2013-04-16 17:04:01 +00:00
|
|
|
throw new RuntimeException(method
|
|
|
|
+ " is compilable at level COMP_LEVEL_NONE");
|
2013-04-09 16:54:17 +00:00
|
|
|
}
|
2013-04-16 17:04:01 +00:00
|
|
|
checkNotCompiled();
|
2013-04-09 16:54:17 +00:00
|
|
|
|
2013-04-16 17:04:01 +00:00
|
|
|
// COMP_LEVEL_ANY is inapplicable as level for compilation
|
|
|
|
WHITE_BOX.enqueueMethodForCompilation(method, COMP_LEVEL_ANY);
|
|
|
|
checkNotCompiled();
|
2013-04-09 16:54:17 +00:00
|
|
|
|
2013-08-14 19:50:23 +00:00
|
|
|
// not existing comp level
|
|
|
|
WHITE_BOX.enqueueMethodForCompilation(method, 42);
|
2013-04-16 17:04:01 +00:00
|
|
|
checkNotCompiled();
|
2013-04-09 16:54:17 +00:00
|
|
|
|
2013-08-14 19:50:23 +00:00
|
|
|
compile();
|
|
|
|
checkCompiled();
|
|
|
|
|
|
|
|
int compLevel = getCompLevel();
|
|
|
|
int bci = WHITE_BOX.getMethodEntryBci(method);
|
|
|
|
System.out.println("bci = " + bci);
|
|
|
|
printInfo();
|
|
|
|
deoptimize();
|
|
|
|
printInfo();
|
|
|
|
checkNotCompiled();
|
|
|
|
printInfo();
|
|
|
|
WHITE_BOX.enqueueMethodForCompilation(method, compLevel, bci);
|
2013-04-16 17:04:01 +00:00
|
|
|
checkCompiled();
|
2013-08-14 19:50:23 +00:00
|
|
|
deoptimize();
|
2013-04-16 17:04:01 +00:00
|
|
|
checkNotCompiled();
|
2013-04-09 16:54:17 +00:00
|
|
|
|
|
|
|
compile();
|
2013-04-16 17:04:01 +00:00
|
|
|
checkCompiled();
|
2013-08-14 19:50:23 +00:00
|
|
|
deoptimize();
|
2013-04-16 17:04:01 +00:00
|
|
|
checkNotCompiled();
|
2013-04-09 16:54:17 +00:00
|
|
|
}
|
|
|
|
}
|