--- old/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java 2015-11-05 16:11:37.214885764 +0300 +++ new/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java 2015-11-05 16:11:37.158885764 +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 { --- old/test/compiler/floatingpoint/TestPow2.java 2015-11-05 16:11:37.374885764 +0300 +++ new/test/compiler/floatingpoint/TestPow2.java 2015-11-05 16:11:37.326885764 +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 { --- old/test/compiler/intrinsics/IntrinsicAvailableTest.java 2015-11-05 16:11:37.526885764 +0300 +++ new/test/compiler/intrinsics/IntrinsicAvailableTest.java 2015-11-05 16:11:37.478885764 +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 --- old/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java 2015-11-05 16:11:37.694885763 +0300 +++ new/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java 2015-11-05 16:11:37.646885763 +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 --- old/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java 2015-11-05 16:11:37.846885763 +0300 +++ new/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java 2015-11-05 16:11:37.794885763 +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 --- old/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java 2015-11-05 16:11:38.002885763 +0300 +++ new/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java 2015-11-05 16:11:37.954885763 +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 --- old/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java 2015-11-05 16:11:38.166885762 +0300 +++ new/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java 2015-11-05 16:11:38.110885762 +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 --- old/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java 2015-11-05 16:11:38.326885762 +0300 +++ new/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java 2015-11-05 16:11:38.270885762 +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 --- old/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java 2015-11-05 16:11:38.490885762 +0300 +++ new/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java 2015-11-05 16:11:38.442885762 +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 --- old/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java 2015-11-05 16:11:38.650885761 +0300 +++ new/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java 2015-11-05 16:11:38.598885761 +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 --- old/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java 2015-11-05 16:11:38.818885761 +0300 +++ new/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java 2015-11-05 16:11:38.766885761 +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 --- old/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java 2015-11-05 16:11:38.982885761 +0300 +++ new/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java 2015-11-05 16:11:38.934885761 +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 { --- old/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java 2015-11-05 16:11:39.138885760 +0300 +++ new/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java 2015-11-05 16:11:39.090885760 +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 --- old/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java 2015-11-05 16:11:39.318885760 +0300 +++ new/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java 2015-11-05 16:11:39.254885760 +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 --- old/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java 2015-11-05 16:11:39.466885760 +0300 +++ new/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java 2015-11-05 16:11:39.418885760 +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 --- old/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java 2015-11-05 16:11:39.638885759 +0300 +++ new/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java 2015-11-05 16:11:39.578885759 +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 --- old/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java 2015-11-05 16:11:39.798885759 +0300 +++ new/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java 2015-11-05 16:11:39.746885759 +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 --- old/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java 2015-11-05 16:11:39.954885759 +0300 +++ new/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java 2015-11-05 16:11:39.902885759 +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 --- old/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java 2015-11-05 16:11:40.110885758 +0300 +++ new/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java 2015-11-05 16:11:40.062885758 +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 --- old/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java 2015-11-05 16:11:40.270885758 +0300 +++ new/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java 2015-11-05 16:11:40.218885758 +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 --- old/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java 2015-11-05 16:11:40.426885758 +0300 +++ new/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java 2015-11-05 16:11:40.378885758 +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 --- old/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java 2015-11-05 16:11:40.578885757 +0300 +++ new/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java 2015-11-05 16:11:40.526885757 +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 --- old/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java 2015-11-05 16:11:40.738885757 +0300 +++ new/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java 2015-11-05 16:11:40.686885757 +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; --- old/test/compiler/intrinsics/mathexact/sanity/MathIntrinsic.java 2015-11-05 16:11:40.906885757 +0300 +++ new/test/compiler/intrinsics/mathexact/sanity/MathIntrinsic.java 2015-11-05 16:11:40.846885757 +0300 @@ -23,6 +23,7 @@ import java.lang.reflect.Executable; import java.util.concurrent.Callable; +import compiler.whitebox.CompilerWhiteBoxTest; public class MathIntrinsic { --- old/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java 2015-11-05 16:11:41.066885756 +0300 +++ new/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java 2015-11-05 16:11:41.014885756 +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 --- old/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java 2015-11-05 16:11:41.222885756 +0300 +++ new/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java 2015-11-05 16:11:41.170885756 +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 --- old/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java 2015-11-05 16:11:41.386885756 +0300 +++ new/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java 2015-11-05 16:11:41.334885756 +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 --- old/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java 2015-11-05 16:11:41.542885755 +0300 +++ new/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java 2015-11-05 16:11:41.490885755 +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 --- old/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java 2015-11-05 16:11:41.710885755 +0300 +++ new/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java 2015-11-05 16:11:41.654885755 +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 --- old/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java 2015-11-05 16:11:41.866885755 +0300 +++ new/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java 2015-11-05 16:11:41.810885755 +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 --- old/test/compiler/rangechecks/TestExplicitRangeChecks.java 2015-11-05 16:11:42.030885754 +0300 +++ new/test/compiler/rangechecks/TestExplicitRangeChecks.java 2015-11-05 16:11:41.978885754 +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 { --- old/test/compiler/rangechecks/TestRangeCheckSmearing.java 2015-11-05 16:11:42.186885754 +0300 +++ new/test/compiler/rangechecks/TestRangeCheckSmearing.java 2015-11-05 16:11:42.138885754 +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(); --- old/test/compiler/tiered/CompLevelsTest.java 2015-11-05 16:11:42.358885754 +0300 +++ new/test/compiler/tiered/CompLevelsTest.java 2015-11-05 16:11:42.306885754 +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); --- old/test/compiler/tiered/ConstantGettersTransitionsTest.java 2015-11-05 16:11:42.514885753 +0300 +++ new/test/compiler/tiered/ConstantGettersTransitionsTest.java 2015-11-05 16:11:42.466885753 +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 --- old/test/compiler/tiered/LevelTransitionTest.java 2015-11-05 16:11:42.674885753 +0300 +++ new/test/compiler/tiered/LevelTransitionTest.java 2015-11-05 16:11:42.618885753 +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 --- old/test/compiler/tiered/NonTieredLevelsTest.java 2015-11-05 16:11:42.842885752 +0300 +++ new/test/compiler/tiered/NonTieredLevelsTest.java 2015-11-05 16:11:42.790885753 +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 --- old/test/compiler/tiered/TieredLevelsTest.java 2015-11-05 16:11:43.002885752 +0300 +++ new/test/compiler/tiered/TieredLevelsTest.java 2015-11-05 16:11:42.954885752 +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 --- old/test/compiler/tiered/TransitionsTestExecutor.java 2015-11-05 16:11:43.170885752 +0300 +++ new/test/compiler/tiered/TransitionsTestExecutor.java 2015-11-05 16:11:43.114885752 +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 --- old/test/compiler/whitebox/ClearMethodStateTest.java 2015-11-05 16:11:43.334885751 +0300 +++ new/test/compiler/whitebox/ClearMethodStateTest.java 2015-11-05 16:11:43.282885752 +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 */ --- old/test/compiler/whitebox/CompilerWhiteBoxTest.java 2015-11-05 16:11:43.506885751 +0300 +++ new/test/compiler/whitebox/CompilerWhiteBoxTest.java 2015-11-05 16:11:43.446885751 +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 callable; - private final boolean isOsr; - - private SimpleTestCase(Executable executable, Callable callable, - boolean isOsr) { - this.executable = executable; - this.callable = callable; - this.isOsr = isOsr; - } - - @Override - public Executable getExecutable() { - return executable; - } - - @Override - public Callable getCallable() { - return callable; - } - - @Override - public boolean isOsr() { - return isOsr; - } - - private static class Helper { - - private static final Callable CONSTRUCTOR_CALLABLE - = new Callable() { - @Override - public Integer call() throws Exception { - return new Helper(1337).hashCode(); - } - }; - - private static final Callable METHOD_CALLABLE - = new Callable() { - private final Helper helper = new Helper(); - - @Override - public Integer call() throws Exception { - return helper.method(); - } - }; - - private static final Callable STATIC_CALLABLE - = new Callable() { - @Override - public Integer call() throws Exception { - return staticMethod(); - } - }; - - private static final Callable OSR_CONSTRUCTOR_CALLABLE - = new Callable() { - @Override - public Integer call() throws Exception { - return new Helper(null, CompilerWhiteBoxTest.BACKEDGE_THRESHOLD).hashCode(); - } - }; - - private static final Callable OSR_METHOD_CALLABLE - = new Callable() { - private final Helper helper = new Helper(); - - @Override - public Integer call() throws Exception { - return helper.osrMethod(CompilerWhiteBoxTest.BACKEDGE_THRESHOLD); - } - }; - - private static final Callable OSR_STATIC_CALLABLE - = new Callable() { - @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.(int)", e); - } - try { - OSR_CONSTRUCTOR = Helper.class.getDeclaredConstructor( - Object.class, long.class); - } catch (NoSuchMethodException | SecurityException e) { - throw new RuntimeException( - "exception on getting method Helper.(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; - } - } -} --- old/test/compiler/whitebox/DeoptimizeAllTest.java 2015-11-05 16:11:43.670885751 +0300 +++ new/test/compiler/whitebox/DeoptimizeAllTest.java 2015-11-05 16:11:43.610885751 +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 */ --- old/test/compiler/whitebox/DeoptimizeFramesTest.java 2015-11-05 16:11:43.834885750 +0300 +++ new/test/compiler/whitebox/DeoptimizeFramesTest.java 2015-11-05 16:11:43.778885751 +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 --- old/test/compiler/whitebox/DeoptimizeMethodTest.java 2015-11-05 16:11:43.990885750 +0300 +++ new/test/compiler/whitebox/DeoptimizeMethodTest.java 2015-11-05 16:11:43.938885750 +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 */ --- old/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java 2015-11-05 16:11:44.158885750 +0300 +++ new/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java 2015-11-05 16:11:44.102885750 +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 --- old/test/compiler/whitebox/EnqueueMethodForCompilationTest.java 2015-11-05 16:11:44.322885749 +0300 +++ new/test/compiler/whitebox/EnqueueMethodForCompilationTest.java 2015-11-05 16:11:44.274885749 +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 */ --- old/test/compiler/whitebox/ForceNMethodSweepTest.java 2015-11-05 16:11:44.486885749 +0300 +++ new/test/compiler/whitebox/ForceNMethodSweepTest.java 2015-11-05 16:11:44.434885749 +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 */ --- old/test/compiler/whitebox/GetNMethodTest.java 2015-11-05 16:11:44.646885749 +0300 +++ new/test/compiler/whitebox/GetNMethodTest.java 2015-11-05 16:11:44.598885749 +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 */ --- old/test/compiler/whitebox/IsMethodCompilableTest.java 2015-11-05 16:11:44.818885748 +0300 +++ new/test/compiler/whitebox/IsMethodCompilableTest.java 2015-11-05 16:11:44.762885748 +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 { /** --- old/test/compiler/whitebox/LockCompilationTest.java 2015-11-05 16:11:44.978885748 +0300 +++ new/test/compiler/whitebox/LockCompilationTest.java 2015-11-05 16:11:44.918885748 +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 { --- old/test/compiler/whitebox/MakeMethodNotCompilableTest.java 2015-11-05 16:11:45.122885748 +0300 +++ new/test/compiler/whitebox/MakeMethodNotCompilableTest.java 2015-11-05 16:11:45.078885748 +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 */ --- old/test/compiler/whitebox/SetDontInlineMethodTest.java 2015-11-05 16:11:45.286885747 +0300 +++ new/test/compiler/whitebox/SetDontInlineMethodTest.java 2015-11-05 16:11:45.234885747 +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 */ --- old/test/compiler/whitebox/SetForceInlineMethodTest.java 2015-11-05 16:11:45.442885747 +0300 +++ new/test/compiler/whitebox/SetForceInlineMethodTest.java 2015-11-05 16:11:45.390885747 +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 2015-09-02 16:01:38.172548995 +0300 +++ new/test/compiler/whitebox/SimpleTestCase.java 2015-11-05 16:11:45.558885747 +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 callable; + private final boolean isOsr; + + private SimpleTestCase(Executable executable, Callable callable, + boolean isOsr) { + this.executable = executable; + this.callable = callable; + this.isOsr = isOsr; + } + + @Override + public Executable getExecutable() { + return executable; + } + + @Override + public Callable getCallable() { + return callable; + } + + @Override + public boolean isOsr() { + return isOsr; + } + + private static class Helper { + + private static final Callable CONSTRUCTOR_CALLABLE + = new Callable() { + @Override + public Integer call() throws Exception { + return new Helper(1337).hashCode(); + } + }; + + private static final Callable METHOD_CALLABLE + = new Callable() { + private final Helper helper = new Helper(); + + @Override + public Integer call() throws Exception { + return helper.method(); + } + }; + + private static final Callable STATIC_CALLABLE + = new Callable() { + @Override + public Integer call() throws Exception { + return staticMethod(); + } + }; + + private static final Callable OSR_CONSTRUCTOR_CALLABLE + = new Callable() { + @Override + public Integer call() throws Exception { + return new Helper(null, CompilerWhiteBoxTest.BACKEDGE_THRESHOLD).hashCode(); + } + }; + + private static final Callable OSR_METHOD_CALLABLE + = new Callable() { + private final Helper helper = new Helper(); + + @Override + public Integer call() throws Exception { + return helper.osrMethod(CompilerWhiteBoxTest.BACKEDGE_THRESHOLD); + } + }; + + private static final Callable OSR_STATIC_CALLABLE + = new Callable() { + @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.(int)", e); + } + try { + OSR_CONSTRUCTOR = Helper.class.getDeclaredConstructor( + Object.class, long.class); + } catch (NoSuchMethodException | SecurityException e) { + throw new RuntimeException( + "exception on getting method Helper.(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; + } + } +}