8151880: EnqueueMethodForCompilationTest.java still fails to compile method
Extract SimpleTestCaseHelper inner class Reviewed-by: kvn
This commit is contained in:
parent
7502a7a7f2
commit
c70e07ccbe
@ -31,9 +31,9 @@ import compiler.whitebox.CompilerWhiteBoxTest;
|
|||||||
* @library /testlibrary /test/lib /
|
* @library /testlibrary /test/lib /
|
||||||
* @modules java.management
|
* @modules java.management
|
||||||
* @build ClearMethodStateTest
|
* @build ClearMethodStateTest
|
||||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ClearMethodStateTest
|
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation -XX:-UseCounterDecay ClearMethodStateTest
|
||||||
* @summary testing of WB::clearMethodState()
|
* @summary testing of WB::clearMethodState()
|
||||||
* @author igor.ignatyev@oracle.com
|
* @author igor.ignatyev@oracle.com
|
||||||
*/
|
*/
|
||||||
@ -41,8 +41,8 @@ public class ClearMethodStateTest extends CompilerWhiteBoxTest {
|
|||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
String directive =
|
String directive =
|
||||||
"[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " +
|
"[{ match:\"*SimpleTestCaseHelper.*\", BackgroundCompilation: false }, " +
|
||||||
" { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]";
|
" { match:\"*.*\", inline:\"-*SimpleTestCaseHelper.*\"}]";
|
||||||
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
|
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
|
||||||
throw new RuntimeException("Could not add directive");
|
throw new RuntimeException("Could not add directive");
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ package compiler.whitebox;
|
|||||||
|
|
||||||
import sun.hotspot.WhiteBox;
|
import sun.hotspot.WhiteBox;
|
||||||
import sun.hotspot.code.NMethod;
|
import sun.hotspot.code.NMethod;
|
||||||
|
|
||||||
import java.lang.reflect.Executable;
|
import java.lang.reflect.Executable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
@ -58,6 +59,8 @@ public abstract class CompilerWhiteBoxTest {
|
|||||||
/** Value of {@code -XX:BackgroundCompilation} */
|
/** Value of {@code -XX:BackgroundCompilation} */
|
||||||
protected static final boolean BACKGROUND_COMPILATION
|
protected static final boolean BACKGROUND_COMPILATION
|
||||||
= Boolean.valueOf(getVMOption("BackgroundCompilation", "true"));
|
= Boolean.valueOf(getVMOption("BackgroundCompilation", "true"));
|
||||||
|
protected static final boolean USE_COUNTER_DECAY
|
||||||
|
= Boolean.valueOf(getVMOption("UseCounterDecay", "true"));
|
||||||
/** Value of {@code -XX:TieredCompilation} */
|
/** Value of {@code -XX:TieredCompilation} */
|
||||||
protected static final boolean TIERED_COMPILATION
|
protected static final boolean TIERED_COMPILATION
|
||||||
= Boolean.valueOf(getVMOption("TieredCompilation", "false"));
|
= Boolean.valueOf(getVMOption("TieredCompilation", "false"));
|
||||||
@ -370,7 +373,10 @@ public abstract class CompilerWhiteBoxTest {
|
|||||||
* @return accumulated result
|
* @return accumulated result
|
||||||
* @see #compile(int)
|
* @see #compile(int)
|
||||||
*/
|
*/
|
||||||
protected final int compile() {
|
protected final int compile() throws Exception {
|
||||||
|
if (USE_COUNTER_DECAY) {
|
||||||
|
throw new Exception("Tests using compile method must turn off counter decay for reliability");
|
||||||
|
}
|
||||||
if (testCase.isOsr()) {
|
if (testCase.isOsr()) {
|
||||||
return compile(1);
|
return compile(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -29,9 +29,9 @@ import compiler.whitebox.CompilerWhiteBoxTest;
|
|||||||
* @library /testlibrary /test/lib /
|
* @library /testlibrary /test/lib /
|
||||||
* @modules java.management
|
* @modules java.management
|
||||||
* @build DeoptimizeAllTest
|
* @build DeoptimizeAllTest
|
||||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* DeoptimizeAllTest
|
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* DeoptimizeAllTest
|
||||||
* @summary testing of WB::deoptimizeAll()
|
* @summary testing of WB::deoptimizeAll()
|
||||||
* @author igor.ignatyev@oracle.com
|
* @author igor.ignatyev@oracle.com
|
||||||
*/
|
*/
|
||||||
|
@ -29,15 +29,15 @@ import compiler.whitebox.CompilerWhiteBoxTest;
|
|||||||
* @library /testlibrary /test/lib /
|
* @library /testlibrary /test/lib /
|
||||||
* @modules java.management
|
* @modules java.management
|
||||||
* @build DeoptimizeFramesTest
|
* @build DeoptimizeFramesTest
|
||||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||||
* -XX:+WhiteBoxAPI -Xmixed
|
* -XX:+WhiteBoxAPI -Xmixed -XX:-UseCounterDecay
|
||||||
* -XX:CompileCommand=compileonly,DeoptimizeFramesTest$TestCaseImpl::method
|
* -XX:CompileCommand=compileonly,DeoptimizeFramesTest$TestCaseImpl::method
|
||||||
* -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom -XX:-DeoptimizeALot
|
* -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom -XX:-DeoptimizeALot
|
||||||
* DeoptimizeFramesTest true
|
* DeoptimizeFramesTest true
|
||||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||||
* -XX:+WhiteBoxAPI -Xmixed
|
* -XX:+WhiteBoxAPI -Xmixed -XX:-UseCounterDecay
|
||||||
* -XX:CompileCommand=compileonly,DeoptimizeFramesTest$TestCaseImpl::method
|
* -XX:CompileCommand=compileonly,DeoptimizeFramesTest$TestCaseImpl::method
|
||||||
* -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom -XX:-DeoptimizeALot
|
* -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom -XX:-DeoptimizeALot
|
||||||
* DeoptimizeFramesTest false
|
* DeoptimizeFramesTest false
|
||||||
|
@ -29,9 +29,9 @@ import compiler.whitebox.CompilerWhiteBoxTest;
|
|||||||
* @library /testlibrary /test/lib /
|
* @library /testlibrary /test/lib /
|
||||||
* @modules java.management
|
* @modules java.management
|
||||||
* @build DeoptimizeMethodTest
|
* @build DeoptimizeMethodTest
|
||||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* DeoptimizeMethodTest
|
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* DeoptimizeMethodTest
|
||||||
* @summary testing of WB::deoptimizeMethod()
|
* @summary testing of WB::deoptimizeMethod()
|
||||||
* @author igor.ignatyev@oracle.com
|
* @author igor.ignatyev@oracle.com
|
||||||
*/
|
*/
|
||||||
|
@ -29,9 +29,9 @@ import compiler.whitebox.CompilerWhiteBoxTest;
|
|||||||
* @library /testlibrary /test/lib /
|
* @library /testlibrary /test/lib /
|
||||||
* @modules java.management
|
* @modules java.management
|
||||||
* @build EnqueueMethodForCompilationTest
|
* @build EnqueueMethodForCompilationTest
|
||||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI EnqueueMethodForCompilationTest
|
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation -XX:-UseCounterDecay EnqueueMethodForCompilationTest
|
||||||
* @summary testing of WB::enqueueMethodForCompilation()
|
* @summary testing of WB::enqueueMethodForCompilation()
|
||||||
* @author igor.ignatyev@oracle.com
|
* @author igor.ignatyev@oracle.com
|
||||||
*/
|
*/
|
||||||
@ -39,8 +39,8 @@ public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest {
|
|||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
String directive =
|
String directive =
|
||||||
"[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " +
|
"[{ match:\"*SimpleTestCaseHelper.*\", BackgroundCompilation: false }, " +
|
||||||
" { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]";
|
" { match:\"*.*\", inline:\"-*SimpleTestCaseHelper.*\"}]";
|
||||||
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
|
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
|
||||||
throw new RuntimeException("Could not add directive");
|
throw new RuntimeException("Could not add directive");
|
||||||
}
|
}
|
||||||
@ -86,7 +86,10 @@ public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest {
|
|||||||
checkNotCompiled();
|
checkNotCompiled();
|
||||||
WHITE_BOX.clearMethodState(method);
|
WHITE_BOX.clearMethodState(method);
|
||||||
|
|
||||||
WHITE_BOX.enqueueMethodForCompilation(method, compLevel, bci);
|
if (!WHITE_BOX.enqueueMethodForCompilation(method, compLevel, bci)) {
|
||||||
|
throw new RuntimeException(method
|
||||||
|
+ " could not be enqueued for compilation");
|
||||||
|
}
|
||||||
checkCompiled();
|
checkCompiled();
|
||||||
deoptimize();
|
deoptimize();
|
||||||
checkNotCompiled();
|
checkNotCompiled();
|
||||||
|
@ -38,12 +38,12 @@ import compiler.whitebox.CompilerWhiteBoxTest;
|
|||||||
* @library /testlibrary /test/lib /
|
* @library /testlibrary /test/lib /
|
||||||
* @modules java.management
|
* @modules java.management
|
||||||
* @build ForceNMethodSweepTest
|
* @build ForceNMethodSweepTest
|
||||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||||
* -XX:-TieredCompilation -XX:+WhiteBoxAPI
|
* -XX:-TieredCompilation -XX:+WhiteBoxAPI
|
||||||
* -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::*
|
* -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
|
||||||
* -XX:-BackgroundCompilation ForceNMethodSweepTest
|
* -XX:-BackgroundCompilation -XX:-UseCounterDecay ForceNMethodSweepTest
|
||||||
* @summary testing of WB::forceNMethodSweep
|
* @summary testing of WB::forceNMethodSweep
|
||||||
*/
|
*/
|
||||||
public class ForceNMethodSweepTest extends CompilerWhiteBoxTest {
|
public class ForceNMethodSweepTest extends CompilerWhiteBoxTest {
|
||||||
|
@ -33,9 +33,9 @@ import compiler.whitebox.CompilerWhiteBoxTest;
|
|||||||
* @library /testlibrary /test/lib /
|
* @library /testlibrary /test/lib /
|
||||||
* @modules java.management
|
* @modules java.management
|
||||||
* @build GetNMethodTest
|
* @build GetNMethodTest
|
||||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* GetNMethodTest
|
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* GetNMethodTest
|
||||||
* @summary testing of WB::getNMethod()
|
* @summary testing of WB::getNMethod()
|
||||||
* @author igor.ignatyev@oracle.com
|
* @author igor.ignatyev@oracle.com
|
||||||
*/
|
*/
|
||||||
|
@ -27,12 +27,13 @@
|
|||||||
* @library /testlibrary /test/lib /
|
* @library /testlibrary /test/lib /
|
||||||
* @modules java.base/sun.misc
|
* @modules java.base/sun.misc
|
||||||
* java.management
|
* java.management
|
||||||
* @build jdk.test.lib.* sun.hotspot.WhiteBox
|
* @build jdk.test.lib.*
|
||||||
|
* sun.hotspot.WhiteBox
|
||||||
* @build IsMethodCompilableTest
|
* @build IsMethodCompilableTest
|
||||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
* @run main ClassFileInstaller jdk.test.lib.Platform
|
* jdk.test.lib.Platform
|
||||||
* @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* IsMethodCompilableTest
|
* @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* IsMethodCompilableTest
|
||||||
* @summary testing of WB::isMethodCompilable()
|
* @summary testing of WB::isMethodCompilable()
|
||||||
* @author igor.ignatyev@oracle.com
|
* @author igor.ignatyev@oracle.com
|
||||||
*/
|
*/
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* @build LockCompilationTest
|
* @build LockCompilationTest
|
||||||
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI LockCompilationTest
|
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay LockCompilationTest
|
||||||
* @summary testing of WB::lock/unlockCompilation()
|
* @summary testing of WB::lock/unlockCompilation()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public class LockCompilationTest extends CompilerWhiteBoxTest {
|
|||||||
// Only compile SimpleTestCase$Helper.method and exclude all other to ensure no
|
// Only compile SimpleTestCase$Helper.method and exclude all other to ensure no
|
||||||
// contention on the compile queue causes problems.
|
// contention on the compile queue causes problems.
|
||||||
String directive =
|
String directive =
|
||||||
"[{ match:\"*SimpleTestCase$Helper.method\", Exclude:false}, " +
|
"[{ match:\"*SimpleTestCaseHelper.method\", Exclude:false}, " +
|
||||||
" { match:\"*.*\", Exclude:true}]";
|
" { match:\"*.*\", Exclude:true}]";
|
||||||
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
|
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
|
||||||
throw new RuntimeException("Could not add directive");
|
throw new RuntimeException("Could not add directive");
|
||||||
|
@ -29,9 +29,9 @@ import compiler.whitebox.CompilerWhiteBoxTest;
|
|||||||
* @library /testlibrary /test/lib /
|
* @library /testlibrary /test/lib /
|
||||||
* @modules java.management
|
* @modules java.management
|
||||||
* @build MakeMethodNotCompilableTest
|
* @build MakeMethodNotCompilableTest
|
||||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmixed MakeMethodNotCompilableTest
|
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmixed -XX:-UseCounterDecay MakeMethodNotCompilableTest
|
||||||
* @summary testing of WB::makeMethodNotCompilable()
|
* @summary testing of WB::makeMethodNotCompilable()
|
||||||
* @author igor.ignatyev@oracle.com
|
* @author igor.ignatyev@oracle.com
|
||||||
*/
|
*/
|
||||||
@ -39,8 +39,8 @@ public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
|
|||||||
private int bci;
|
private int bci;
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
String directive =
|
String directive =
|
||||||
"[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " +
|
"[{ match:\"*SimpleTestCaseHelper.*\", BackgroundCompilation: false }, " +
|
||||||
" { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]";
|
" { match:\"*.*\", inline:\"-*SimpleTestCaseHelper.*\"}]";
|
||||||
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
|
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
|
||||||
throw new RuntimeException("Could not add directive");
|
throw new RuntimeException("Could not add directive");
|
||||||
}
|
}
|
||||||
@ -227,7 +227,7 @@ public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getBci() {
|
private int getBci() throws Exception {
|
||||||
compile();
|
compile();
|
||||||
checkCompiled();
|
checkCompiled();
|
||||||
int result = WHITE_BOX.getMethodEntryBci(method);
|
int result = WHITE_BOX.getMethodEntryBci(method);
|
||||||
|
@ -31,18 +31,17 @@ import sun.hotspot.WhiteBox;
|
|||||||
|
|
||||||
public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
|
public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
|
||||||
/** constructor test case */
|
/** constructor test case */
|
||||||
CONSTRUCTOR_TEST(Helper.CONSTRUCTOR, Helper.CONSTRUCTOR_CALLABLE, false),
|
CONSTRUCTOR_TEST(SimpleTestCaseHelper.CONSTRUCTOR, SimpleTestCaseHelper.CONSTRUCTOR_CALLABLE, false),
|
||||||
/** method test case */
|
/** method test case */
|
||||||
METHOD_TEST(Helper.METHOD, Helper.METHOD_CALLABLE, false),
|
METHOD_TEST(SimpleTestCaseHelper.METHOD, SimpleTestCaseHelper.METHOD_CALLABLE, false),
|
||||||
/** static method test case */
|
/** static method test case */
|
||||||
STATIC_TEST(Helper.STATIC, Helper.STATIC_CALLABLE, false),
|
STATIC_TEST(SimpleTestCaseHelper.STATIC, SimpleTestCaseHelper.STATIC_CALLABLE, false),
|
||||||
/** OSR constructor test case */
|
/** OSR constructor test case */
|
||||||
OSR_CONSTRUCTOR_TEST(Helper.OSR_CONSTRUCTOR,
|
OSR_CONSTRUCTOR_TEST(SimpleTestCaseHelper.OSR_CONSTRUCTOR, SimpleTestCaseHelper.OSR_CONSTRUCTOR_CALLABLE, true),
|
||||||
Helper.OSR_CONSTRUCTOR_CALLABLE, true),
|
|
||||||
/** OSR method test case */
|
/** OSR method test case */
|
||||||
OSR_METHOD_TEST(Helper.OSR_METHOD, Helper.OSR_METHOD_CALLABLE, true),
|
OSR_METHOD_TEST(SimpleTestCaseHelper.OSR_METHOD, SimpleTestCaseHelper.OSR_METHOD_CALLABLE, true),
|
||||||
/** OSR static method test case */
|
/** OSR static method test case */
|
||||||
OSR_STATIC_TEST(Helper.OSR_STATIC, Helper.OSR_STATIC_CALLABLE, true);
|
OSR_STATIC_TEST(SimpleTestCaseHelper.OSR_STATIC, SimpleTestCaseHelper.OSR_STATIC_CALLABLE, true);
|
||||||
|
|
||||||
private final Executable executable;
|
private final Executable executable;
|
||||||
private final Callable<Integer> callable;
|
private final Callable<Integer> callable;
|
||||||
@ -69,20 +68,21 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
|
|||||||
public boolean isOsr() {
|
public boolean isOsr() {
|
||||||
return isOsr;
|
return isOsr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class Helper {
|
class SimpleTestCaseHelper {
|
||||||
|
|
||||||
private static final Callable<Integer> CONSTRUCTOR_CALLABLE
|
public static final Callable<Integer> CONSTRUCTOR_CALLABLE
|
||||||
= new Callable<Integer>() {
|
= new Callable<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public Integer call() throws Exception {
|
public Integer call() throws Exception {
|
||||||
return new Helper(1337).hashCode();
|
return new SimpleTestCaseHelper(1337).hashCode();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Callable<Integer> METHOD_CALLABLE
|
public static final Callable<Integer> METHOD_CALLABLE
|
||||||
= new Callable<Integer>() {
|
= new Callable<Integer>() {
|
||||||
private final Helper helper = new Helper();
|
private final SimpleTestCaseHelper helper = new SimpleTestCaseHelper();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer call() throws Exception {
|
public Integer call() throws Exception {
|
||||||
@ -90,7 +90,7 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Callable<Integer> STATIC_CALLABLE
|
public static final Callable<Integer> STATIC_CALLABLE
|
||||||
= new Callable<Integer>() {
|
= new Callable<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public Integer call() throws Exception {
|
public Integer call() throws Exception {
|
||||||
@ -98,17 +98,17 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Callable<Integer> OSR_CONSTRUCTOR_CALLABLE
|
public static final Callable<Integer> OSR_CONSTRUCTOR_CALLABLE
|
||||||
= new Callable<Integer>() {
|
= new Callable<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public Integer call() throws Exception {
|
public Integer call() throws Exception {
|
||||||
return new Helper(null, CompilerWhiteBoxTest.BACKEDGE_THRESHOLD).hashCode();
|
return new SimpleTestCaseHelper(null, CompilerWhiteBoxTest.BACKEDGE_THRESHOLD).hashCode();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Callable<Integer> OSR_METHOD_CALLABLE
|
public static final Callable<Integer> OSR_METHOD_CALLABLE
|
||||||
= new Callable<Integer>() {
|
= new Callable<Integer>() {
|
||||||
private final Helper helper = new Helper();
|
private final SimpleTestCaseHelper helper = new SimpleTestCaseHelper();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer call() throws Exception {
|
public Integer call() throws Exception {
|
||||||
@ -116,7 +116,7 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Callable<Integer> OSR_STATIC_CALLABLE
|
public static final Callable<Integer> OSR_STATIC_CALLABLE
|
||||||
= new Callable<Integer>() {
|
= new Callable<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public Integer call() throws Exception {
|
public Integer call() throws Exception {
|
||||||
@ -124,22 +124,22 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Constructor CONSTRUCTOR;
|
public static final Constructor CONSTRUCTOR;
|
||||||
private static final Constructor OSR_CONSTRUCTOR;
|
public static final Constructor OSR_CONSTRUCTOR;
|
||||||
private static final Method METHOD;
|
public static final Method METHOD;
|
||||||
private static final Method STATIC;
|
public static final Method STATIC;
|
||||||
private static final Method OSR_METHOD;
|
public static final Method OSR_METHOD;
|
||||||
private static final Method OSR_STATIC;
|
public static final Method OSR_STATIC;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
CONSTRUCTOR = Helper.class.getDeclaredConstructor(int.class);
|
CONSTRUCTOR = SimpleTestCaseHelper.class.getDeclaredConstructor(int.class);
|
||||||
} catch (NoSuchMethodException | SecurityException e) {
|
} catch (NoSuchMethodException | SecurityException e) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"exception on getting method Helper.<init>(int)", e);
|
"exception on getting method Helper.<init>(int)", e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
OSR_CONSTRUCTOR = Helper.class.getDeclaredConstructor(
|
OSR_CONSTRUCTOR = SimpleTestCaseHelper.class.getDeclaredConstructor(
|
||||||
Object.class, long.class);
|
Object.class, long.class);
|
||||||
} catch (NoSuchMethodException | SecurityException e) {
|
} catch (NoSuchMethodException | SecurityException e) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
@ -153,7 +153,7 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
|
|||||||
|
|
||||||
private static Method getMethod(String name, Class<?>... parameterTypes) {
|
private static Method getMethod(String name, Class<?>... parameterTypes) {
|
||||||
try {
|
try {
|
||||||
return Helper.class.getDeclaredMethod(name, parameterTypes);
|
return SimpleTestCaseHelper.class.getDeclaredMethod(name, parameterTypes);
|
||||||
} catch (NoSuchMethodException | SecurityException e) {
|
} catch (NoSuchMethodException | SecurityException e) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"exception on getting method Helper." + name, e);
|
"exception on getting method Helper." + name, e);
|
||||||
@ -195,7 +195,7 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
|
|||||||
*/
|
*/
|
||||||
private static int warmup(Method m) throws Exception {
|
private static int warmup(Method m) throws Exception {
|
||||||
waitAndDeoptimize(m);
|
waitAndDeoptimize(m);
|
||||||
Helper helper = new Helper();
|
SimpleTestCaseHelper helper = new SimpleTestCaseHelper();
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for (long i = 0; i < CompilerWhiteBoxTest.THRESHOLD; ++i) {
|
for (long i = 0; i < CompilerWhiteBoxTest.THRESHOLD; ++i) {
|
||||||
result += (int)m.invoke(helper, 1);
|
result += (int)m.invoke(helper, 1);
|
||||||
@ -254,12 +254,12 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
|
|||||||
private final int x;
|
private final int x;
|
||||||
|
|
||||||
// for method and OSR method test case
|
// for method and OSR method test case
|
||||||
public Helper() {
|
public SimpleTestCaseHelper() {
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for OSR constructor test case
|
// for OSR constructor test case
|
||||||
private Helper(Object o, long limit) throws Exception {
|
private SimpleTestCaseHelper(Object o, long limit) throws Exception {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (limit != 1) {
|
if (limit != 1) {
|
||||||
result = warmup(OSR_CONSTRUCTOR);
|
result = warmup(OSR_CONSTRUCTOR);
|
||||||
@ -272,7 +272,7 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// for constructor test case
|
// for constructor test case
|
||||||
private Helper(int x) {
|
private SimpleTestCaseHelper(int x) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,4 +281,4 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user