aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriignatyev <none@none>2013-12-31 19:26:57 +0400
committeriignatyev <none@none>2013-12-31 19:26:57 +0400
commit77cda9cec59f5fa903cedc1369c6cd581c159803 (patch)
treef89c284969bd73d4b961c4a891dcedeaf97558be
parent852afd34581bb551e7c020d43f65e1d78add13d7 (diff)
8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
Reviewed-by: twisti Contributed-by: anton.ivanov@oracle.com
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java45
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java45
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java45
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java45
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java45
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java45
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java155
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/MathIntrinsic.java155
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java45
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java45
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java45
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java45
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java46
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java45
-rw-r--r--test/compiler/intrinsics/mathexact/sanity/Verifier.java71
-rw-r--r--test/compiler/tiered/NonTieredLevelsTest.java9
-rw-r--r--test/compiler/tiered/TieredLevelsTest.java6
-rw-r--r--test/compiler/whitebox/ClearMethodStateTest.java12
-rw-r--r--test/compiler/whitebox/CompilerWhiteBoxTest.java108
-rw-r--r--test/compiler/whitebox/DeoptimizeAllTest.java10
-rw-r--r--test/compiler/whitebox/DeoptimizeMethodTest.java10
-rw-r--r--test/compiler/whitebox/EnqueueMethodForCompilationTest.java8
-rw-r--r--test/compiler/whitebox/IsMethodCompilableTest.java14
-rw-r--r--test/compiler/whitebox/MakeMethodNotCompilableTest.java17
-rw-r--r--test/compiler/whitebox/SetDontInlineMethodTest.java8
-rw-r--r--test/compiler/whitebox/SetForceInlineMethodTest.java8
26 files changed, 1035 insertions, 97 deletions
diff --git a/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java b/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java
new file mode 100644
index 000000000..c55f847d2
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
+ * @build AddExactIntTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics AddExactIntTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics AddExactIntTest
+ * @run main Verifier hs_neg.log hs.log
+ */
+
+public class AddExactIntTest {
+
+ public static void main(String[] args) throws Exception {
+ new IntrinsicBase.IntTest(MathIntrinsic.IntIntrinsic.Add).test();
+ }
+}
diff --git a/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java b/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java
new file mode 100644
index 000000000..4823f073f
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
+ * @build AddExactLongTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics AddExactLongTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics AddExactLongTest
+ * @run main Verifier hs_neg.log hs.log
+ */
+
+public class AddExactLongTest {
+
+ public static void main(String[] args) throws Exception {
+ new IntrinsicBase.LongTest(MathIntrinsic.LongIntrinsic.Add).test();
+ }
+}
diff --git a/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java b/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java
new file mode 100644
index 000000000..0b97ab86a
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
+ * @build DecrementExactIntTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics DecrementExactIntTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics DecrementExactIntTest
+ * @run main Verifier hs_neg.log hs.log
+ */
+
+public class DecrementExactIntTest {
+
+ public static void main(String[] args) throws Exception {
+ new IntrinsicBase.IntTest(MathIntrinsic.IntIntrinsic.Decrement).test();
+ }
+}
diff --git a/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java b/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java
new file mode 100644
index 000000000..f2429aa91
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
+ * @build DecrementExactLongTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics DecrementExactLongTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics DecrementExactLongTest
+ * @run main Verifier hs_neg.log hs.log
+ */
+
+public class DecrementExactLongTest {
+
+ public static void main(String[] args) throws Exception {
+ new IntrinsicBase.LongTest(MathIntrinsic.LongIntrinsic.Decrement).test();
+ }
+} \ No newline at end of file
diff --git a/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java b/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java
new file mode 100644
index 000000000..714f4e2e0
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
+ * @build IncrementExactIntTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics IncrementExactIntTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics IncrementExactIntTest
+ * @run main Verifier hs_neg.log hs.log
+ */
+
+public class IncrementExactIntTest {
+
+ public static void main(String[] args) throws Exception {
+ new IntrinsicBase.IntTest(MathIntrinsic.IntIntrinsic.Increment).test();
+ }
+}
diff --git a/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java b/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java
new file mode 100644
index 000000000..19511c499
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
+ * @build IncrementExactLongTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics IncrementExactLongTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics IncrementExactLongTest
+ * @run main Verifier hs_neg.log hs.log
+ */
+
+public class IncrementExactLongTest {
+
+ public static void main(String[] args) throws Exception {
+ new IntrinsicBase.LongTest(MathIntrinsic.LongIntrinsic.Increment).test();
+ }
+}
diff --git a/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java b/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java
new file mode 100644
index 000000000..cecd6ce2d
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+import com.oracle.java.testlibrary.Platform;
+
+import java.io.FileOutputStream;
+import java.lang.reflect.Executable;
+import java.util.Properties;
+
+public abstract class IntrinsicBase extends CompilerWhiteBoxTest {
+ protected String javaVmName;
+ protected String useMathExactIntrinsics;
+
+ protected IntrinsicBase(TestCase testCase) {
+ super(testCase);
+ javaVmName = System.getProperty("java.vm.name");
+ useMathExactIntrinsics = getVMOption("UseMathExactIntrinsics");
+ }
+
+ @Override
+ protected void test() throws Exception {
+ //java.lang.Math should be loaded to allow a compilation of the methods that use Math's method
+ System.out.println("class java.lang.Math should be loaded. Proof: " + Math.class);
+ printEnvironmentInfo();
+
+ int expectedIntrinsicCount = 0;
+
+ switch (MODE) {
+ case "compiled mode":
+ case "mixed mode":
+ if (isServerVM()) {
+ if (TIERED_COMPILATION) {
+ int max_level = TIERED_STOP_AT_LEVEL;
+ expectedIntrinsicCount = (max_level == COMP_LEVEL_MAX) ? 1 : 0;
+ for (int i = CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE; i <= max_level; ++i) {
+ deoptimize();
+ compileAtLevel(i);
+ }
+ } else {
+ expectedIntrinsicCount = 1;
+ deoptimize();
+ compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
+ }
+ } else {
+ deoptimize();
+ compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
+ }
+
+ if (!isIntrinsicSupported()) {
+ expectedIntrinsicCount = 0;
+ }
+ break;
+ case "interpreted mode": //test is not applicable in this mode;
+ System.err.println("Warning: This test is not applicable in mode: " + MODE);
+ break;
+ default:
+ throw new RuntimeException("Test bug, unknown VM mode: " + MODE);
+ }
+
+ System.out.println("Expected intrinsic count is " + expectedIntrinsicCount + " name " + getIntrinsicId());
+
+ final FileOutputStream out = new FileOutputStream(getVMOption("LogFile") + ".verify.properties");
+ Properties expectedProps = new Properties();
+ expectedProps.setProperty("intrinsic.name", getIntrinsicId());
+ expectedProps.setProperty("intrinsic.expectedCount", String.valueOf(expectedIntrinsicCount));
+ expectedProps.store(out, null);
+
+ out.close();
+ }
+
+ protected void printEnvironmentInfo() {
+ System.out.println("java.vm.name=" + javaVmName);
+ System.out.println("os.arch=" + Platform.getOsArch());
+ System.out.println("java.vm.info=" + MODE);
+ System.out.println("useMathExactIntrinsics=" + useMathExactIntrinsics);
+ }
+
+ protected void compileAtLevel(int level) {
+ WHITE_BOX.enqueueMethodForCompilation(method, level);
+ waitBackgroundCompilation();
+ checkCompilation(method, level);
+ }
+
+ protected void checkCompilation(Executable executable, int level) {
+ if (!WHITE_BOX.isMethodCompiled(executable)) {
+ throw new RuntimeException("Test bug, expected compilation (level): " + level + ", but not compiled");
+ }
+ final int compilationLevel = WHITE_BOX.getMethodCompilationLevel(executable);
+ if (compilationLevel != level) {
+ if (!(TIERED_COMPILATION && level == COMP_LEVEL_FULL_PROFILE && compilationLevel == COMP_LEVEL_LIMITED_PROFILE)) { //possible case
+ throw new RuntimeException("Test bug, expected compilation (level): " + level + ", but level: " + compilationLevel);
+ }
+ }
+ }
+
+ protected abstract boolean isIntrinsicSupported();
+
+ protected abstract String getIntrinsicId();
+
+ protected boolean isServerVM() {
+ return javaVmName.toLowerCase().contains("server");
+ }
+
+ static class IntTest extends IntrinsicBase {
+ protected IntTest(MathIntrinsic.IntIntrinsic testCase) {
+ super(testCase);
+ }
+
+ @Override
+ protected boolean isIntrinsicSupported() {
+ return isServerVM() && Boolean.valueOf(useMathExactIntrinsics) && (Platform.isX86() || Platform.isX64());
+ }
+
+ @Override
+ protected String getIntrinsicId() {
+ return "_" + testCase.name().toLowerCase() + "ExactI";
+ }
+ }
+
+ static class LongTest extends IntrinsicBase {
+ protected LongTest(MathIntrinsic.LongIntrinsic testCase) {
+ super(testCase);
+ }
+
+ @Override
+ protected boolean isIntrinsicSupported() {
+ return isServerVM() && Boolean.valueOf(useMathExactIntrinsics) && Platform.isX64();
+ }
+
+ @Override
+ protected String getIntrinsicId() {
+ return "_" + testCase.name().toLowerCase() + "ExactL";
+ }
+ }
+}
diff --git a/test/compiler/intrinsics/mathexact/sanity/MathIntrinsic.java b/test/compiler/intrinsics/mathexact/sanity/MathIntrinsic.java
new file mode 100644
index 000000000..99039f9a7
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/MathIntrinsic.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+import java.lang.reflect.Executable;
+import java.util.concurrent.Callable;
+
+public class MathIntrinsic {
+
+ enum IntIntrinsic implements CompilerWhiteBoxTest.TestCase {
+ Add {
+ @Override
+ Object execMathMethod() {
+ return intR = Math.addExact(int1, int2);
+ }
+ },
+ Subtract {
+ @Override
+ Object execMathMethod() {
+ return intR = Math.subtractExact(int1, int2);
+ }
+ },
+ Multiply {
+ @Override
+ Object execMathMethod() {
+ return intR = Math.multiplyExact(int1, int2);
+ }
+ },
+ Increment {
+ @Override
+ Object execMathMethod() {
+ return intR = Math.incrementExact(int1);
+ }
+ },
+ Decrement {
+ @Override
+ Object execMathMethod() {
+ return intR = Math.decrementExact(int1);
+ }
+ },
+ Negate {
+ @Override
+ Object execMathMethod() {
+ return intR = Math.negateExact(int1);
+ }
+ };
+ protected int int1;
+ protected int int2;
+ protected int intR;
+
+ abstract Object execMathMethod();
+
+ @Override
+ public Executable getExecutable() {
+ try {
+ return getClass().getDeclaredMethod("execMathMethod");
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException("Test bug, no such method: " + e);
+ }
+ }
+
+ @Override
+ public Callable<Integer> getCallable() {
+ return null;
+ }
+
+ @Override
+ public boolean isOsr() {
+ return false;
+ }
+
+ }
+
+ enum LongIntrinsic implements CompilerWhiteBoxTest.TestCase {
+ Add {
+ @Override
+ Object execMathMethod() {
+ return longR = Math.addExact(long1, long2);
+ }
+ },
+ Subtract {
+ @Override
+ Object execMathMethod() {
+ return longR = Math.subtractExact(long1, long2);
+ }
+ },
+ Multiply {
+ @Override
+ Object execMathMethod() {
+ return longR = Math.multiplyExact(long1, long2);
+ }
+ },
+ Increment {
+ @Override
+ Object execMathMethod() {
+ return longR = Math.incrementExact(long1);
+ }
+ },
+ Decrement {
+ @Override
+ Object execMathMethod() {
+ return longR = Math.decrementExact(long1);
+ }
+ },
+ Negate {
+ @Override
+ Object execMathMethod() {
+ return longR = Math.negateExact(long1);
+ }
+ };
+ protected long long1;
+ protected long long2;
+ protected long longR;
+
+ abstract Object execMathMethod();
+
+ @Override
+ public Executable getExecutable() {
+ try {
+ return getClass().getDeclaredMethod("execMathMethod");
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException("Test bug, no such method: " + e);
+ }
+ }
+
+ @Override
+ public Callable<Integer> getCallable() {
+ return null;
+ }
+
+ @Override
+ public boolean isOsr() {
+ return false;
+ }
+ }
+}
diff --git a/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java b/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java
new file mode 100644
index 000000000..bd4335001
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
+ * @build MultiplyExactIntTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics MultiplyExactIntTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics MultiplyExactIntTest
+ * @run main Verifier hs_neg.log hs.log
+ */
+
+public class MultiplyExactIntTest {
+
+ public static void main(String[] args) throws Exception {
+ new IntrinsicBase.IntTest(MathIntrinsic.IntIntrinsic.Multiply).test();
+ }
+}
diff --git a/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java b/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java
new file mode 100644
index 000000000..70651107d
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
+ * @build MultiplyExactLongTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics MultiplyExactLongTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics MultiplyExactLongTest
+ * @run main Verifier hs_neg.log hs.log
+ */
+
+public class MultiplyExactLongTest {
+
+ public static void main(String[] args) throws Exception {
+ new IntrinsicBase.LongTest(MathIntrinsic.LongIntrinsic.Multiply).test();
+ }
+}
diff --git a/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java b/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java
new file mode 100644
index 000000000..579c2907e
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
+ * @build NegateExactIntTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics NegateExactIntTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics NegateExactIntTest
+ * @run main Verifier hs_neg.log hs.log
+ */
+
+public class NegateExactIntTest {
+
+ public static void main(String[] args) throws Exception {
+ new IntrinsicBase.IntTest(MathIntrinsic.IntIntrinsic.Negate).test();
+ }
+}
diff --git a/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java b/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java
new file mode 100644
index 000000000..6f114f632
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
+ * @build NegateExactLongTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics NegateExactLongTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics NegateExactLongTest
+ * @run main Verifier hs_neg.log hs.log
+ */
+
+public class NegateExactLongTest {
+
+ public static void main(String[] args) throws Exception {
+ new IntrinsicBase.LongTest(MathIntrinsic.LongIntrinsic.Negate).test();
+ }
+}
diff --git a/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java b/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java
new file mode 100644
index 000000000..d1eaf3919
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
+ * @build SubtractExactIntTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics SubtractExactIntTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics SubtractExactIntTest
+ * @run main Verifier hs_neg.log hs.log
+
+ */
+
+public class SubtractExactIntTest {
+
+ public static void main(String[] args) throws Exception {
+ new IntrinsicBase.IntTest(MathIntrinsic.IntIntrinsic.Subtract).test();
+ }
+}
diff --git a/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java b/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java
new file mode 100644
index 000000000..fbe8eb1e1
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
+ * @build SubtractExactLongTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics SubtractExactLongTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
+ * -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
+ * -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics SubtractExactLongTest
+ * @run main Verifier hs_neg.log hs.log
+ */
+
+public class SubtractExactLongTest {
+
+ public static void main(String[] args) throws Exception {
+ new IntrinsicBase.LongTest(MathIntrinsic.LongIntrinsic.Subtract).test();
+ }
+}
diff --git a/test/compiler/intrinsics/mathexact/sanity/Verifier.java b/test/compiler/intrinsics/mathexact/sanity/Verifier.java
new file mode 100644
index 000000000..7b26d64c6
--- /dev/null
+++ b/test/compiler/intrinsics/mathexact/sanity/Verifier.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.util.Properties;
+
+public class Verifier {
+
+ public static void main(String[] args) throws Exception {
+ if (args.length == 0)
+ throw new RuntimeException("Test bug, nothing to verify");
+ for (String hsLogFile : args) {
+ verify(hsLogFile);
+ }
+ }
+
+ private static void verify(String hsLogFile) throws Exception {
+ System.out.println("Verifying " + hsLogFile);
+
+ final Properties expectedProperties = new Properties();
+ final FileReader reader = new FileReader(hsLogFile + ".verify.properties");
+ expectedProperties.load(reader);
+ reader.close();
+
+ int fullMatchCnt = 0;
+ int suspectCnt = 0;
+ final String intrinsicId = expectedProperties.getProperty("intrinsic.name");
+ final String prefix = "<intrinsic id='";
+ final String prefixWithId = prefix + intrinsicId + "'";
+ final int expectedCount = Integer.parseInt(expectedProperties.getProperty("intrinsic.expectedCount"));
+
+ BufferedReader r = new BufferedReader(new FileReader(hsLogFile));
+ String s;
+ while ((s = r.readLine()) != null) {
+ if (s.startsWith(prefix)) {
+ if (s.startsWith(prefixWithId)) {
+ fullMatchCnt++;
+ } else {
+ suspectCnt++;
+ System.out.println("WARNING: Other intrinsic detected " + s);
+ }
+ }
+ }
+ r.close();
+
+ System.out.println("Intrinsic " + intrinsicId + " verification, expected: " + expectedCount + ", matched: " + fullMatchCnt + ", suspected: " + suspectCnt);
+ if (expectedCount != fullMatchCnt)
+ throw new RuntimeException("Unexpected count of intrinsic " + prefixWithId + " expected:" + expectedCount + ", matched: " + fullMatchCnt + ", suspected: " + suspectCnt);
+ }
+}
diff --git a/test/compiler/tiered/NonTieredLevelsTest.java b/test/compiler/tiered/NonTieredLevelsTest.java
index 28fd24d30..715d32a89 100644
--- a/test/compiler/tiered/NonTieredLevelsTest.java
+++ b/test/compiler/tiered/NonTieredLevelsTest.java
@@ -30,7 +30,7 @@ import java.util.function.IntPredicate;
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- * -XX:CompileCommand=compileonly,TestCase$Helper::*
+ * -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
* NonTieredLevelsTest
* @summary Verify that only one level can be used
* @author igor.ignatyev@oracle.com
@@ -59,9 +59,7 @@ public class NonTieredLevelsTest extends CompLevelsTest {
+ "TieredCompilation. Skip test.");
return;
}
- for (TestCase test : TestCase.values()) {
- new NonTieredLevelsTest(test).runTest();
- }
+ CompilerWhiteBoxTest.main(NonTieredLevelsTest::new, args);
}
private NonTieredLevelsTest(TestCase testCase) {
@@ -80,7 +78,7 @@ public class NonTieredLevelsTest extends CompLevelsTest {
checkLevel(AVAILABLE_COMP_LEVEL, compLevel);
int bci = WHITE_BOX.getMethodEntryBci(method);
deoptimize();
- if (!testCase.isOsr) {
+ if (!testCase.isOsr()) {
for (int level = 1; level <= COMP_LEVEL_MAX; ++level) {
if (IS_AVAILABLE_COMPLEVEL.test(level)) {
testAvailableLevel(level, bci);
@@ -94,3 +92,4 @@ public class NonTieredLevelsTest extends CompLevelsTest {
}
}
}
+
diff --git a/test/compiler/tiered/TieredLevelsTest.java b/test/compiler/tiered/TieredLevelsTest.java
index 9d3112aa2..675a39449 100644
--- a/test/compiler/tiered/TieredLevelsTest.java
+++ b/test/compiler/tiered/TieredLevelsTest.java
@@ -28,7 +28,7 @@
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- * -XX:CompileCommand=compileonly,TestCase$Helper::*
+ * -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
* TieredLevelsTest
* @summary Verify that all levels &lt; 'TieredStopAtLevel' can be used
* @author igor.ignatyev@oracle.com
@@ -40,9 +40,7 @@ public class TieredLevelsTest extends CompLevelsTest {
+ "TieredCompilation. Skip test.");
return;
}
- for (TestCase test : TestCase.values()) {
- new TieredLevelsTest(test).runTest();
- }
+ CompilerWhiteBoxTest.main(TieredLevelsTest::new, args);
}
private TieredLevelsTest(TestCase testCase) {
diff --git a/test/compiler/whitebox/ClearMethodStateTest.java b/test/compiler/whitebox/ClearMethodStateTest.java
index 3f66a5a69..89fff6846 100644
--- a/test/compiler/whitebox/ClearMethodStateTest.java
+++ b/test/compiler/whitebox/ClearMethodStateTest.java
@@ -21,25 +21,25 @@
* questions.
*/
+import java.util.function.Function;
+
/*
* @test ClearMethodStateTest
* @bug 8006683 8007288 8022832
* @library /testlibrary /testlibrary/whitebox
* @build ClearMethodStateTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* ClearMethodStateTest
+ * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* ClearMethodStateTest
* @summary testing of WB::clearMethodState()
* @author igor.ignatyev@oracle.com
*/
public class ClearMethodStateTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception {
- for (TestCase test : TestCase.values()) {
- new ClearMethodStateTest(test).runTest();
- }
+ CompilerWhiteBoxTest.main(ClearMethodStateTest::new, args);
}
- public ClearMethodStateTest(TestCase testCase) {
+ private ClearMethodStateTest(TestCase testCase) {
super(testCase);
// to prevent inlining of #method
WHITE_BOX.testSetDontInlineMethod(method, true);
@@ -63,7 +63,7 @@ public class ClearMethodStateTest extends CompilerWhiteBoxTest {
deoptimize();
checkNotCompiled();
- if (testCase.isOsr) {
+ if (testCase.isOsr()) {
// part test isn't applicable for OSR test case
return;
}
diff --git a/test/compiler/whitebox/CompilerWhiteBoxTest.java b/test/compiler/whitebox/CompilerWhiteBoxTest.java
index 5265947a3..e47231e29 100644
--- a/test/compiler/whitebox/CompilerWhiteBoxTest.java
+++ b/test/compiler/whitebox/CompilerWhiteBoxTest.java
@@ -31,6 +31,7 @@ import java.lang.reflect.Executable;
import java.lang.reflect.Method;
import java.util.Objects;
import java.util.concurrent.Callable;
+import java.util.function.Function;
/**
* Abstract class for WhiteBox testing of JIT.
@@ -50,7 +51,7 @@ public abstract class CompilerWhiteBoxTest {
protected static int COMP_LEVEL_FULL_PROFILE = 3;
/** {@code CompLevel::CompLevel_full_optimization} -- C2 or Shark */
protected static int COMP_LEVEL_FULL_OPTIMIZATION = 4;
- /** Maximal value for CompLeveL */
+ /** Maximal value for CompLevel */
protected static int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION;
/** Instance of WhiteBox */
@@ -75,8 +76,7 @@ public abstract class CompilerWhiteBoxTest {
/** count of invocation to triger OSR compilation */
protected static final long BACKEDGE_THRESHOLD;
/** Value of {@code java.vm.info} (interpreted|mixed|comp mode) */
- protected static final String MODE
- = System.getProperty("java.vm.info");
+ protected static final String MODE = System.getProperty("java.vm.info");
static {
if (TIERED_COMPILATION) {
@@ -133,6 +133,20 @@ public abstract class CompilerWhiteBoxTest {
return compLevel == COMP_LEVEL_FULL_OPTIMIZATION;
}
+ protected static void main(
+ Function<TestCase, CompilerWhiteBoxTest> constructor,
+ String[] args) {
+ if (args.length == 0) {
+ for (TestCase test : SimpleTestCase.values()) {
+ constructor.apply(test).runTest();
+ }
+ } else {
+ for (String name : args) {
+ constructor.apply(SimpleTestCase.valueOf(name)).runTest();
+ }
+ }
+ }
+
/** tested method */
protected final Executable method;
protected final TestCase testCase;
@@ -145,7 +159,7 @@ public abstract class CompilerWhiteBoxTest {
protected CompilerWhiteBoxTest(TestCase testCase) {
Objects.requireNonNull(testCase);
System.out.println("TEST CASE:" + testCase.name());
- method = testCase.executable;
+ method = testCase.getExecutable();
this.testCase = testCase;
}
@@ -204,7 +218,7 @@ public abstract class CompilerWhiteBoxTest {
if (WHITE_BOX.getMethodCompilationLevel(method, true) != 0) {
throw new RuntimeException(method + " osr_comp_level must be == 0");
}
- }
+ }
/**
* Checks, that {@linkplain #method} is compiled.
@@ -221,44 +235,46 @@ public abstract class CompilerWhiteBoxTest {
method, System.currentTimeMillis() - start);
return;
}
- if (!WHITE_BOX.isMethodCompiled(method, testCase.isOsr)) {
+ if (!WHITE_BOX.isMethodCompiled(method, testCase.isOsr())) {
throw new RuntimeException(method + " must be "
- + (testCase.isOsr ? "osr_" : "") + "compiled");
+ + (testCase.isOsr() ? "osr_" : "") + "compiled");
}
- if (WHITE_BOX.getMethodCompilationLevel(method, testCase.isOsr) == 0) {
+ if (WHITE_BOX.getMethodCompilationLevel(method, testCase.isOsr())
+ == 0) {
throw new RuntimeException(method
- + (testCase.isOsr ? " osr_" : " ")
+ + (testCase.isOsr() ? " osr_" : " ")
+ "comp_level must be != 0");
}
}
protected final void deoptimize() {
- WHITE_BOX.deoptimizeMethod(method, testCase.isOsr);
- if (testCase.isOsr) {
+ WHITE_BOX.deoptimizeMethod(method, testCase.isOsr());
+ if (testCase.isOsr()) {
WHITE_BOX.deoptimizeMethod(method, false);
}
}
protected final int getCompLevel() {
- return WHITE_BOX.getMethodCompilationLevel(method, testCase.isOsr);
+ return WHITE_BOX.getMethodCompilationLevel(method, testCase.isOsr());
}
protected final boolean isCompilable() {
return WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY,
- testCase.isOsr);
+ testCase.isOsr());
}
protected final boolean isCompilable(int compLevel) {
- return WHITE_BOX.isMethodCompilable(method, compLevel, testCase.isOsr);
+ return WHITE_BOX
+ .isMethodCompilable(method, compLevel, testCase.isOsr());
}
protected final void makeNotCompilable() {
WHITE_BOX.makeMethodNotCompilable(method, COMP_LEVEL_ANY,
- testCase.isOsr);
+ testCase.isOsr());
}
protected final void makeNotCompilable(int compLevel) {
- WHITE_BOX.makeMethodNotCompilable(method, compLevel, testCase.isOsr);
+ WHITE_BOX.makeMethodNotCompilable(method, compLevel, testCase.isOsr());
}
/**
@@ -298,7 +314,7 @@ public abstract class CompilerWhiteBoxTest {
WHITE_BOX.isMethodCompiled(method, true));
System.out.printf("\tosr_comp_level:\t%d%n",
WHITE_BOX.getMethodCompilationLevel(method, true));
- System.out.printf("\tin_queue:\t%b%n",
+ System.out.printf("\tin_queue:\t%b%n",
WHITE_BOX.isMethodQueuedForCompilation(method));
System.out.printf("compile_queues_size:\t%d%n%n",
WHITE_BOX.getCompileQueuesSize());
@@ -311,13 +327,13 @@ public abstract class CompilerWhiteBoxTest {
/**
* Tries to trigger compilation of {@linkplain #method} by call
- * {@linkplain #testCase.callable} enough times.
+ * {@linkplain TestCase#getCallable()} enough times.
*
* @return accumulated result
* @see #compile(int)
*/
protected final int compile() {
- if (testCase.isOsr) {
+ if (testCase.isOsr()) {
return compile(1);
} else {
return compile(THRESHOLD);
@@ -326,7 +342,7 @@ public abstract class CompilerWhiteBoxTest {
/**
* Tries to trigger compilation of {@linkplain #method} by call
- * {@linkplain #testCase.callable} specified times.
+ * {@linkplain TestCase#getCallable()} specified times.
*
* @param count invocation count
* @return accumulated result
@@ -336,7 +352,7 @@ public abstract class CompilerWhiteBoxTest {
Integer tmp;
for (int i = 0; i < count; ++i) {
try {
- tmp = testCase.callable.call();
+ tmp = testCase.getCallable().call();
} catch (Exception e) {
tmp = null;
}
@@ -347,19 +363,32 @@ public abstract class CompilerWhiteBoxTest {
}
return result;
}
+
+ /**
+ * Utility interface provides tested method and object to invoke it.
+ */
+ public interface TestCase {
+ /** the name of test case */
+ String name();
+
+ /** tested method */
+ Executable getExecutable();
+
+ /** object to invoke {@linkplain #getExecutable()} */
+ Callable<Integer> getCallable();
+
+ /** flag for OSR test case */
+ boolean isOsr();
+ }
}
-/**
- * Utility structure containing tested method and object to invoke it.
- */
-enum TestCase {
+enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
/** constructor test case */
CONSTRUCTOR_TEST(Helper.CONSTRUCTOR, Helper.CONSTRUCTOR_CALLABLE, false),
/** method test case */
METOD_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),
@@ -368,20 +397,32 @@ enum TestCase {
/** OSR static method test case */
OSR_STATIC_TEST(Helper.OSR_STATIC, Helper.OSR_STATIC_CALLABLE, true);
- /** tested method */
- final Executable executable;
- /** object to invoke {@linkplain #executable} */
- final Callable<Integer> callable;
- /** flag for OSR test case */
- final boolean isOsr;
+ private final Executable executable;
+ private final Callable<Integer> callable;
+ private final boolean isOsr;
- private TestCase(Executable executable, Callable<Integer> callable,
+ 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
@@ -436,7 +477,6 @@ enum TestCase {
}
};
-
private static final Constructor CONSTRUCTOR;
private static final Constructor OSR_CONSTRUCTOR;
private static final Method METHOD;
diff --git a/test/compiler/whitebox/DeoptimizeAllTest.java b/test/compiler/whitebox/DeoptimizeAllTest.java
index 61d8b5998..350c99c8f 100644
--- a/test/compiler/whitebox/DeoptimizeAllTest.java
+++ b/test/compiler/whitebox/DeoptimizeAllTest.java
@@ -27,19 +27,17 @@
* @library /testlibrary /testlibrary/whitebox
* @build DeoptimizeAllTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* DeoptimizeAllTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* DeoptimizeAllTest
* @summary testing of WB::deoptimizeAll()
* @author igor.ignatyev@oracle.com
*/
public class DeoptimizeAllTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception {
- for (TestCase test : TestCase.values()) {
- new DeoptimizeAllTest(test).runTest();
- }
+ CompilerWhiteBoxTest.main(DeoptimizeAllTest::new, args);
}
- public DeoptimizeAllTest(TestCase testCase) {
+ private DeoptimizeAllTest(TestCase testCase) {
super(testCase);
// to prevent inlining of #method
WHITE_BOX.testSetDontInlineMethod(method, true);
@@ -53,7 +51,7 @@ public class DeoptimizeAllTest extends CompilerWhiteBoxTest {
*/
@Override
protected void test() throws Exception {
- if (testCase.isOsr && CompilerWhiteBoxTest.MODE.startsWith(
+ if (testCase.isOsr() && CompilerWhiteBoxTest.MODE.startsWith(
"compiled ")) {
System.err.printf("Warning: %s is not applicable in %s%n",
testCase.name(), CompilerWhiteBoxTest.MODE);
diff --git a/test/compiler/whitebox/DeoptimizeMethodTest.java b/test/compiler/whitebox/DeoptimizeMethodTest.java
index 8ac065bd1..565a5b91c 100644
--- a/test/compiler/whitebox/DeoptimizeMethodTest.java
+++ b/test/compiler/whitebox/DeoptimizeMethodTest.java
@@ -27,19 +27,17 @@
* @library /testlibrary /testlibrary/whitebox
* @build DeoptimizeMethodTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* DeoptimizeMethodTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* DeoptimizeMethodTest
* @summary testing of WB::deoptimizeMethod()
* @author igor.ignatyev@oracle.com
*/
public class DeoptimizeMethodTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception {
- for (TestCase test : TestCase.values()) {
- new DeoptimizeMethodTest(test).runTest();
- }
+ CompilerWhiteBoxTest.main(DeoptimizeMethodTest::new, args);
}
- public DeoptimizeMethodTest(TestCase testCase) {
+ private DeoptimizeMethodTest(TestCase testCase) {
super(testCase);
// to prevent inlining of #method
WHITE_BOX.testSetDontInlineMethod(method, true);
@@ -53,7 +51,7 @@ public class DeoptimizeMethodTest extends CompilerWhiteBoxTest {
*/
@Override
protected void test() throws Exception {
- if (testCase.isOsr && CompilerWhiteBoxTest.MODE.startsWith(
+ if (testCase.isOsr() && CompilerWhiteBoxTest.MODE.startsWith(
"compiled ")) {
System.err.printf("Warning: %s is not applicable in %s%n",
testCase.name(), CompilerWhiteBoxTest.MODE);
diff --git a/test/compiler/whitebox/EnqueueMethodForCompilationTest.java b/test/compiler/whitebox/EnqueueMethodForCompilationTest.java
index 6d14d9211..d9139dd36 100644
--- a/test/compiler/whitebox/EnqueueMethodForCompilationTest.java
+++ b/test/compiler/whitebox/EnqueueMethodForCompilationTest.java
@@ -27,19 +27,17 @@
* @library /testlibrary /testlibrary/whitebox
* @build EnqueueMethodForCompilationTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* EnqueueMethodForCompilationTest
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* EnqueueMethodForCompilationTest
* @summary testing of WB::enqueueMethodForCompilation()
* @author igor.ignatyev@oracle.com
*/
public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception {
- for (TestCase test : TestCase.values()) {
- new EnqueueMethodForCompilationTest(test).runTest();
- }
+ CompilerWhiteBoxTest.main(EnqueueMethodForCompilationTest::new, args);
}
- public EnqueueMethodForCompilationTest(TestCase testCase) {
+ private EnqueueMethodForCompilationTest(TestCase testCase) {
super(testCase);
// to prevent inlining of #method
WHITE_BOX.testSetDontInlineMethod(method, true);
diff --git a/test/compiler/whitebox/IsMethodCompilableTest.java b/test/compiler/whitebox/IsMethodCompilableTest.java
index a17fcb82f..bd5916a7c 100644
--- a/test/compiler/whitebox/IsMethodCompilableTest.java
+++ b/test/compiler/whitebox/IsMethodCompilableTest.java
@@ -27,7 +27,7 @@
* @library /testlibrary /testlibrary/whitebox
* @build IsMethodCompilableTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* IsMethodCompilableTest
+ * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest
* @summary testing of WB::isMethodCompilable()
* @author igor.ignatyev@oracle.com
*/
@@ -48,12 +48,10 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
}
public static void main(String[] args) throws Exception {
- for (TestCase test : TestCase.values()) {
- new IsMethodCompilableTest(test).runTest();
- }
+ CompilerWhiteBoxTest.main(IsMethodCompilableTest::new, args);
}
- public IsMethodCompilableTest(TestCase testCase) {
+ private IsMethodCompilableTest(TestCase testCase) {
super(testCase);
// to prevent inlining of #method
WHITE_BOX.testSetDontInlineMethod(method, true);
@@ -68,7 +66,7 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
*/
@Override
protected void test() throws Exception {
- if (testCase.isOsr && CompilerWhiteBoxTest.MODE.startsWith(
+ if (testCase.isOsr() && CompilerWhiteBoxTest.MODE.startsWith(
"compiled ")) {
System.err.printf("Warning: %s is not applicable in %s%n",
testCase.name(), CompilerWhiteBoxTest.MODE);
@@ -89,7 +87,7 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
for (long i = 0L, n = PER_METHOD_RECOMPILATION_CUTOFF - 1; i < n; ++i) {
compileAndDeoptimize();
}
- if (!testCase.isOsr && !isCompilable()) {
+ if (!testCase.isOsr() && !isCompilable()) {
// in osr test case count of deopt maybe more than iterations
throw new RuntimeException(method + " is not compilable after "
+ (PER_METHOD_RECOMPILATION_CUTOFF - 1) + " iterations");
@@ -102,7 +100,7 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
&& isCompilable(); ++i) {
compileAndDeoptimize();
}
- if (!testCase.isOsr && i != PER_METHOD_RECOMPILATION_CUTOFF) {
+ if (!testCase.isOsr() && i != PER_METHOD_RECOMPILATION_CUTOFF) {
// in osr test case count of deopt maybe more than iterations
throw new RuntimeException(method + " is not compilable after "
+ i + " iterations, but must only after "
diff --git a/test/compiler/whitebox/MakeMethodNotCompilableTest.java b/test/compiler/whitebox/MakeMethodNotCompilableTest.java
index 6a1e3613f..cbd65da45 100644
--- a/test/compiler/whitebox/MakeMethodNotCompilableTest.java
+++ b/test/compiler/whitebox/MakeMethodNotCompilableTest.java
@@ -27,26 +27,17 @@
* @library /testlibrary /testlibrary/whitebox
* @build MakeMethodNotCompilableTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* MakeMethodNotCompilableTest
+ * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* MakeMethodNotCompilableTest
* @summary testing of WB::makeMethodNotCompilable()
* @author igor.ignatyev@oracle.com
*/
public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
private int bci;
public static void main(String[] args) throws Exception {
- if (args.length == 0) {
- for (TestCase test : TestCase.values()) {
- new MakeMethodNotCompilableTest(test).runTest();
- }
- } else {
- for (String name : args) {
- new MakeMethodNotCompilableTest(
- TestCase.valueOf(name)).runTest();
- }
- }
+ CompilerWhiteBoxTest.main(MakeMethodNotCompilableTest::new, args);
}
- public MakeMethodNotCompilableTest(TestCase testCase) {
+ private MakeMethodNotCompilableTest(TestCase testCase) {
super(testCase);
// to prevent inlining of #method
WHITE_BOX.testSetDontInlineMethod(method, true);
@@ -62,7 +53,7 @@ public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
*/
@Override
protected void test() throws Exception {
- if (testCase.isOsr && CompilerWhiteBoxTest.MODE.startsWith(
+ if (testCase.isOsr() && CompilerWhiteBoxTest.MODE.startsWith(
"compiled ")) {
System.err.printf("Warning: %s is not applicable in %s%n",
testCase.name(), CompilerWhiteBoxTest.MODE);
diff --git a/test/compiler/whitebox/SetDontInlineMethodTest.java b/test/compiler/whitebox/SetDontInlineMethodTest.java
index e2bff376c..ae42d531a 100644
--- a/test/compiler/whitebox/SetDontInlineMethodTest.java
+++ b/test/compiler/whitebox/SetDontInlineMethodTest.java
@@ -27,19 +27,17 @@
* @library /testlibrary /testlibrary/whitebox
* @build SetDontInlineMethodTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* SetDontInlineMethodTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* SetDontInlineMethodTest
* @summary testing of WB::testSetDontInlineMethod()
* @author igor.ignatyev@oracle.com
*/
public class SetDontInlineMethodTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception {
- for (TestCase test : TestCase.values()) {
- new SetDontInlineMethodTest(test).runTest();
- }
+ CompilerWhiteBoxTest.main(SetDontInlineMethodTest::new, args);
}
- public SetDontInlineMethodTest(TestCase testCase) {
+ private SetDontInlineMethodTest(TestCase testCase) {
super(testCase);
}
diff --git a/test/compiler/whitebox/SetForceInlineMethodTest.java b/test/compiler/whitebox/SetForceInlineMethodTest.java
index 5aa90c3fc..086d7c22e 100644
--- a/test/compiler/whitebox/SetForceInlineMethodTest.java
+++ b/test/compiler/whitebox/SetForceInlineMethodTest.java
@@ -27,19 +27,17 @@
* @library /testlibrary /testlibrary/whitebox
* @build SetForceInlineMethodTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* SetForceInlineMethodTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* SetForceInlineMethodTest
* @summary testing of WB::testSetForceInlineMethod()
* @author igor.ignatyev@oracle.com
*/
public class SetForceInlineMethodTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception {
- for (TestCase test : TestCase.values()) {
- new SetForceInlineMethodTest(test).runTest();
- }
+ CompilerWhiteBoxTest.main(SetForceInlineMethodTest::new, args);
}
- public SetForceInlineMethodTest(TestCase testCase) {
+ private SetForceInlineMethodTest(TestCase testCase) {
super(testCase);
}