8138689: use package for /compiler/whitebox common classes
Summary: Moved CompilerWhiteBoxTest to package, updating tests accordingly
Reviewed-by: iignatyev
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java Fri Nov 06 14:54:02 2015 +0300
@@ -25,7 +25,7 @@
* @test
* @bug 8072016
* @summary Infinite deoptimization/recompilation cycles in case of arraycopy with tightly coupled allocation
- * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @library /testlibrary /../../test/lib /
* @modules java.base/sun.misc
* java.management
* @build TestArrayCopyNoInitDeopt
@@ -42,6 +42,7 @@
import sun.hotspot.code.NMethod;
import jdk.test.lib.Platform;
import java.lang.reflect.*;
+import compiler.whitebox.CompilerWhiteBoxTest;
public class TestArrayCopyNoInitDeopt {
--- a/hotspot/test/compiler/floatingpoint/TestPow2.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/floatingpoint/TestPow2.java Fri Nov 06 14:54:02 2015 +0300
@@ -25,7 +25,7 @@
* @test
* @bug 8063086
* @summary X^2 special case for C2 yields different result than interpreter
- * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @build TestPow2
* @run main ClassFileInstaller sun.hotspot.WhiteBox
@@ -36,6 +36,7 @@
import java.lang.reflect.*;
import sun.hotspot.WhiteBox;
+import compiler.whitebox.CompilerWhiteBoxTest;
public class TestPow2 {
--- a/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,10 +23,11 @@
import java.lang.reflect.Executable;
import java.util.concurrent.Callable;
import java.util.Objects;
+import compiler.whitebox.CompilerWhiteBoxTest;
/*
* @test
* @bug 8130832
- * @library /testlibrary /../../test/lib /compiler/whitebox /compiler/testlibrary
+ * @library /testlibrary /../../test/lib / /compiler/testlibrary
* @build IntrinsicAvailableTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @library /testlibrary /../../test/lib / ..
* @modules java.base/sun.misc
* java.management
* @build AddnTestI
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @library /testlibrary /../../test/lib / ..
* @modules java.base/sun.misc
* java.management
* @build AddnTestL
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @library /testlibrary /../../test/lib / ..
* @modules java.base/sun.misc
* java.management
* @build BlsiTestI
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @library /testlibrary /../../test/lib / ..
* @modules java.base/sun.misc
* java.management
* @build BlsiTestL
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @library /testlibrary /../../test/lib / ..
* @modules java.base/sun.misc
* java.management
* @build BlsmskTestI
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @library /testlibrary /../../test/lib / ..
* @modules java.base/sun.misc
* java.management
* @build BlsmskTestL
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @library /testlibrary /../../test/lib / ..
* @modules java.base/sun.misc
* java.management
* @build BlsrTestI
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @library /testlibrary /../../test/lib / ..
* @modules java.base/sun.misc
* java.management
* @build BlsrTestL
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java Fri Nov 06 14:54:02 2015 +0300
@@ -32,6 +32,7 @@
import java.lang.reflect.Method;
import java.util.concurrent.Callable;
import java.util.function.Function;
+import compiler.whitebox.CompilerWhiteBoxTest;
public class BmiIntrinsicBase extends CompilerWhiteBoxTest {
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @library /testlibrary /../../test/lib / ..
* @modules java.base/sun.misc
* java.management
* @build LZcntTestI
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @library /testlibrary /../../test/lib / ..
* @modules java.base/sun.misc
* java.management
* @build LZcntTestL
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @library /testlibrary /../../test/lib / ..
* @modules java.base/sun.misc
* java.management
* @build TZcntTestI
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @library /testlibrary /../../test/lib / ..
* @modules java.base/sun.misc
* java.management
* @build TZcntTestL
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,8 +23,7 @@
/*
* @test
- * @library /testlibrary /../../test/lib /compiler/whitebox
- * /compiler/testlibrary
+ * @library /testlibrary /../../test/lib / /compiler/testlibrary
* @modules java.base/sun.misc
* java.management
* @build AddExactIntTest
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,8 +23,7 @@
/*
* @test
- * @library /testlibrary /../../test/lib /compiler/whitebox
- * /compiler/testlibrary
+ * @library /testlibrary /../../test/lib / /compiler/testlibrary
* @modules java.base/sun.misc
* java.management
* @build AddExactLongTest
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,8 +23,7 @@
/*
* @test
- * @library /testlibrary /../../test/lib /compiler/whitebox
- * /compiler/testlibrary
+ * @library /testlibrary /../../test/lib / /compiler/testlibrary
* @modules java.base/sun.misc
* java.management
* @build DecrementExactIntTest
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,8 +23,7 @@
/*
* @test
- * @library /testlibrary /../../test/lib /compiler/whitebox
- * /compiler/testlibrary
+ * @library /testlibrary /../../test/lib / /compiler/testlibrary
* @modules java.base/sun.misc
* java.management
* @build DecrementExactLongTest
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,8 +23,7 @@
/*
* @test
- * @library /testlibrary /../../test/lib /compiler/whitebox
- * /compiler/testlibrary
+ * @library /testlibrary /../../test/lib / /compiler/testlibrary
* @modules java.base/sun.misc
* java.management
* @build IncrementExactIntTest
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,8 +23,7 @@
/*
* @test
- * @library /testlibrary /../../test/lib /compiler/whitebox
- * /compiler/testlibrary
+ * @library /testlibrary /../../test/lib / /compiler/testlibrary
* @modules java.base/sun.misc
* java.management
* @build IncrementExactLongTest
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java Fri Nov 06 14:54:02 2015 +0300
@@ -27,6 +27,7 @@
import java.io.FileOutputStream;
import java.lang.reflect.Executable;
import java.util.Properties;
+import compiler.whitebox.CompilerWhiteBoxTest;
public abstract class IntrinsicBase extends CompilerWhiteBoxTest {
protected String javaVmName;
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MathIntrinsic.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MathIntrinsic.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,6 +23,7 @@
import java.lang.reflect.Executable;
import java.util.concurrent.Callable;
+import compiler.whitebox.CompilerWhiteBoxTest;
public class MathIntrinsic {
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,8 +23,7 @@
/*
* @test
- * @library /testlibrary /../../test/lib /compiler/whitebox
- * /compiler/testlibrary
+ * @library /testlibrary /../../test/lib / /compiler/testlibrary
* @modules java.base/sun.misc
* java.management
* @build MultiplyExactIntTest
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,8 +23,7 @@
/*
* @test
- * @library /testlibrary /../../test/lib /compiler/whitebox
- * /compiler/testlibrary
+ * @library /testlibrary /../../test/lib / /compiler/testlibrary
* @modules java.base/sun.misc
* java.management
* @build MultiplyExactLongTest
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,8 +23,7 @@
/*
* @test
- * @library /testlibrary /../../test/lib /compiler/whitebox
- * /compiler/testlibrary
+ * @library /testlibrary /../../test/lib / /compiler/testlibrary
* @modules java.base/sun.misc
* java.management
* @build NegateExactIntTest
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,8 +23,7 @@
/*
* @test
- * @library /testlibrary /../../test/lib /compiler/whitebox
- * /compiler/testlibrary
+ * @library /testlibrary /../../test/lib / /compiler/testlibrary
* @modules java.base/sun.misc
* java.management
* @build NegateExactLongTest
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,8 +23,7 @@
/*
* @test
- * @library /testlibrary /../../test/lib /compiler/whitebox
- * /compiler/testlibrary
+ * @library /testlibrary /../../test/lib / /compiler/testlibrary
* @modules java.base/sun.misc
* java.management
* @build SubtractExactIntTest
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,8 +23,7 @@
/*
* @test
- * @library /testlibrary /../../test/lib /compiler/whitebox
- * /compiler/testlibrary
+ * @library /testlibrary /../../test/lib / /compiler/testlibrary
* @modules java.base/sun.misc
* java.management
* @build SubtractExactLongTest
--- a/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java Fri Nov 06 14:54:02 2015 +0300
@@ -25,7 +25,7 @@
* @test
* @bug 8073480
* @summary explicit range checks should be recognized by C2
- * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @library /testlibrary /../../test/lib /
* @build TestExplicitRangeChecks
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main ClassFileInstaller jdk.test.lib.Platform
@@ -41,6 +41,7 @@
import sun.hotspot.code.NMethod;
import jdk.test.lib.Platform;
import sun.misc.Unsafe;
+import compiler.whitebox.CompilerWhiteBoxTest;
public class TestExplicitRangeChecks {
--- a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java Fri Nov 06 14:54:02 2015 +0300
@@ -25,7 +25,7 @@
* @test
* @bug 8066103
* @summary C2's range check smearing allows out of bound array accesses
- * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @library /testlibrary /../../test/lib /
* @modules java.base/sun.misc
* java.management
* @build TestRangeCheckSmearing
@@ -42,6 +42,7 @@
import sun.hotspot.WhiteBox;
import sun.hotspot.code.NMethod;
import jdk.test.lib.Platform;
+import compiler.whitebox.CompilerWhiteBoxTest;
public class TestRangeCheckSmearing {
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
--- a/hotspot/test/compiler/tiered/CompLevelsTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/tiered/CompLevelsTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -26,6 +26,9 @@
*
* @author igor.ignatyev@oracle.com
*/
+
+import compiler.whitebox.CompilerWhiteBoxTest;
+
public abstract class CompLevelsTest extends CompilerWhiteBoxTest {
protected CompLevelsTest(TestCase testCase) {
super(testCase);
--- a/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -23,10 +23,11 @@
import java.lang.reflect.Executable;
import java.util.concurrent.Callable;
+import compiler.whitebox.CompilerWhiteBoxTest;
/**
* @test ConstantGettersTransitionsTest
- * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @library /testlibrary /../../test/lib /
* @modules java.base/sun.misc
* java.management
* @build TransitionsTestExecutor ConstantGettersTransitionsTest
--- a/hotspot/test/compiler/tiered/LevelTransitionTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/tiered/LevelTransitionTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -25,10 +25,12 @@
import java.lang.reflect.Method;
import java.util.Objects;
import java.util.concurrent.Callable;
+import compiler.whitebox.CompilerWhiteBoxTest;
+import compiler.whitebox.SimpleTestCase;
/**
* @test LevelTransitionTest
- * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @library /testlibrary /../../test/lib /
* @modules java.base/sun.misc
* java.management
* @ignore 8067651
@@ -36,7 +38,7 @@
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -XX:+TieredCompilation
- * -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
+ * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::*
* -XX:CompileCommand=compileonly,ExtendedTestCase$CompileMethodHolder::*
* TransitionsTestExecutor LevelTransitionTest
* @summary Test the correctness of compilation level transitions for different methods
--- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -22,17 +22,18 @@
*/
import java.util.function.IntPredicate;
+import compiler.whitebox.CompilerWhiteBoxTest;
/**
* @test NonTieredLevelsTest
- * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @build NonTieredLevelsTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- * -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
+ * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::*
* NonTieredLevelsTest
* @summary Verify that only one level can be used
* @author igor.ignatyev@oracle.com
--- a/hotspot/test/compiler/tiered/TieredLevelsTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/tiered/TieredLevelsTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -21,16 +21,18 @@
* questions.
*/
+import compiler.whitebox.CompilerWhiteBoxTest;
+
/**
* @test TieredLevelsTest
- * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @build TieredLevelsTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- * -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
+ * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::*
* TieredLevelsTest
* @summary Verify that all levels < 'TieredStopAtLevel' can be used
* @author igor.ignatyev@oracle.com
--- a/hotspot/test/compiler/tiered/TransitionsTestExecutor.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/tiered/TransitionsTestExecutor.java Fri Nov 06 14:54:02 2015 +0300
@@ -29,6 +29,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import compiler.whitebox.CompilerWhiteBoxTest;
/**
* Executes given test in a separate VM with enabled Tiered Compilation for
--- a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -22,16 +22,17 @@
*/
import java.util.function.Function;
+import compiler.whitebox.CompilerWhiteBoxTest;
/*
* @test ClearMethodStateTest
* @bug 8006683 8007288 8022832
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @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,SimpleTestCase$Helper::* ClearMethodStateTest
+ * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* ClearMethodStateTest
* @summary testing of WB::clearMethodState()
* @author igor.ignatyev@oracle.com
*/
--- a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -20,10 +20,10 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+package compiler.whitebox;
import sun.hotspot.WhiteBox;
import sun.hotspot.code.NMethod;
-
import java.lang.reflect.Constructor;
import java.lang.reflect.Executable;
import java.lang.reflect.Method;
@@ -38,19 +38,19 @@
*/
public abstract class CompilerWhiteBoxTest {
/** {@code CompLevel::CompLevel_none} -- Interpreter */
- protected static final int COMP_LEVEL_NONE = 0;
+ public static final int COMP_LEVEL_NONE = 0;
/** {@code CompLevel::CompLevel_any}, {@code CompLevel::CompLevel_all} */
- protected static final int COMP_LEVEL_ANY = -1;
+ public static final int COMP_LEVEL_ANY = -1;
/** {@code CompLevel::CompLevel_simple} -- C1 */
- protected static final int COMP_LEVEL_SIMPLE = 1;
+ public static final int COMP_LEVEL_SIMPLE = 1;
/** {@code CompLevel::CompLevel_limited_profile} -- C1, invocation & backedge counters */
- protected static final int COMP_LEVEL_LIMITED_PROFILE = 2;
+ public static final int COMP_LEVEL_LIMITED_PROFILE = 2;
/** {@code CompLevel::CompLevel_full_profile} -- C1, invocation & backedge counters + mdo */
- protected static final int COMP_LEVEL_FULL_PROFILE = 3;
+ public static final int COMP_LEVEL_FULL_PROFILE = 3;
/** {@code CompLevel::CompLevel_full_optimization} -- C2 or Shark */
- protected static final int COMP_LEVEL_FULL_OPTIMIZATION = 4;
+ public static final int COMP_LEVEL_FULL_OPTIMIZATION = 4;
/** Maximal value for CompLevel */
- protected static final int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION;
+ public static final int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION;
/** Instance of WhiteBox */
protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
@@ -312,7 +312,7 @@
*
* @param executable Executable
*/
- protected static final void waitBackgroundCompilation(Executable executable) {
+ public static final void waitBackgroundCompilation(Executable executable) {
if (!BACKGROUND_COMPILATION) {
return;
}
@@ -441,7 +441,7 @@
* @return {@code true} if the test should be skipped,
* {@code false} otherwise
*/
- protected static boolean skipOnTieredCompilation(boolean value) {
+ public static boolean skipOnTieredCompilation(boolean value) {
if (value == CompilerWhiteBoxTest.TIERED_COMPILATION) {
System.err.println("Test isn't applicable w/ "
+ (value ? "enabled" : "disabled")
@@ -452,256 +452,3 @@
}
}
-enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
- /** constructor test case */
- CONSTRUCTOR_TEST(Helper.CONSTRUCTOR, Helper.CONSTRUCTOR_CALLABLE, false),
- /** method test case */
- METHOD_TEST(Helper.METHOD, Helper.METHOD_CALLABLE, false),
- /** static method test case */
- STATIC_TEST(Helper.STATIC, Helper.STATIC_CALLABLE, false),
- /** OSR constructor test case */
- OSR_CONSTRUCTOR_TEST(Helper.OSR_CONSTRUCTOR,
- Helper.OSR_CONSTRUCTOR_CALLABLE, true),
- /** OSR method test case */
- OSR_METHOD_TEST(Helper.OSR_METHOD, Helper.OSR_METHOD_CALLABLE, true),
- /** OSR static method test case */
- OSR_STATIC_TEST(Helper.OSR_STATIC, Helper.OSR_STATIC_CALLABLE, true);
-
- private final Executable executable;
- private final Callable<Integer> callable;
- private final boolean isOsr;
-
- private SimpleTestCase(Executable executable, Callable<Integer> callable,
- boolean isOsr) {
- this.executable = executable;
- this.callable = callable;
- this.isOsr = isOsr;
- }
-
- @Override
- public Executable getExecutable() {
- return executable;
- }
-
- @Override
- public Callable<Integer> getCallable() {
- return callable;
- }
-
- @Override
- public boolean isOsr() {
- return isOsr;
- }
-
- private static class Helper {
-
- private static final Callable<Integer> CONSTRUCTOR_CALLABLE
- = new Callable<Integer>() {
- @Override
- public Integer call() throws Exception {
- return new Helper(1337).hashCode();
- }
- };
-
- private static final Callable<Integer> METHOD_CALLABLE
- = new Callable<Integer>() {
- private final Helper helper = new Helper();
-
- @Override
- public Integer call() throws Exception {
- return helper.method();
- }
- };
-
- private static final Callable<Integer> STATIC_CALLABLE
- = new Callable<Integer>() {
- @Override
- public Integer call() throws Exception {
- return staticMethod();
- }
- };
-
- private static final Callable<Integer> OSR_CONSTRUCTOR_CALLABLE
- = new Callable<Integer>() {
- @Override
- public Integer call() throws Exception {
- return new Helper(null, CompilerWhiteBoxTest.BACKEDGE_THRESHOLD).hashCode();
- }
- };
-
- private static final Callable<Integer> OSR_METHOD_CALLABLE
- = new Callable<Integer>() {
- private final Helper helper = new Helper();
-
- @Override
- public Integer call() throws Exception {
- return helper.osrMethod(CompilerWhiteBoxTest.BACKEDGE_THRESHOLD);
- }
- };
-
- private static final Callable<Integer> OSR_STATIC_CALLABLE
- = new Callable<Integer>() {
- @Override
- public Integer call() throws Exception {
- return osrStaticMethod(CompilerWhiteBoxTest.BACKEDGE_THRESHOLD);
- }
- };
-
- private static final Constructor CONSTRUCTOR;
- private static final Constructor OSR_CONSTRUCTOR;
- private static final Method METHOD;
- private static final Method STATIC;
- private static final Method OSR_METHOD;
- private static final Method OSR_STATIC;
-
- static {
- try {
- CONSTRUCTOR = Helper.class.getDeclaredConstructor(int.class);
- } catch (NoSuchMethodException | SecurityException e) {
- throw new RuntimeException(
- "exception on getting method Helper.<init>(int)", e);
- }
- try {
- OSR_CONSTRUCTOR = Helper.class.getDeclaredConstructor(
- Object.class, long.class);
- } catch (NoSuchMethodException | SecurityException e) {
- throw new RuntimeException(
- "exception on getting method Helper.<init>(Object, long)", e);
- }
- METHOD = getMethod("method");
- STATIC = getMethod("staticMethod");
- OSR_METHOD = getMethod("osrMethod", long.class);
- OSR_STATIC = getMethod("osrStaticMethod", long.class);
- }
-
- private static Method getMethod(String name, Class<?>... parameterTypes) {
- try {
- return Helper.class.getDeclaredMethod(name, parameterTypes);
- } catch (NoSuchMethodException | SecurityException e) {
- throw new RuntimeException(
- "exception on getting method Helper." + name, e);
- }
- }
-
- private static int staticMethod() {
- return 1138;
- }
-
- private int method() {
- return 42;
- }
-
- /**
- * Deoptimizes all non-osr versions of the given executable after
- * compilation finished.
- *
- * @param e Executable
- * @throws Exception
- */
- private static void waitAndDeoptimize(Executable e) {
- CompilerWhiteBoxTest.waitBackgroundCompilation(e);
- if (WhiteBox.getWhiteBox().isMethodQueuedForCompilation(e)) {
- throw new RuntimeException(e + " must not be in queue");
- }
- // Deoptimize non-osr versions of executable
- WhiteBox.getWhiteBox().deoptimizeMethod(e, false);
- }
-
- /**
- * Executes the method multiple times to make sure we have
- * enough profiling information before triggering an OSR
- * compilation. Otherwise the C2 compiler may add uncommon traps.
- *
- * @param m Method to be executed
- * @return Number of times the method was executed
- * @throws Exception
- */
- private static int warmup(Method m) throws Exception {
- waitAndDeoptimize(m);
- Helper helper = new Helper();
- int result = 0;
- for (long i = 0; i < CompilerWhiteBoxTest.THRESHOLD; ++i) {
- result += (int)m.invoke(helper, 1);
- }
- // Wait to make sure OSR compilation is not blocked by
- // non-OSR compilation in the compile queue
- CompilerWhiteBoxTest.waitBackgroundCompilation(m);
- return result;
- }
-
- /**
- * Executes the constructor multiple times to make sure we
- * have enough profiling information before triggering an OSR
- * compilation. Otherwise the C2 compiler may add uncommon traps.
- *
- * @param c Constructor to be executed
- * @return Number of times the constructor was executed
- * @throws Exception
- */
- private static int warmup(Constructor c) throws Exception {
- waitAndDeoptimize(c);
- int result = 0;
- for (long i = 0; i < CompilerWhiteBoxTest.THRESHOLD; ++i) {
- result += c.newInstance(null, 1).hashCode();
- }
- // Wait to make sure OSR compilation is not blocked by
- // non-OSR compilation in the compile queue
- CompilerWhiteBoxTest.waitBackgroundCompilation(c);
- return result;
- }
-
- private static int osrStaticMethod(long limit) throws Exception {
- int result = 0;
- if (limit != 1) {
- result = warmup(OSR_STATIC);
- }
- // Trigger osr compilation
- for (long i = 0; i < limit; ++i) {
- result += staticMethod();
- }
- return result;
- }
-
- private int osrMethod(long limit) throws Exception {
- int result = 0;
- if (limit != 1) {
- result = warmup(OSR_METHOD);
- }
- // Trigger osr compilation
- for (long i = 0; i < limit; ++i) {
- result += method();
- }
- return result;
- }
-
- private final int x;
-
- // for method and OSR method test case
- public Helper() {
- x = 0;
- }
-
- // for OSR constructor test case
- private Helper(Object o, long limit) throws Exception {
- int result = 0;
- if (limit != 1) {
- result = warmup(OSR_CONSTRUCTOR);
- }
- // Trigger osr compilation
- for (long i = 0; i < limit; ++i) {
- result += method();
- }
- x = result;
- }
-
- // for constructor test case
- private Helper(int x) {
- this.x = x;
- }
-
- @Override
- public int hashCode() {
- return x;
- }
- }
-}
--- a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -21,15 +21,17 @@
* questions.
*/
+import compiler.whitebox.CompilerWhiteBoxTest;
+
/*
* @test DeoptimizeAllTest
* @bug 8006683 8007288 8022832
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @build DeoptimizeAllTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* DeoptimizeAllTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* DeoptimizeAllTest
* @summary testing of WB::deoptimizeAll()
* @author igor.ignatyev@oracle.com
*/
--- a/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -21,10 +21,12 @@
* questions.
*/
+import compiler.whitebox.CompilerWhiteBoxTest;
+
/*
* @test DeoptimizeFramesTest
* @bug 8028595
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @build DeoptimizeFramesTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -21,15 +21,17 @@
* questions.
*/
+import compiler.whitebox.CompilerWhiteBoxTest;
+
/*
* @test DeoptimizeMethodTest
* @bug 8006683 8007288 8022832
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @build DeoptimizeMethodTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* DeoptimizeMethodTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* DeoptimizeMethodTest
* @summary testing of WB::deoptimizeMethod()
* @author igor.ignatyev@oracle.com
*/
--- a/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,11 +24,12 @@
import sun.hotspot.WhiteBox;
import java.lang.reflect.Executable;
import java.lang.reflect.Method;
+import compiler.whitebox.CompilerWhiteBoxTest;
/*
* @test DeoptimizeMultipleOSRTest
* @bug 8061817
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @build DeoptimizeMultipleOSRTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -21,15 +21,17 @@
* questions.
*/
+import compiler.whitebox.CompilerWhiteBoxTest;
+
/*
* @test EnqueueMethodForCompilationTest
* @bug 8006683 8007288 8022832
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @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,SimpleTestCase$Helper::* EnqueueMethodForCompilationTest
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* EnqueueMethodForCompilationTest
* @summary testing of WB::enqueueMethodForCompilation()
* @author igor.ignatyev@oracle.com
*/
--- a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -30,18 +30,19 @@
import jdk.test.lib.Asserts;
import jdk.test.lib.InfiniteLoop;
+import compiler.whitebox.CompilerWhiteBoxTest;
/*
* @test
* @bug 8059624 8064669
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @build ForceNMethodSweepTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:-TieredCompilation -XX:+WhiteBoxAPI
- * -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
+ * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::*
* -XX:-BackgroundCompilation ForceNMethodSweepTest
* @summary testing of WB::forceNMethodSweep
*/
--- a/hotspot/test/compiler/whitebox/GetNMethodTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -25,16 +25,17 @@
import sun.hotspot.code.BlobType;
import sun.hotspot.code.NMethod;
import jdk.test.lib.Asserts;
+import compiler.whitebox.CompilerWhiteBoxTest;
/*
* @test GetNMethodTest
* @bug 8038240
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @build GetNMethodTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* GetNMethodTest
+ * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* GetNMethodTest
* @summary testing of WB::getNMethod()
* @author igor.ignatyev@oracle.com
*/
--- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,7 +24,7 @@
/*
* @test IsMethodCompilableTest
* @bug 8007270 8006683 8007288 8022832
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /../../test/lib /
* @modules java.base/sun.misc
* java.management
* @build jdk.test.lib.* sun.hotspot.WhiteBox
@@ -32,12 +32,13 @@
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main ClassFileInstaller jdk.test.lib.Platform
- * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest
+ * @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
* @summary testing of WB::isMethodCompilable()
* @author igor.ignatyev@oracle.com
*/
import jdk.test.lib.Platform;
+import compiler.whitebox.CompilerWhiteBoxTest;
public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
/**
--- a/hotspot/test/compiler/whitebox/LockCompilationTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/whitebox/LockCompilationTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -24,12 +24,12 @@
/*
* @test LockCompilationTest
* @bug 8059624
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @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,SimpleTestCase$Helper::* LockCompilationTest
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* LockCompilationTest
* @summary testing of WB::lock/unlockCompilation()
*/
@@ -37,7 +37,7 @@
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 {
--- a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -21,15 +21,17 @@
* questions.
*/
+import compiler.whitebox.CompilerWhiteBoxTest;
+
/*
* @test MakeMethodNotCompilableTest
* @bug 8012322 8006683 8007288 8022832
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @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,SimpleTestCase$Helper::* MakeMethodNotCompilableTest
+ * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* MakeMethodNotCompilableTest
* @summary testing of WB::makeMethodNotCompilable()
* @author igor.ignatyev@oracle.com
*/
--- a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -21,15 +21,17 @@
* questions.
*/
+import compiler.whitebox.CompilerWhiteBoxTest;
+
/*
* @test SetDontInlineMethodTest
* @bug 8006683 8007288 8022832
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @build SetDontInlineMethodTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* SetDontInlineMethodTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* SetDontInlineMethodTest
* @summary testing of WB::testSetDontInlineMethod()
* @author igor.ignatyev@oracle.com
*/
--- a/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java Fri Nov 06 14:51:15 2015 +0300
+++ b/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java Fri Nov 06 14:54:02 2015 +0300
@@ -21,15 +21,17 @@
* questions.
*/
+import compiler.whitebox.CompilerWhiteBoxTest;
+
/*
* @test SetForceInlineMethodTest
* @bug 8006683 8007288 8022832
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /../../test/lib /
* @modules java.management
* @build SetForceInlineMethodTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* SetForceInlineMethodTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* SetForceInlineMethodTest
* @summary testing of WB::testSetForceInlineMethod()
* @author igor.ignatyev@oracle.com
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/whitebox/SimpleTestCase.java Fri Nov 06 14:54:02 2015 +0300
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package compiler.whitebox;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Executable;
+import java.lang.reflect.Method;
+import java.util.concurrent.Callable;
+import sun.hotspot.WhiteBox;
+
+public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
+ /** constructor test case */
+ CONSTRUCTOR_TEST(Helper.CONSTRUCTOR, Helper.CONSTRUCTOR_CALLABLE, false),
+ /** method test case */
+ METHOD_TEST(Helper.METHOD, Helper.METHOD_CALLABLE, false),
+ /** static method test case */
+ STATIC_TEST(Helper.STATIC, Helper.STATIC_CALLABLE, false),
+ /** OSR constructor test case */
+ OSR_CONSTRUCTOR_TEST(Helper.OSR_CONSTRUCTOR,
+ Helper.OSR_CONSTRUCTOR_CALLABLE, true),
+ /** OSR method test case */
+ OSR_METHOD_TEST(Helper.OSR_METHOD, Helper.OSR_METHOD_CALLABLE, true),
+ /** OSR static method test case */
+ OSR_STATIC_TEST(Helper.OSR_STATIC, Helper.OSR_STATIC_CALLABLE, true);
+
+ private final Executable executable;
+ private final Callable<Integer> callable;
+ private final boolean isOsr;
+
+ private SimpleTestCase(Executable executable, Callable<Integer> callable,
+ boolean isOsr) {
+ this.executable = executable;
+ this.callable = callable;
+ this.isOsr = isOsr;
+ }
+
+ @Override
+ public Executable getExecutable() {
+ return executable;
+ }
+
+ @Override
+ public Callable<Integer> getCallable() {
+ return callable;
+ }
+
+ @Override
+ public boolean isOsr() {
+ return isOsr;
+ }
+
+ private static class Helper {
+
+ private static final Callable<Integer> CONSTRUCTOR_CALLABLE
+ = new Callable<Integer>() {
+ @Override
+ public Integer call() throws Exception {
+ return new Helper(1337).hashCode();
+ }
+ };
+
+ private static final Callable<Integer> METHOD_CALLABLE
+ = new Callable<Integer>() {
+ private final Helper helper = new Helper();
+
+ @Override
+ public Integer call() throws Exception {
+ return helper.method();
+ }
+ };
+
+ private static final Callable<Integer> STATIC_CALLABLE
+ = new Callable<Integer>() {
+ @Override
+ public Integer call() throws Exception {
+ return staticMethod();
+ }
+ };
+
+ private static final Callable<Integer> OSR_CONSTRUCTOR_CALLABLE
+ = new Callable<Integer>() {
+ @Override
+ public Integer call() throws Exception {
+ return new Helper(null, CompilerWhiteBoxTest.BACKEDGE_THRESHOLD).hashCode();
+ }
+ };
+
+ private static final Callable<Integer> OSR_METHOD_CALLABLE
+ = new Callable<Integer>() {
+ private final Helper helper = new Helper();
+
+ @Override
+ public Integer call() throws Exception {
+ return helper.osrMethod(CompilerWhiteBoxTest.BACKEDGE_THRESHOLD);
+ }
+ };
+
+ private static final Callable<Integer> OSR_STATIC_CALLABLE
+ = new Callable<Integer>() {
+ @Override
+ public Integer call() throws Exception {
+ return osrStaticMethod(CompilerWhiteBoxTest.BACKEDGE_THRESHOLD);
+ }
+ };
+
+ private static final Constructor CONSTRUCTOR;
+ private static final Constructor OSR_CONSTRUCTOR;
+ private static final Method METHOD;
+ private static final Method STATIC;
+ private static final Method OSR_METHOD;
+ private static final Method OSR_STATIC;
+
+ static {
+ try {
+ CONSTRUCTOR = Helper.class.getDeclaredConstructor(int.class);
+ } catch (NoSuchMethodException | SecurityException e) {
+ throw new RuntimeException(
+ "exception on getting method Helper.<init>(int)", e);
+ }
+ try {
+ OSR_CONSTRUCTOR = Helper.class.getDeclaredConstructor(
+ Object.class, long.class);
+ } catch (NoSuchMethodException | SecurityException e) {
+ throw new RuntimeException(
+ "exception on getting method Helper.<init>(Object, long)", e);
+ }
+ METHOD = getMethod("method");
+ STATIC = getMethod("staticMethod");
+ OSR_METHOD = getMethod("osrMethod", long.class);
+ OSR_STATIC = getMethod("osrStaticMethod", long.class);
+ }
+
+ private static Method getMethod(String name, Class<?>... parameterTypes) {
+ try {
+ return Helper.class.getDeclaredMethod(name, parameterTypes);
+ } catch (NoSuchMethodException | SecurityException e) {
+ throw new RuntimeException(
+ "exception on getting method Helper." + name, e);
+ }
+ }
+
+ private static int staticMethod() {
+ return 1138;
+ }
+
+ private int method() {
+ return 42;
+ }
+
+ /**
+ * Deoptimizes all non-osr versions of the given executable after
+ * compilation finished.
+ *
+ * @param e Executable
+ * @throws Exception
+ */
+ private static void waitAndDeoptimize(Executable e) {
+ CompilerWhiteBoxTest.waitBackgroundCompilation(e);
+ if (WhiteBox.getWhiteBox().isMethodQueuedForCompilation(e)) {
+ throw new RuntimeException(e + " must not be in queue");
+ }
+ // Deoptimize non-osr versions of executable
+ WhiteBox.getWhiteBox().deoptimizeMethod(e, false);
+ }
+
+ /**
+ * Executes the method multiple times to make sure we have
+ * enough profiling information before triggering an OSR
+ * compilation. Otherwise the C2 compiler may add uncommon traps.
+ *
+ * @param m Method to be executed
+ * @return Number of times the method was executed
+ * @throws Exception
+ */
+ private static int warmup(Method m) throws Exception {
+ waitAndDeoptimize(m);
+ Helper helper = new Helper();
+ int result = 0;
+ for (long i = 0; i < CompilerWhiteBoxTest.THRESHOLD; ++i) {
+ result += (int)m.invoke(helper, 1);
+ }
+ // Wait to make sure OSR compilation is not blocked by
+ // non-OSR compilation in the compile queue
+ CompilerWhiteBoxTest.waitBackgroundCompilation(m);
+ return result;
+ }
+
+ /**
+ * Executes the constructor multiple times to make sure we
+ * have enough profiling information before triggering an OSR
+ * compilation. Otherwise the C2 compiler may add uncommon traps.
+ *
+ * @param c Constructor to be executed
+ * @return Number of times the constructor was executed
+ * @throws Exception
+ */
+ private static int warmup(Constructor c) throws Exception {
+ waitAndDeoptimize(c);
+ int result = 0;
+ for (long i = 0; i < CompilerWhiteBoxTest.THRESHOLD; ++i) {
+ result += c.newInstance(null, 1).hashCode();
+ }
+ // Wait to make sure OSR compilation is not blocked by
+ // non-OSR compilation in the compile queue
+ CompilerWhiteBoxTest.waitBackgroundCompilation(c);
+ return result;
+ }
+
+ private static int osrStaticMethod(long limit) throws Exception {
+ int result = 0;
+ if (limit != 1) {
+ result = warmup(OSR_STATIC);
+ }
+ // Trigger osr compilation
+ for (long i = 0; i < limit; ++i) {
+ result += staticMethod();
+ }
+ return result;
+ }
+
+ private int osrMethod(long limit) throws Exception {
+ int result = 0;
+ if (limit != 1) {
+ result = warmup(OSR_METHOD);
+ }
+ // Trigger osr compilation
+ for (long i = 0; i < limit; ++i) {
+ result += method();
+ }
+ return result;
+ }
+
+ private final int x;
+
+ // for method and OSR method test case
+ public Helper() {
+ x = 0;
+ }
+
+ // for OSR constructor test case
+ private Helper(Object o, long limit) throws Exception {
+ int result = 0;
+ if (limit != 1) {
+ result = warmup(OSR_CONSTRUCTOR);
+ }
+ // Trigger osr compilation
+ for (long i = 0; i < limit; ++i) {
+ result += method();
+ }
+ x = result;
+ }
+
+ // for constructor test case
+ private Helper(int x) {
+ this.x = x;
+ }
+
+ @Override
+ public int hashCode() {
+ return x;
+ }
+ }
+}