8066770: EnqueueMethodForCompilationTest.java fails to compile method

Make compiles blocking and always check queue

Reviewed-by: kvn
This commit is contained in:
Nils Eliasson 2016-03-09 21:20:43 +01:00
parent 9e21021abb
commit b01a1a42e3
5 changed files with 46 additions and 11 deletions

View File

@ -22,6 +22,7 @@
*/
import java.util.function.Function;
import compiler.whitebox.CompilerWhiteBoxTest;
/*
@ -32,14 +33,24 @@ import compiler.whitebox.CompilerWhiteBoxTest;
* @build ClearMethodStateTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* ClearMethodStateTest
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ClearMethodStateTest
* @summary testing of WB::clearMethodState()
* @author igor.ignatyev@oracle.com
*/
public class ClearMethodStateTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception {
CompilerWhiteBoxTest.main(ClearMethodStateTest::new, args);
String directive =
"[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " +
" { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]";
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
throw new RuntimeException("Could not add directive");
}
try {
CompilerWhiteBoxTest.main(ClearMethodStateTest::new, args);
} finally {
WHITE_BOX.removeCompilerDirective(2);
}
}
private ClearMethodStateTest(TestCase testCase) {
@ -58,6 +69,7 @@ public class ClearMethodStateTest extends CompilerWhiteBoxTest {
*/
@Override
protected void test() throws Exception {
checkNotCompiled();
compile();
WHITE_BOX.clearMethodState(method);

View File

@ -213,6 +213,7 @@ public abstract class CompilerWhiteBoxTest {
* compilation level.
*/
protected final void checkNotCompiled() {
waitBackgroundCompilation();
checkNotCompiled(true);
checkNotCompiled(false);
}
@ -226,7 +227,6 @@ public abstract class CompilerWhiteBoxTest {
* compilation level.
*/
protected final void checkNotCompiled(boolean isOsr) {
waitBackgroundCompilation();
if (WHITE_BOX.isMethodQueuedForCompilation(method)) {
throw new RuntimeException(method + " must not be in queue");
}
@ -315,11 +315,11 @@ public abstract class CompilerWhiteBoxTest {
return;
}
final Object obj = new Object();
for (int i = 0; i < 10
for (int i = 0; i < 100
&& WHITE_BOX.isMethodQueuedForCompilation(executable); ++i) {
synchronized (obj) {
try {
obj.wait(1000);
obj.wait(100);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}

View File

@ -31,14 +31,24 @@ import compiler.whitebox.CompilerWhiteBoxTest;
* @build EnqueueMethodForCompilationTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* EnqueueMethodForCompilationTest
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI EnqueueMethodForCompilationTest
* @summary testing of WB::enqueueMethodForCompilation()
* @author igor.ignatyev@oracle.com
*/
public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception {
CompilerWhiteBoxTest.main(EnqueueMethodForCompilationTest::new, args);
String directive =
"[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " +
" { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]";
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
throw new RuntimeException("Could not add directive");
}
try {
CompilerWhiteBoxTest.main(EnqueueMethodForCompilationTest::new, args);
} finally {
WHITE_BOX.removeCompilerDirective(2);
}
}
private EnqueueMethodForCompilationTest(TestCase testCase) {

View File

@ -29,7 +29,7 @@
* @build LockCompilationTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* LockCompilationTest
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI LockCompilationTest
* @summary testing of WB::lock/unlockCompilation()
*/
@ -37,12 +37,15 @@ import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import compiler.whitebox.CompilerWhiteBoxTest;
import jdk.test.lib.Asserts;
public class LockCompilationTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception {
CompilerWhiteBoxTest.main(LockCompilationTest::new, args);
// This case waits for 10 seconds and verifies that the method hasn't been
// compiled during that time. Only do that for one of the test cases.
CompilerWhiteBoxTest.main(LockCompilationTest::new, new String[] {"METHOD_TEST"});
}
private LockCompilationTest(TestCase testCase) {

View File

@ -31,14 +31,24 @@ import compiler.whitebox.CompilerWhiteBoxTest;
* @build MakeMethodNotCompilableTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* MakeMethodNotCompilableTest
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmixed MakeMethodNotCompilableTest
* @summary testing of WB::makeMethodNotCompilable()
* @author igor.ignatyev@oracle.com
*/
public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
private int bci;
public static void main(String[] args) throws Exception {
CompilerWhiteBoxTest.main(MakeMethodNotCompilableTest::new, args);
String directive =
"[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " +
" { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]";
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
throw new RuntimeException("Could not add directive");
}
try {
CompilerWhiteBoxTest.main(MakeMethodNotCompilableTest::new, args);
} finally {
WHITE_BOX.removeCompilerDirective(2);
}
}
private MakeMethodNotCompilableTest(TestCase testCase) {