test/compiler/whitebox/LockCompilationTest.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff test/compiler/whitebox/LockCompilationTest.java

test/compiler/whitebox/LockCompilationTest.java

Print this page
rev 10463 : [mq]: Lockcomp

*** 21,35 **** * questions. */ /* * @test LockCompilationTest ! * @bug 8059624 * @library /testlibrary /test/lib / * @modules java.management * @build LockCompilationTest ! * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI LockCompilationTest * @summary testing of WB::lock/unlockCompilation() */ --- 21,35 ---- * questions. */ /* * @test LockCompilationTest ! * @bug 8059624 8152169 * @library /testlibrary /test/lib / * @modules java.management * @build LockCompilationTest ! * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI LockCompilationTest * @summary testing of WB::lock/unlockCompilation() */
*** 40,53 **** import compiler.whitebox.CompilerWhiteBoxTest; import jdk.test.lib.Asserts; public class LockCompilationTest extends CompilerWhiteBoxTest { public static void main(String[] args) throws Exception { ! // 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) { super(testCase); // to prevent inlining of #method --- 40,68 ---- import compiler.whitebox.CompilerWhiteBoxTest; import jdk.test.lib.Asserts; public class LockCompilationTest extends CompilerWhiteBoxTest { + public static void main(String[] args) throws Exception { ! // This case waits for 5 seconds and verifies that the method hasn't been // compiled during that time. Only do that for one of the test cases. + + // Only compile SimpleTestCase$Helper.method and exclude all other to ensure no + // contention on the compile queue causes problems. + String directive = + "[{ match:\"*SimpleTestCase$Helper.method\", Exclude:false}, " + + " { match:\"*.*\", Exclude:true}]"; + if (WHITE_BOX.addCompilerDirective(directive) != 2) { + throw new RuntimeException("Could not add directive"); + } + try { CompilerWhiteBoxTest.main(LockCompilationTest::new, new String[] {"METHOD_TEST"}); + } finally { + WHITE_BOX.removeCompilerDirective(2); + } + } private LockCompilationTest(TestCase testCase) { super(testCase); // to prevent inlining of #method
*** 64,74 **** System.out.println("trying to compile"); compile(); // to check if it works correctly w/ safepoints System.out.println("going to safepoint"); WHITE_BOX.fullGC(); ! waitBackgroundCompilation(); Asserts.assertTrue( WHITE_BOX.isMethodQueuedForCompilation(method), method + " must be in queue"); Asserts.assertFalse( WHITE_BOX.isMethodCompiled(method, false), --- 79,94 ---- System.out.println("trying to compile"); compile(); // to check if it works correctly w/ safepoints System.out.println("going to safepoint"); WHITE_BOX.fullGC(); ! // Sleep a while and then make sure the compile is still waiting ! try { ! Thread.sleep(5000); ! } catch (Exception e) { ! System.out.println("Thread sleep interrupted"); ! } Asserts.assertTrue( WHITE_BOX.isMethodQueuedForCompilation(method), method + " must be in queue"); Asserts.assertFalse( WHITE_BOX.isMethodCompiled(method, false),
test/compiler/whitebox/LockCompilationTest.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File