aboutsummaryrefslogtreecommitdiff
path: root/test/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'test/compiler')
-rw-r--r--test/compiler/codegen/IntRotateWithImmediate.java64
-rw-r--r--test/compiler/codegen/LoadWithMask.java2
-rw-r--r--test/compiler/codegen/LoadWithMask2.java2
-rw-r--r--test/compiler/escapeAnalysis/TestEABadMergeMem.java86
-rw-r--r--test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java74
-rw-r--r--test/compiler/inlining/DefaultMethodsDependencies.java63
-rw-r--r--test/compiler/jsr292/MHInlineTest.java207
-rw-r--r--test/compiler/jsr292/PollutedTrapCounts.java109
-rw-r--r--test/compiler/loopopts/ConstFPVectorization.java63
-rw-r--r--test/compiler/loopopts/CountedLoopProblem.java54
-rw-r--r--test/compiler/loopopts/UseCountedLoopSafepoints.java67
-rw-r--r--test/compiler/loopopts/superword/TestVectorizationWithInvariant.java144
-rw-r--r--test/compiler/regalloc/C1ObjectSpillInLogicOp.java3
-rw-r--r--test/compiler/rtm/locking/TestRTMAbortRatio.java9
-rw-r--r--test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java9
-rw-r--r--test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java10
-rw-r--r--test/compiler/rtm/locking/TestRTMLockingThreshold.java10
-rw-r--r--test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java10
-rw-r--r--test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java5
-rw-r--r--test/compiler/stable/TestStableBoolean.java28
-rw-r--r--test/compiler/stable/TestStableByte.java28
-rw-r--r--test/compiler/stable/TestStableChar.java28
-rw-r--r--test/compiler/stable/TestStableDouble.java28
-rw-r--r--test/compiler/stable/TestStableFloat.java28
-rw-r--r--test/compiler/stable/TestStableInt.java28
-rw-r--r--test/compiler/stable/TestStableLong.java28
-rw-r--r--test/compiler/stable/TestStableObject.java28
-rw-r--r--test/compiler/stable/TestStableShort.java28
-rw-r--r--test/compiler/stringopts/TestOptimizeStringConcat.java89
-rw-r--r--test/compiler/testlibrary/rtm/AbortProvoker.java81
-rw-r--r--test/compiler/testlibrary/rtm/BusyLock.java8
-rw-r--r--test/compiler/testlibrary/rtm/MemoryConflictProvoker.java10
-rw-r--r--test/compiler/testlibrary/rtm/RTMTestBase.java4
-rw-r--r--test/compiler/types/TestMeetExactConstantArrays.java70
-rw-r--r--test/compiler/types/TestTypePropagationToCmpU.java59
-rw-r--r--test/compiler/uncommontrap/UncommonTrapStackBang.java6
-rw-r--r--test/compiler/unsafe/TestUnsafeLoadControl.java103
37 files changed, 1429 insertions, 244 deletions
diff --git a/test/compiler/codegen/IntRotateWithImmediate.java b/test/compiler/codegen/IntRotateWithImmediate.java
new file mode 100644
index 000000000..1d617a415
--- /dev/null
+++ b/test/compiler/codegen/IntRotateWithImmediate.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2015 SAP AG. 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
+ * @bug 8080190
+ * @key regression
+ * @summary Test that the rotate distance used in the rotate instruction is properly masked with 0x1f
+ * @run main/othervm -Xbatch -XX:-UseOnStackReplacement IntRotateWithImmediate
+ * @author volker.simonis@gmail.com
+ */
+
+public class IntRotateWithImmediate {
+
+ // This is currently the same as Integer.rotateRight()
+ static int rotateRight(int i, int distance) {
+ // On some architectures (i.e. x86_64 and ppc64) the following computation is
+ // matched in the .ad file into a single MachNode which emmits a single rotate
+ // machine instruction. It is important that the shift amount is masked to match
+ // corresponding immediate width in the native instruction. On x86_64 the rotate
+ // left instruction ('rol') encodes an 8-bit immediate while the corresponding
+ // 'rotlwi' instruction on Power only encodes a 5-bit immediate.
+ return ((i >>> distance) | (i << -distance));
+ }
+
+ static int compute(int x) {
+ return rotateRight(x, 3);
+ }
+
+ public static void main(String args[]) {
+ int val = 4096;
+
+ int firstResult = compute(val);
+
+ for (int i = 0; i < 100000; i++) {
+ int newResult = compute(val);
+ if (firstResult != newResult) {
+ throw new InternalError(firstResult + " != " + newResult);
+ }
+ }
+ System.out.println("OK");
+ }
+
+}
diff --git a/test/compiler/codegen/LoadWithMask.java b/test/compiler/codegen/LoadWithMask.java
index 13ec4e58f..06c4c14a4 100644
--- a/test/compiler/codegen/LoadWithMask.java
+++ b/test/compiler/codegen/LoadWithMask.java
@@ -25,7 +25,7 @@
* @test
* @bug 8032207
* @summary Invalid node sizing for loadUS2L_immI16 and loadI2L_immI
- * @run main/othervm -server -Xbatch -XX:-TieredCompilation -XX:CompileCommand=compileonly,LoadWithMask.foo LoadWithMask
+ * @run main/othervm -Xbatch -XX:CompileCommand=compileonly,LoadWithMask.foo LoadWithMask
*
*/
public class LoadWithMask {
diff --git a/test/compiler/codegen/LoadWithMask2.java b/test/compiler/codegen/LoadWithMask2.java
index c1ae52881..82c942d7a 100644
--- a/test/compiler/codegen/LoadWithMask2.java
+++ b/test/compiler/codegen/LoadWithMask2.java
@@ -25,7 +25,7 @@
* @test
* @bug 8031743
* @summary loadI2L_immI broken for negative memory values
- * @run main/othervm -server -Xbatch -XX:-TieredCompilation -XX:CompileCommand=compileonly,*.foo* LoadWithMask2
+ * @run main/othervm -Xbatch -XX:CompileCommand=compileonly,*.foo* LoadWithMask2
*
*/
public class LoadWithMask2 {
diff --git a/test/compiler/escapeAnalysis/TestEABadMergeMem.java b/test/compiler/escapeAnalysis/TestEABadMergeMem.java
new file mode 100644
index 000000000..236cbe742
--- /dev/null
+++ b/test/compiler/escapeAnalysis/TestEABadMergeMem.java
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8134031
+ * @summary Bad rewiring of memory edges when we split unique types during EA
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestEABadMergeMem::m_notinlined TestEABadMergeMem
+ *
+ */
+
+public class TestEABadMergeMem {
+
+ static class Box {
+ int i;
+ }
+
+ static void m_notinlined() {
+ }
+
+ static float dummy1;
+ static float dummy2;
+
+ static int test(Box a, Box c, int i, int j, int k, boolean flag1, boolean flag2) {
+ Box b = new Box(); // non escaping
+ a.i = i;
+ b.i = j;
+ c.i = k;
+
+ m_notinlined();
+
+ boolean flag3 = false;
+ if (flag1) {
+ for (int ii = 0; ii < 100; ii++) {
+ if (flag2) {
+ dummy1 = (float)ii;
+ } else {
+ dummy2 = (float)ii;
+ }
+ }
+ flag3 = true;
+ }
+ // Memory Phi here with projection of not inlined call as one edge, MergeMem as other
+
+ if (flag3) { // will split through Phi during loopopts
+ int res = c.i + b.i;
+ m_notinlined(); // prevents split through phi during igvn
+ return res;
+ } else {
+ return 44 + 43;
+ }
+ }
+
+ static public void main(String[] args) {
+ for (int i = 0; i < 20000; i++) {
+ // m(2);
+ Box a = new Box();
+ Box c = new Box();
+ int res = test(a, c, 42, 43, 44, (i%2) == 0, (i%3) == 0);
+ if (res != 44 + 43) {
+ throw new RuntimeException("Bad result " + res);
+ }
+ }
+ }
+
+}
diff --git a/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java b/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java
new file mode 100644
index 000000000..7eac5e006
--- /dev/null
+++ b/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 8073956
+ * @summary Tests C2 EA with allocated object escaping through a call.
+ * @run main/othervm -XX:CompileCommand=dontinline,TestEscapeThroughInvoke::create TestEscapeThroughInvoke
+ */
+public class TestEscapeThroughInvoke {
+ private A a;
+
+ public static void main(String[] args) {
+ TestEscapeThroughInvoke test = new TestEscapeThroughInvoke();
+ test.a = new A(42);
+ // Make sure run gets compiled by C2
+ for (int i = 0; i < 100_000; ++i) {
+ test.run();
+ }
+ }
+
+ private void run() {
+ // Allocate something to trigger EA
+ new Object();
+ // Create a new escaping instance of A and
+ // verify that it is always equal to 'a.saved'.
+ A escapingA = create(42);
+ a.check(escapingA);
+ }
+
+ // Create and return a new instance of A that escaped through 'A::saveInto'.
+ // The 'dummy' parameters are needed to avoid EA skipping the methods.
+ private A create(Integer dummy) {
+ A result = new A(dummy);
+ result.saveInto(a, dummy); // result escapes into 'a' here
+ return result;
+ }
+}
+
+class A {
+ private A saved;
+
+ public A(Integer dummy) { }
+
+ public void saveInto(A other, Integer dummy) {
+ other.saved = this;
+ }
+
+ public void check(A other) {
+ if (this.saved != other) {
+ throw new RuntimeException("TEST FAILED: Objects not equal.");
+ }
+ }
+}
diff --git a/test/compiler/inlining/DefaultMethodsDependencies.java b/test/compiler/inlining/DefaultMethodsDependencies.java
new file mode 100644
index 000000000..5bdc60fda
--- /dev/null
+++ b/test/compiler/inlining/DefaultMethodsDependencies.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8069263
+ * @summary Deoptimization between array allocation and arraycopy may result in non initialized array
+ * @run main/othervm -XX:-BackgroundCompilation -XX:CompileOnly=DefaultMethodsDependencies::test -XX:CompileOnly=DefaultMethodsDependencies$I2::m1 DefaultMethodsDependencies
+ *
+ */
+
+public class DefaultMethodsDependencies {
+
+ interface I1 {
+ void m1();
+ // triggers processing of default methods in C1
+ default void m2() {
+ }
+ }
+
+ interface I2 extends I1 {
+ // added to C2 as default method
+ default void m1() {
+ }
+ }
+
+ static abstract class C1 implements I1 {
+ }
+
+ static class C2 extends C1 implements I2 {
+ }
+
+ static void test(C1 obj) {
+ obj.m1();
+ }
+
+ static public void main(String[] args) {
+ C2 obj = new C2();
+ for (int i = 0; i < 20000; i++) {
+ test(obj);
+ }
+ }
+}
diff --git a/test/compiler/jsr292/MHInlineTest.java b/test/compiler/jsr292/MHInlineTest.java
new file mode 100644
index 000000000..0587ab6ad
--- /dev/null
+++ b/test/compiler/jsr292/MHInlineTest.java
@@ -0,0 +1,207 @@
+/*
+ * 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.
+ *
+ */
+/**
+ * @test
+ * @bug 8062280
+ * @summary C2: inlining failure due to access checks being too strict
+ * @library /testlibrary
+ * @run main/othervm MHInlineTest
+ */
+import java.lang.invoke.*;
+import com.oracle.java.testlibrary.*;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class MHInlineTest {
+ public static void main(String[] args) throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+ "-XX:+IgnoreUnrecognizedVMOptions", "-showversion",
+ "-server", "-XX:-TieredCompilation", "-Xbatch",
+ "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
+ "-XX:CompileCommand=dontinline,MHInlineTest::test*",
+ "MHInlineTest$Launcher");
+
+ OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
+
+ analyzer.shouldHaveExitValue(0);
+
+ // The test is applicable only to C2 (present in Server VM).
+ if (analyzer.getStderr().contains("Server VM")) {
+ analyzer.shouldContain("MHInlineTest$B::public_x (3 bytes) inline (hot)");
+ analyzer.shouldContain( "MHInlineTest$B::protected_x (3 bytes) inline (hot)");
+ analyzer.shouldContain( "MHInlineTest$B::package_x (3 bytes) inline (hot)");
+ analyzer.shouldContain("MHInlineTest$A::package_final_x (3 bytes) inline (hot)");
+ analyzer.shouldContain("MHInlineTest$B::private_x (3 bytes) inline (hot)");
+ analyzer.shouldContain("MHInlineTest$B::private_static_x (3 bytes) inline (hot)");
+ analyzer.shouldContain("MHInlineTest$A::package_static_x (3 bytes) inline (hot)");
+
+ analyzer.shouldNotContain("MHInlineTest$A::protected_x (3 bytes) virtual call");
+ analyzer.shouldNotContain("MHInlineTest$A::package_x (3 bytes) virtual call");
+ }
+ }
+
+ static class A {
+ public static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
+
+ public Class<?> public_x() { return A.class; }
+ protected Class<?> protected_x() { return A.class; }
+ Class<?> package_x() { return A.class; }
+ final Class<?> package_final_x() { return A.class; }
+
+ static Class<?> package_static_x() { return A.class; }
+ }
+
+ static class B extends A {
+ public static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
+
+ @Override public Class<?> public_x() { return B.class; }
+ @Override protected Class<?> protected_x() { return B.class; }
+ @Override Class<?> package_x() { return B.class; }
+
+ private Class<?> private_x() { return B.class; }
+ static Class<?> private_static_x() { return B.class; }
+ }
+
+ static final MethodHandle A_PUBLIC_X;
+ static final MethodHandle A_PROTECTED_X;
+ static final MethodHandle A_PACKAGE_X;
+ static final MethodHandle A_PACKAGE_STATIC_X;
+ static final MethodHandle A_PACKAGE_FINAL_X;
+
+ static final MethodHandle B_PRIVATE_X;
+ static final MethodHandle B_PRIVATE_STATIC_X;
+
+ static {
+ try {
+ MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
+
+ A_PUBLIC_X = LOOKUP.findVirtual(
+ A.class, "public_x", MethodType.methodType(Class.class));
+ A_PROTECTED_X = LOOKUP.findVirtual(
+ A.class, "protected_x", MethodType.methodType(Class.class));
+ A_PACKAGE_X = LOOKUP.findVirtual(
+ A.class, "package_x", MethodType.methodType(Class.class));
+ A_PACKAGE_FINAL_X = LOOKUP.findVirtual(
+ A.class, "package_final_x", MethodType.methodType(Class.class));
+ A_PACKAGE_STATIC_X = LOOKUP.findStatic(
+ A.class, "package_static_x", MethodType.methodType(Class.class));
+
+ B_PRIVATE_X = B.LOOKUP.findVirtual(
+ B.class, "private_x", MethodType.methodType(Class.class));
+ B_PRIVATE_STATIC_X = B.LOOKUP.findStatic(
+ B.class, "private_static_x", MethodType.methodType(Class.class));
+ } catch (Exception e) {
+ throw new Error(e);
+ }
+ }
+
+ static final A a = new B();
+
+ private static void testPublicMH() {
+ try {
+ Class<?> r = (Class<?>)A_PUBLIC_X.invokeExact(a);
+ assertEquals(r, B.class);
+ } catch (Throwable throwable) {
+ throw new Error(throwable);
+ }
+ }
+
+ private static void testProtectedMH() {
+ try {
+ Class<?> r = (Class<?>)A_PROTECTED_X.invokeExact(a);
+ assertEquals(r, B.class);
+ } catch (Throwable throwable) {
+ throw new Error(throwable);
+ }
+ }
+
+ private static void testPackageMH() {
+ try {
+ Class<?> r = (Class<?>)A_PACKAGE_X.invokeExact(a);
+ assertEquals(r, B.class);
+ } catch (Throwable throwable) {
+ throw new Error(throwable);
+ }
+ }
+
+ private static void testPackageFinalMH() {
+ try {
+ Class<?> r = (Class<?>)A_PACKAGE_FINAL_X.invokeExact(a);
+ assertEquals(r, A.class);
+ } catch (Throwable throwable) {
+ throw new Error(throwable);
+ }
+ }
+
+ private static void testPackageStaticMH() {
+ try {
+ Class<?> r = (Class<?>)A_PACKAGE_STATIC_X.invokeExact();
+ assertEquals(r, A.class);
+ } catch (Throwable throwable) {
+ throw new Error(throwable);
+ }
+ }
+
+ private static void testPrivateMH() {
+ try {
+ Class<?> r = (Class<?>)B_PRIVATE_X.invokeExact((B)a);
+ assertEquals(r, B.class);
+ } catch (Throwable throwable) {
+ throw new Error(throwable);
+ }
+ }
+
+ private static void testPrivateStaticMH() {
+ try {
+ Class<?> r = (Class<?>)B_PRIVATE_STATIC_X.invokeExact();
+ assertEquals(r, B.class);
+ } catch (Throwable throwable) {
+ throw new Error(throwable);
+ }
+ }
+ static class Launcher {
+ public static void main(String[] args) throws Exception {
+ for (int i = 0; i < 20_000; i++) {
+ testPublicMH();
+ }
+ for (int i = 0; i < 20_000; i++) {
+ testProtectedMH();
+ }
+ for (int i = 0; i < 20_000; i++) {
+ testPackageMH();
+ }
+ for (int i = 0; i < 20_000; i++) {
+ testPackageFinalMH();
+ }
+ for (int i = 0; i < 20_000; i++) {
+ testPackageStaticMH();
+ }
+ for (int i = 0; i < 20_000; i++) {
+ testPrivateMH();
+ }
+ for (int i = 0; i < 20_000; i++) {
+ testPrivateStaticMH();
+ }
+ }
+ }
+}
diff --git a/test/compiler/jsr292/PollutedTrapCounts.java b/test/compiler/jsr292/PollutedTrapCounts.java
new file mode 100644
index 000000000..36d531117
--- /dev/null
+++ b/test/compiler/jsr292/PollutedTrapCounts.java
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 8074551
+ * @library /testlibrary
+ * @run main PollutedTrapCounts
+ */
+import java.lang.invoke.*;
+import com.oracle.java.testlibrary.*;
+
+public class PollutedTrapCounts {
+ public static void main(String[] args) throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+ "-XX:+IgnoreUnrecognizedVMOptions",
+ "-XX:-TieredCompilation", "-Xbatch",
+ "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
+ "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
+ "PollutedTrapCounts$Test");
+
+ OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
+
+ analyzer.shouldHaveExitValue(0);
+
+ analyzer.shouldNotContain("not compilable (disabled)");
+ }
+
+ static class Test {
+ public static final MethodHandle test1;
+ public static final MethodHandle test2;
+ public static final MethodHandle empty;
+
+ static {
+ try {
+ Class<?> THIS_CLASS = Test.class;
+ MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
+ test1 = LOOKUP.findStatic(THIS_CLASS, "test1", MethodType.methodType(boolean.class, boolean.class));
+ test2 = LOOKUP.findStatic(THIS_CLASS, "test2", MethodType.methodType(boolean.class, boolean.class));
+ empty = LOOKUP.findStatic(THIS_CLASS, "empty", MethodType.methodType(void.class, boolean.class));
+ } catch(Throwable e) {
+ throw new Error(e);
+ }
+ }
+
+ static boolean test1(boolean b) {
+ return b;
+ }
+ static boolean test2(boolean b) {
+ return true;
+ }
+ static void empty(boolean b) {}
+
+ static void test(boolean freqValue, boolean removeInlineBlocker) throws Throwable {
+ MethodHandle innerGWT = MethodHandles.guardWithTest(test1, empty, empty);
+ MethodHandle outerGWT = MethodHandles.guardWithTest(test2, innerGWT, innerGWT);
+
+ // Trigger compilation
+ for (int i = 0; i < 20_000; i++) {
+ outerGWT.invokeExact(freqValue);
+ }
+
+ // Trigger deopt & nmethod invalidation
+ outerGWT.invokeExact(!freqValue);
+
+ // Force inline blocker removal on rare-taken path
+ if (removeInlineBlocker) {
+ for (int i = 0; i < 100; i++) {
+ outerGWT.invokeExact(!freqValue);
+ }
+ }
+
+ // Trigger recompilation
+ for (int i = 0; i < 20_000; i++) {
+ outerGWT.invokeExact(freqValue);
+ }
+ }
+
+ public static void main(String[] args) throws Throwable {
+ boolean freqValue = true;
+ boolean removeInlineBlocker = false;
+ for (int i = 0; i < 20; i++) {
+ test(freqValue, removeInlineBlocker);
+ freqValue = !freqValue;
+ removeInlineBlocker = !removeInlineBlocker;
+ }
+ }
+ }
+}
diff --git a/test/compiler/loopopts/ConstFPVectorization.java b/test/compiler/loopopts/ConstFPVectorization.java
new file mode 100644
index 000000000..50cb0e614
--- /dev/null
+++ b/test/compiler/loopopts/ConstFPVectorization.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8074869
+ * @summary C2 code generator can replace -0.0f with +0.0f on Linux
+ * @run main ConstFPVectorization 8
+ * @author volker.simonis@gmail.com
+ *
+ */
+
+public class ConstFPVectorization {
+
+ static float[] f = new float[16];
+ static double[] d = new double[16];
+
+ static void floatLoop(int count) {
+ for (int i = 0; i < count; i++) {
+ f[i] = -0.0f;
+ }
+ }
+
+ static void doubleLoop(int count) {
+ for (int i = 0; i < count; i++) {
+ d[i] = -0.0d;
+ }
+ }
+
+ public static void main(String args[]) {
+ for (int i = 0; i < 10_000; i++) {
+ floatLoop(Integer.parseInt(args[0]));
+ doubleLoop(Integer.parseInt(args[0]));
+ }
+ for (int i = 0; i < Integer.parseInt(args[0]); i++) {
+ if (Float.floatToRawIntBits(f[i]) != Float.floatToRawIntBits(-0.0f))
+ throw new Error("Float error at index " + i);
+ if (Double.doubleToRawLongBits(d[i]) != Double.doubleToRawLongBits(-0.0d))
+ throw new Error("Double error at index " + i);
+ }
+ }
+}
diff --git a/test/compiler/loopopts/CountedLoopProblem.java b/test/compiler/loopopts/CountedLoopProblem.java
new file mode 100644
index 000000000..da206cb86
--- /dev/null
+++ b/test/compiler/loopopts/CountedLoopProblem.java
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8072753
+ * @summary Inner loop induction variable increment occurs before compare which causes integer overflow
+ * @run main/othervm CountedLoopProblem
+ *
+ */
+
+import java.util.*;
+
+public class CountedLoopProblem {
+ public static void main(String[] args) throws Exception {
+ Random r = new Random(42);
+ int x = 0;
+ StringBuilder sb = new StringBuilder();
+ for(int i = 0; i < 1000000; ++i) {
+ int v = Math.abs(r.nextInt());
+ sb.append('+').append(v).append('\n');
+ x += v;
+ // To trigger the problem we must OSR in the following loop
+ // To make the problem 100% reproducible run with -XX:-TieredCompilation -XX:OSROnlyBCI=62
+ while(x < 0) x += 1000000000;
+ sb.append('=').append(x).append('\n');
+ }
+ if (sb.toString().hashCode() != 0xaba94591) {
+ throw new Exception("Unexpected result");
+ }
+ }
+}
+
diff --git a/test/compiler/loopopts/UseCountedLoopSafepoints.java b/test/compiler/loopopts/UseCountedLoopSafepoints.java
new file mode 100644
index 000000000..66d81a4c1
--- /dev/null
+++ b/test/compiler/loopopts/UseCountedLoopSafepoints.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ *
+ */
+
+/**
+ * @test
+ * @bug 6869327
+ * @summary Test that C2 flag UseCountedLoopSafepoints ensures a safepoint is kept in a CountedLoop
+ * @library /testlibrary
+ * @run main UseCountedLoopSafepoints
+ */
+
+import java.util.concurrent.atomic.AtomicLong;
+import com.oracle.java.testlibrary.ProcessTools;
+import com.oracle.java.testlibrary.OutputAnalyzer;
+
+public class UseCountedLoopSafepoints {
+ private static final AtomicLong _num = new AtomicLong(0);
+
+ // Uses the fact that an EnableBiasedLocking vmop will be started
+ // after 500ms, while we are still in the loop. If there is a
+ // safepoint in the counted loop, then we will reach safepoint
+ // very quickly. Otherwise SafepointTimeout will be hit.
+ public static void main (String args[]) throws Exception {
+ if (args.length == 1) {
+ final int loops = Integer.parseInt(args[0]);
+ for (int i = 0; i < loops; i++) {
+ _num.addAndGet(1);
+ }
+ } else {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+ "-XX:+IgnoreUnrecognizedVMOptions",
+ "-XX:-TieredCompilation",
+ "-XX:+UseBiasedLocking",
+ "-XX:BiasedLockingStartupDelay=500",
+ "-XX:+SafepointTimeout",
+ "-XX:SafepointTimeoutDelay=2000",
+ "-XX:+UseCountedLoopSafepoints",
+ "UseCountedLoopSafepoints",
+ "2000000000"
+ );
+ OutputAnalyzer output = new OutputAnalyzer(pb.start());
+ output.shouldNotContain("Timeout detected");
+ output.shouldHaveExitValue(0);
+ }
+ }
+}
diff --git a/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java b/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java
new file mode 100644
index 000000000..e36664aa2
--- /dev/null
+++ b/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java
@@ -0,0 +1,144 @@
+/*
+ * 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.
+ *
+ */
+
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+
+/**
+ * @test
+ * @bug 8078497
+ * @summary Tests correct alignment of vectors with loop invariant offset.
+ * @library /testlibrary
+ * @run main TestVectorizationWithInvariant
+ */
+public class TestVectorizationWithInvariant {
+
+ private static Unsafe unsafe;
+ private static final long BYTE_ARRAY_OFFSET;
+ private static final long CHAR_ARRAY_OFFSET;
+
+ static {
+ unsafe = Utils.getUnsafe();
+ BYTE_ARRAY_OFFSET = unsafe.arrayBaseOffset(byte[].class);
+ CHAR_ARRAY_OFFSET = unsafe.arrayBaseOffset(char[].class);
+ }
+
+ public static void main(String[] args) throws Exception {
+ byte[] byte_array1 = new byte[1000];
+ byte[] byte_array2 = new byte[1000];
+ char[] char_array = new char[1000];
+
+ for (int i = 0; i < 20_000; ++i) {
+ copyByteToChar(byte_array1, byte_array2, char_array, 1);
+ copyCharToByte(char_array, byte_array1, 1);
+ copyCharToByteAligned(char_array, byte_array1);
+ copyCharToByteUnaligned(char_array, byte_array1);
+ }
+ }
+
+ /*
+ * Copy multiple consecutive chars from a byte array to a given offset in a char array
+ * to trigger C2's superword optimization. The offset in the byte array is independent
+ * of the loop induction variable and can be set to an arbitrary value. It may then not
+ * be possible to both align the LoadUS and the StoreC operations. Therefore, vectorization
+ * should only be done in this case if unaligned memory accesses are allowed.
+ */
+ public static void copyByteToChar(byte[] src1, byte[] src2, char[] dst, int off) {
+ off = (int) BYTE_ARRAY_OFFSET + (off << 1);
+ byte[] src = src1;
+ for (int i = (int) CHAR_ARRAY_OFFSET; i < 100; i = i + 8) {
+ // Copy 8 chars from src to dst
+ unsafe.putChar(dst, i + 0, unsafe.getChar(src, off + 0));
+ unsafe.putChar(dst, i + 2, unsafe.getChar(src, off + 2));
+ unsafe.putChar(dst, i + 4, unsafe.getChar(src, off + 4));
+ unsafe.putChar(dst, i + 6, unsafe.getChar(src, off + 6));
+ unsafe.putChar(dst, i + 8, unsafe.getChar(src, off + 8));
+ unsafe.putChar(dst, i + 10, unsafe.getChar(src, off + 10));
+ unsafe.putChar(dst, i + 12, unsafe.getChar(src, off + 12));
+ unsafe.putChar(dst, i + 14, unsafe.getChar(src, off + 14));
+
+ // Prevent loop invariant code motion of char read.
+ src = (src == src1) ? src2 : src1;
+ }
+ }
+
+ /*
+ * Copy multiple consecutive chars from a char array to a given offset in a byte array
+ * to trigger C2's superword optimization. Checks for similar problems as 'copyByteToChar'.
+ */
+ public static void copyCharToByte(char[] src, byte[] dst, int off) {
+ off = (int) BYTE_ARRAY_OFFSET + (off << 1);
+ for (int i = 0; i < 100; i = i + 8) {
+ // Copy 8 chars from src to dst
+ unsafe.putChar(dst, off + 0, src[i + 0]);
+ unsafe.putChar(dst, off + 2, src[i + 1]);
+ unsafe.putChar(dst, off + 4, src[i + 2]);
+ unsafe.putChar(dst, off + 6, src[i + 3]);
+ unsafe.putChar(dst, off + 8, src[i + 4]);
+ unsafe.putChar(dst, off + 10, src[i + 5]);
+ unsafe.putChar(dst, off + 12, src[i + 6]);
+ unsafe.putChar(dst, off + 14, src[i + 7]);
+ }
+ }
+
+ /*
+ * Variant of copyCharToByte with a constant destination array offset.
+ * The loop should always be vectorized because both the LoadUS and StoreC
+ * operations can be aligned.
+ */
+ public static void copyCharToByteAligned(char[] src, byte[] dst) {
+ final int off = (int) BYTE_ARRAY_OFFSET;
+ for (int i = 8; i < 100; i = i + 8) {
+ // Copy 8 chars from src to dst
+ unsafe.putChar(dst, off + 0, src[i + 0]);
+ unsafe.putChar(dst, off + 2, src[i + 1]);
+ unsafe.putChar(dst, off + 4, src[i + 2]);
+ unsafe.putChar(dst, off + 6, src[i + 3]);
+ unsafe.putChar(dst, off + 8, src[i + 4]);
+ unsafe.putChar(dst, off + 10, src[i + 5]);
+ unsafe.putChar(dst, off + 12, src[i + 6]);
+ unsafe.putChar(dst, off + 14, src[i + 7]);
+ }
+ }
+
+ /*
+ * Variant of copyCharToByte with a constant destination array offset. The
+ * loop should only be vectorized if unaligned memory operations are allowed
+ * because not both the LoadUS and the StoreC can be aligned.
+ */
+ public static void copyCharToByteUnaligned(char[] src, byte[] dst) {
+ final int off = (int) BYTE_ARRAY_OFFSET + 2;
+ for (int i = 0; i < 100; i = i + 8) {
+ // Copy 8 chars from src to dst
+ unsafe.putChar(dst, off + 0, src[i + 0]);
+ unsafe.putChar(dst, off + 2, src[i + 1]);
+ unsafe.putChar(dst, off + 4, src[i + 2]);
+ unsafe.putChar(dst, off + 6, src[i + 3]);
+ unsafe.putChar(dst, off + 8, src[i + 4]);
+ unsafe.putChar(dst, off + 10, src[i + 5]);
+ unsafe.putChar(dst, off + 12, src[i + 6]);
+ unsafe.putChar(dst, off + 14, src[i + 7]);
+ }
+ }
+}
diff --git a/test/compiler/regalloc/C1ObjectSpillInLogicOp.java b/test/compiler/regalloc/C1ObjectSpillInLogicOp.java
index 17571820b..f8fc18796 100644
--- a/test/compiler/regalloc/C1ObjectSpillInLogicOp.java
+++ b/test/compiler/regalloc/C1ObjectSpillInLogicOp.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
@@ -24,6 +24,7 @@
/*
* @test
* @bug 8027751
+ * @requires vm.gc=="G1" | vm.gc=="null"
* @summary C1 crashes generating G1 post-barrier in Unsafe.getAndSetObject() intrinsic because of the new value spill
* @run main/othervm -XX:+UseG1GC C1ObjectSpillInLogicOp
*
diff --git a/test/compiler/rtm/locking/TestRTMAbortRatio.java b/test/compiler/rtm/locking/TestRTMAbortRatio.java
index 2c179d8ee..865255e39 100644
--- a/test/compiler/rtm/locking/TestRTMAbortRatio.java
+++ b/test/compiler/rtm/locking/TestRTMAbortRatio.java
@@ -126,10 +126,7 @@ public class TestRTMAbortRatio extends CommandLineOptionTest {
@Override
public String[] getMethodsToCompileNames() {
- return new String[] {
- getMethodWithLockName(),
- Unsafe.class.getName() + "::addressSize"
- };
+ return new String[] { getMethodWithLockName() };
}
public void lock(boolean abort) {
@@ -147,10 +144,12 @@ public class TestRTMAbortRatio extends CommandLineOptionTest {
public static void main(String args[]) throws Throwable {
Asserts.assertGTE(args.length, 1, "One argument required.");
Test t = new Test();
- if (Boolean.valueOf(args[0])) {
+ boolean shouldBeInflated = Boolean.valueOf(args[0]);
+ if (shouldBeInflated) {
AbortProvoker.inflateMonitor(t.monitor);
}
for (int i = 0; i < Test.TOTAL_ITERATIONS; i++) {
+ AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated);
t.lock(i >= Test.WARMUP_ITERATIONS);
}
}
diff --git a/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java b/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java
index 2cf81f7f6..8bde16056 100644
--- a/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java
+++ b/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java
@@ -156,10 +156,7 @@ public class TestRTMAfterNonRTMDeopt extends CommandLineOptionTest {
@Override
public String[] getMethodsToCompileNames() {
- return new String[] {
- getMethodWithLockName(),
- sun.misc.Unsafe.class.getName() + "::forceAbort"
- };
+ return new String[] { getMethodWithLockName() };
}
public void forceAbort(int a[], boolean abort) {
@@ -182,13 +179,15 @@ public class TestRTMAfterNonRTMDeopt extends CommandLineOptionTest {
public static void main(String args[]) throws Throwable {
Test t = new Test();
- if (Boolean.valueOf(args[0])) {
+ boolean shouldBeInflated = Boolean.valueOf(args[0]);
+ if (shouldBeInflated) {
AbortProvoker.inflateMonitor(t.monitor);
}
int tmp[] = new int[1];
for (int i = 0; i < Test.ITERATIONS; i++ ) {
+ AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated);
if (i == Test.RANGE_CHECK_AT) {
t.forceAbort(new int[0], false);
} else {
diff --git a/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java b/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java
index bcadaab6c..e18adb242 100644
--- a/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java
+++ b/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java
@@ -129,10 +129,7 @@ public class TestRTMDeoptOnLowAbortRatio extends CommandLineOptionTest {
@Override
public String[] getMethodsToCompileNames() {
- return new String[] {
- getMethodWithLockName(),
- sun.misc.Unsafe.class.getName() + "::addressSize"
- };
+ return new String[] { getMethodWithLockName() };
}
public void forceAbort(boolean abort) {
@@ -150,11 +147,12 @@ public class TestRTMDeoptOnLowAbortRatio extends CommandLineOptionTest {
public static void main(String args[]) throws Throwable {
Asserts.assertGTE(args.length, 1, "One argument required.");
Test t = new Test();
-
- if (Boolean.valueOf(args[0])) {
+ boolean shouldBeInflated = Boolean.valueOf(args[0]);
+ if (shouldBeInflated) {
AbortProvoker.inflateMonitor(t.monitor);
}
for (int i = 0; i < AbortProvoker.DEFAULT_ITERATIONS; i++) {
+ AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated);
t.forceAbort(
i == TestRTMDeoptOnLowAbortRatio.LOCKING_THRESHOLD);
}
diff --git a/test/compiler/rtm/locking/TestRTMLockingThreshold.java b/test/compiler/rtm/locking/TestRTMLockingThreshold.java
index 548a09c6e..e1414f9fd 100644
--- a/test/compiler/rtm/locking/TestRTMLockingThreshold.java
+++ b/test/compiler/rtm/locking/TestRTMLockingThreshold.java
@@ -142,10 +142,7 @@ public class TestRTMLockingThreshold extends CommandLineOptionTest {
@Override
public String[] getMethodsToCompileNames() {
- return new String[] {
- getMethodWithLockName(),
- sun.misc.Unsafe.class.getName() + "::addressSize"
- };
+ return new String[] { getMethodWithLockName() };
}
public void lock(boolean abort) {
@@ -163,11 +160,12 @@ public class TestRTMLockingThreshold extends CommandLineOptionTest {
public static void main(String args[]) throws Throwable {
Asserts.assertGTE(args.length, 1, "One argument required.");
Test t = new Test();
-
- if (Boolean.valueOf(args[0])) {
+ boolean shouldBeInflated = Boolean.valueOf(args[0]);
+ if (shouldBeInflated) {
AbortProvoker.inflateMonitor(t.monitor);
}
for (int i = 0; i < Test.TOTAL_ITERATIONS; i++) {
+ AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated);
t.lock(i % 2 == 1);
}
}
diff --git a/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java b/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java
index e1f94d31d..5f1c64cad 100644
--- a/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java
+++ b/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java
@@ -116,9 +116,7 @@ public class TestRTMTotalCountIncrRate extends CommandLineOptionTest {
@Override
public String[] getMethodsToCompileNames() {
- return new String[] {
- getMethodWithLockName()
- };
+ return new String[] { getMethodWithLockName() };
}
public void lock() {
@@ -134,11 +132,13 @@ public class TestRTMTotalCountIncrRate extends CommandLineOptionTest {
public static void main(String args[]) throws Throwable {
Asserts.assertGTE(args.length, 1, "One argument required.");
Test test = new Test();
-
- if (Boolean.valueOf(args[0])) {
+ boolean shouldBeInflated = Boolean.valueOf(args[0]);
+ if (shouldBeInflated) {
AbortProvoker.inflateMonitor(test.monitor);
}
for (long i = 0L; i < Test.TOTAL_ITERATIONS; i++) {
+ AbortProvoker.verifyMonitorState(test.monitor,
+ shouldBeInflated);
test.lock();
}
}
diff --git a/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java b/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java
index f1fa1393f..026af2ded 100644
--- a/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java
+++ b/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java
@@ -51,7 +51,7 @@ import rtm.predicate.SupportedVM;
* Compiled method invoked {@code AbortProvoker.DEFAULT_ITERATIONS} times before
* lock inflation and the same amount of times after inflation.
* As a result total locks count should be equal to
- * {@code 2*AbortProvoker.DEFAULT_ITERATIONS}.
+ * {@code 2 * AbortProvoker.DEFAULT_ITERATIONS}.
* It is a pretty strict assertion which could fail if some retriable abort
* happened: it could be {@code AbortType.RETRIABLE} or
* {@code AbortType.MEM_CONFLICT}, but unfortunately abort can has both these
@@ -100,7 +100,6 @@ public class TestUseRTMAfterLockInflation extends CommandLineOptionTest {
}
public static class Test {
-
/**
* Usage:
* Test &lt;provoker type&gt;
@@ -112,10 +111,12 @@ public class TestUseRTMAfterLockInflation extends CommandLineOptionTest {
AbortProvoker provoker
= AbortType.lookup(Integer.valueOf(args[0])).provoker();
for (int i = 0; i < AbortProvoker.DEFAULT_ITERATIONS; i++) {
+ AbortProvoker.verifyMonitorState(provoker, false /*deflated*/);
provoker.forceAbort();
}
provoker.inflateMonitor();
for (int i = 0; i < AbortProvoker.DEFAULT_ITERATIONS; i++) {
+ AbortProvoker.verifyMonitorState(provoker, true /*inflated*/);
provoker.forceAbort();
}
}
diff --git a/test/compiler/stable/TestStableBoolean.java b/test/compiler/stable/TestStableBoolean.java
index 37641d1b1..dfcf1edff 100644
--- a/test/compiler/stable/TestStableBoolean.java
+++ b/test/compiler/stable/TestStableBoolean.java
@@ -53,44 +53,32 @@
* java/lang/invoke/TestStableBoolean$DefaultStaticValue
* java/lang/invoke/TestStableBoolean$ObjectArrayLowerDim2
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:+FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableBoolean
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:-FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableBoolean
*/
package java.lang.invoke;
diff --git a/test/compiler/stable/TestStableByte.java b/test/compiler/stable/TestStableByte.java
index c62bc3508..3b2f5969b 100644
--- a/test/compiler/stable/TestStableByte.java
+++ b/test/compiler/stable/TestStableByte.java
@@ -53,44 +53,32 @@
* java/lang/invoke/TestStableByte$DefaultStaticValue
* java/lang/invoke/TestStableByte$ObjectArrayLowerDim2
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:+FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableByte
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:-FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableByte
*/
package java.lang.invoke;
diff --git a/test/compiler/stable/TestStableChar.java b/test/compiler/stable/TestStableChar.java
index 55bf749bf..84deb6461 100644
--- a/test/compiler/stable/TestStableChar.java
+++ b/test/compiler/stable/TestStableChar.java
@@ -53,44 +53,32 @@
* java/lang/invoke/TestStableChar$DefaultStaticValue
* java/lang/invoke/TestStableChar$ObjectArrayLowerDim2
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:+FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableChar
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:-FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableChar
*/
package java.lang.invoke;
diff --git a/test/compiler/stable/TestStableDouble.java b/test/compiler/stable/TestStableDouble.java
index 112d83633..f2f85ce4f 100644
--- a/test/compiler/stable/TestStableDouble.java
+++ b/test/compiler/stable/TestStableDouble.java
@@ -53,44 +53,32 @@
* java/lang/invoke/TestStableDouble$DefaultStaticValue
* java/lang/invoke/TestStableDouble$ObjectArrayLowerDim2
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:+FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableDouble
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:-FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableDouble
*/
package java.lang.invoke;
diff --git a/test/compiler/stable/TestStableFloat.java b/test/compiler/stable/TestStableFloat.java
index 973a60165..40e46bd6a 100644
--- a/test/compiler/stable/TestStableFloat.java
+++ b/test/compiler/stable/TestStableFloat.java
@@ -53,44 +53,32 @@
* java/lang/invoke/TestStableFloat$DefaultStaticValue
* java/lang/invoke/TestStableFloat$ObjectArrayLowerDim2
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:+FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableFloat
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:-FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableFloat
*/
package java.lang.invoke;
diff --git a/test/compiler/stable/TestStableInt.java b/test/compiler/stable/TestStableInt.java
index bf7fe337b..beeb3808f 100644
--- a/test/compiler/stable/TestStableInt.java
+++ b/test/compiler/stable/TestStableInt.java
@@ -53,44 +53,32 @@
* java/lang/invoke/TestStableInt$DefaultStaticValue
* java/lang/invoke/TestStableInt$ObjectArrayLowerDim2
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:+FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableInt
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:-FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableInt
*/
package java.lang.invoke;
diff --git a/test/compiler/stable/TestStableLong.java b/test/compiler/stable/TestStableLong.java
index f97e7e143..69c90fc29 100644
--- a/test/compiler/stable/TestStableLong.java
+++ b/test/compiler/stable/TestStableLong.java
@@ -53,44 +53,32 @@
* java/lang/invoke/TestStableLong$DefaultStaticValue
* java/lang/invoke/TestStableLong$ObjectArrayLowerDim2
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:+FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableLong
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:-FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableLong
*/
package java.lang.invoke;
diff --git a/test/compiler/stable/TestStableObject.java b/test/compiler/stable/TestStableObject.java
index dec466adc..7b2f31e14 100644
--- a/test/compiler/stable/TestStableObject.java
+++ b/test/compiler/stable/TestStableObject.java
@@ -54,44 +54,32 @@
* java/lang/invoke/TestStableObject$DefaultStaticValue
* java/lang/invoke/TestStableObject$ObjectArrayLowerDim2
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:+FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableObject
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:-FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableObject
*/
package java.lang.invoke;
diff --git a/test/compiler/stable/TestStableShort.java b/test/compiler/stable/TestStableShort.java
index 67a7f0453..52cf6477e 100644
--- a/test/compiler/stable/TestStableShort.java
+++ b/test/compiler/stable/TestStableShort.java
@@ -53,44 +53,32 @@
* java/lang/invoke/TestStableShort$DefaultStaticValue
* java/lang/invoke/TestStableShort$ObjectArrayLowerDim2
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:-TieredCompilation
+ * -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
*
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:+FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableShort
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- * -client -XX:-TieredCompilation
- * -XX:-FoldStableValues
- * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- * java.lang.invoke.TestStableShort
*/
package java.lang.invoke;
diff --git a/test/compiler/stringopts/TestOptimizeStringConcat.java b/test/compiler/stringopts/TestOptimizeStringConcat.java
new file mode 100644
index 000000000..771ffb0bd
--- /dev/null
+++ b/test/compiler/stringopts/TestOptimizeStringConcat.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2015 SAP AG. 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
+ * @bug 8068909
+ * @key regression
+ * @summary test that string optimizations produce code, that doesn't lead to a crash.
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestOptimizeStringConcat
+ * @author axel.siebenborn@sap.com
+ */
+public class TestOptimizeStringConcat {
+
+ static boolean checkArgumentSyntax(String value, String allowedchars, String notallowedchars, String logmsg) {
+ String rc = null;
+
+ int maxchar = 99999;
+ int minchar = 1;
+ if ((allowedchars != null && notallowedchars != null) || minchar > maxchar) {
+ rc = "internal error";
+ } else {
+ if (value == null) {
+ rc = "the value null is not allowed, it is missing";
+ } else if (value != null && minchar > 0 && value.trim().equals("")) {
+ rc = "the value must not be empty";
+ } else if (value != null) {
+ if (value.length() < minchar || value.length() > maxchar) {
+ if (rc == null) {
+ rc = "the value length must be between +minchar+ and +maxchar";
+ }
+ }
+ char[] _value = value.toCharArray();
+ boolean dotfound = false;
+ int i = 1;
+ if (_value[i] == '.' && !dotfound) {
+ dotfound = true;
+ } else if (allowedchars != null && allowedchars.indexOf(_value[i]) == -1) {
+ if (rc == null) {
+ rc = "the value contains an illegal character: '" + _value[i] + "', only following characters are allowed: '+allowedchars+'";
+ } else {
+ rc += " / the value contains an illegal character: '" + _value[i] + "', only following characters are allowed: '+allowedchars+'";
+ }
+ } else if (notallowedchars != null && notallowedchars.indexOf(_value[i]) != -1) {
+ if (rc == null) {
+ rc = "the value contains an illegal character: '" + _value[i] + "', following characters are not allowed '+notallowedchars+'";
+ } else {
+ rc += " / the value contains an illegal character: '" + _value[i] + "', following characters are not allowed '+notallowedchars+'";
+ }
+ }
+ }
+ }
+
+ if (rc != null) {
+ System.out.println(logmsg + " ==> " + rc);
+ return false;
+ }
+ return true;
+ }
+
+ public static void main(String[] args) {
+ boolean failed = false;
+ for (int i = 0; i < 10000; i++) {
+ failed |= !checkArgumentSyntax("theName", null, "\"<&", "Error consistencyCheck: name in component definition");
+ failed |= !checkArgumentSyntax(null, null, "\"<&", "Error consistencyCheck: name in component definition");
+ failed |= !checkArgumentSyntax("42", "0123456789.", null, "Error consistencyCheck: counter in component definition");
+ }
+ System.out.println(failed);
+ }
+}
diff --git a/test/compiler/testlibrary/rtm/AbortProvoker.java b/test/compiler/testlibrary/rtm/AbortProvoker.java
index 1d129087d..b641ca084 100644
--- a/test/compiler/testlibrary/rtm/AbortProvoker.java
+++ b/test/compiler/testlibrary/rtm/AbortProvoker.java
@@ -29,8 +29,7 @@ import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import com.oracle.java.testlibrary.Asserts;
-import com.oracle.java.testlibrary.Utils;
-import sun.misc.Unsafe;
+import sun.hotspot.WhiteBox;
/**
* Base class for different transactional execution abortion
@@ -38,6 +37,9 @@ import sun.misc.Unsafe;
*/
public abstract class AbortProvoker implements CompilableTest {
public static final long DEFAULT_ITERATIONS = 10000L;
+ private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+ @SuppressWarnings("unused")
+ private static int sharedState = 0;
/**
* Inflates monitor associated with object {@code monitor}.
* Inflation is forced by entering the same monitor from
@@ -48,36 +50,76 @@ public abstract class AbortProvoker implements CompilableTest {
* @throws Exception if something went wrong.
*/
public static Object inflateMonitor(Object monitor) throws Exception {
- Unsafe unsafe = Utils.getUnsafe();
CyclicBarrier barrier = new CyclicBarrier(2);
Runnable inflatingRunnable = () -> {
- unsafe.monitorEnter(monitor);
- try {
- barrier.await();
- barrier.await();
- } catch (InterruptedException | BrokenBarrierException e) {
- throw new RuntimeException(
- "Synchronization issue occurred.", e);
- } finally {
- unsafe.monitorExit(monitor);
+ synchronized (monitor) {
+ try {
+ barrier.await();
+ } catch (BrokenBarrierException | InterruptedException e) {
+ throw new RuntimeException(
+ "Synchronization issue occurred.", e);
+ }
+ try {
+ monitor.wait();
+ } catch (InterruptedException e) {
+ throw new AssertionError("The thread waiting on an"
+ + " inflated monitor was interrupted, thus test"
+ + " results may be incorrect.", e);
+ }
}
};
Thread t = new Thread(inflatingRunnable);
+ t.setDaemon(true);
t.start();
// Wait until thread t enters the monitor.
barrier.await();
- // At this point monitor will be owned by thread t,
- // so our attempt to enter the same monitor will force
- // monitor inflation.
- Asserts.assertFalse(unsafe.tryMonitorEnter(monitor),
- "Not supposed to enter the monitor first");
- barrier.await();
- t.join();
+ synchronized (monitor) {
+ // At this point thread t is already waiting on the monitor.
+ // Modifying static field just to avoid lock's elimination.
+ sharedState++;
+ }
+ verifyMonitorState(monitor, true /* inflated */);
return monitor;
}
+ /**
+ * Verifies that {@code monitor} is a stack-lock or inflated lock depending
+ * on {@code shouldBeInflated} value. If {@code monitor} is inflated while
+ * it is expected that it should be a stack-lock, then this method attempts
+ * to deflate it by forcing a safepoint and then verifies the state once
+ * again.
+ *
+ * @param monitor monitor to be verified.
+ * @param shouldBeInflated flag indicating whether or not monitor is
+ * expected to be inflated.
+ * @throws RuntimeException if the {@code monitor} in a wrong state.
+ */
+ public static void verifyMonitorState(Object monitor,
+ boolean shouldBeInflated) {
+ if (!shouldBeInflated && WHITE_BOX.isMonitorInflated(monitor)) {
+ WHITE_BOX.forceSafepoint();
+ }
+ Asserts.assertEQ(WHITE_BOX.isMonitorInflated(monitor), shouldBeInflated,
+ "Monitor in a wrong state.");
+ }
+ /**
+ * Verifies that monitor used by the {@code provoker} is a stack-lock or
+ * inflated lock depending on {@code shouldBeInflated} value. If such
+ * monitor is inflated while it is expected that it should be a stack-lock,
+ * then this method attempts to deflate it by forcing a safepoint and then
+ * verifies the state once again.
+ *
+ * @param provoker AbortProvoker whose monitor's state should be verified.
+ * @param shouldBeInflated flag indicating whether or not monitor is
+ * expected to be inflated.
+ * @throws RuntimeException if the {@code monitor} in a wrong state.
+ */
+ public static void verifyMonitorState(AbortProvoker provoker,
+ boolean shouldBeInflated) {
+ verifyMonitorState(provoker.monitor, shouldBeInflated);
+ }
/**
* Get instance of specified AbortProvoker, inflate associated monitor
@@ -120,6 +162,7 @@ public abstract class AbortProvoker implements CompilableTest {
}
for (long i = 0; i < iterations; i++) {
+ AbortProvoker.verifyMonitorState(provoker, monitorShouldBeInflated);
provoker.forceAbort();
}
}
diff --git a/test/compiler/testlibrary/rtm/BusyLock.java b/test/compiler/testlibrary/rtm/BusyLock.java
index 70e80f70c..55985b61b 100644
--- a/test/compiler/testlibrary/rtm/BusyLock.java
+++ b/test/compiler/testlibrary/rtm/BusyLock.java
@@ -77,7 +77,7 @@ public class BusyLock implements CompilableTest, Runnable {
}
}
- public void test() {
+ public void syncAndTest() {
try {
barrier.await();
// wait until monitor is locked by a ::run method
@@ -85,6 +85,10 @@ public class BusyLock implements CompilableTest, Runnable {
} catch (InterruptedException | BrokenBarrierException e) {
throw new RuntimeException("Synchronization error happened.", e);
}
+ test();
+ }
+
+ public void test() {
synchronized(monitor) {
BusyLock.field++;
}
@@ -130,7 +134,7 @@ public class BusyLock implements CompilableTest, Runnable {
Thread t = new Thread(busyLock);
t.start();
- busyLock.test();
+ busyLock.syncAndTest();
t.join();
}
}
diff --git a/test/compiler/testlibrary/rtm/MemoryConflictProvoker.java b/test/compiler/testlibrary/rtm/MemoryConflictProvoker.java
index 48cf799eb..670e97511 100644
--- a/test/compiler/testlibrary/rtm/MemoryConflictProvoker.java
+++ b/test/compiler/testlibrary/rtm/MemoryConflictProvoker.java
@@ -69,11 +69,6 @@ class MemoryConflictProvoker extends AbortProvoker {
* Accesses and modifies memory region from within the transaction.
*/
public void transactionalRegion() {
- try {
- barrier.await();
- } catch (InterruptedException | BrokenBarrierException e) {
- throw new RuntimeException(e);
- }
for (int i = 0; i < MemoryConflictProvoker.INNER_ITERATIONS; i++) {
synchronized(monitor) {
MemoryConflictProvoker.field--;
@@ -86,6 +81,11 @@ class MemoryConflictProvoker extends AbortProvoker {
try {
Thread t = new Thread(conflictingThread);
t.start();
+ try {
+ barrier.await();
+ } catch (InterruptedException | BrokenBarrierException e) {
+ throw new RuntimeException(e);
+ }
transactionalRegion();
t.join();
} catch (Exception e) {
diff --git a/test/compiler/testlibrary/rtm/RTMTestBase.java b/test/compiler/testlibrary/rtm/RTMTestBase.java
index 64adabc05..406443a65 100644
--- a/test/compiler/testlibrary/rtm/RTMTestBase.java
+++ b/test/compiler/testlibrary/rtm/RTMTestBase.java
@@ -238,10 +238,10 @@ public class RTMTestBase {
String[] filteredVMOpts = Utils.getFilteredTestJavaOpts(filters);
Collections.addAll(finalVMOpts, filteredVMOpts);
Collections.addAll(finalVMOpts, "-Xcomp", "-server",
- "-XX:-TieredCompilation",
+ "-XX:-TieredCompilation", "-XX:+UseRTMLocking",
CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
- "-XX:+UseRTMLocking");
+ "-Xbootclasspath/a:.", "-XX:+WhiteBoxAPI");
if (test != null) {
for (String method : test.getMethodsToCompileNames()) {
diff --git a/test/compiler/types/TestMeetExactConstantArrays.java b/test/compiler/types/TestMeetExactConstantArrays.java
new file mode 100644
index 000000000..951288ec2
--- /dev/null
+++ b/test/compiler/types/TestMeetExactConstantArrays.java
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8075587
+ * @summary meet of 2 constant arrays result in bottom
+ * @run main/othervm TestMeetExactConstantArrays
+ *
+ */
+
+public class TestMeetExactConstantArrays {
+ public abstract static class NumbersHolder {
+ public Number[] getNumbers() {
+ return null;
+ }
+ }
+
+ public static class IntegersHolder extends NumbersHolder {
+ private final static Integer integers[] = { new Integer(1) };
+
+ public Number[] getNumbers() {
+ return integers;
+ }
+ }
+
+ public static class LongsHolder extends NumbersHolder {
+ private final static Long longs[] = { new Long(1) };
+
+ public Number[] getNumbers() {
+ return longs;
+ }
+ }
+
+ public static final void loopNumbers(NumbersHolder numbersHolder) {
+ Number[] numbers = numbersHolder.getNumbers();
+ for (int i = 0; i < numbers.length; i++) {
+ numbers[i].longValue();
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ for (int i = 0; i < 10000; i++) {
+ IntegersHolder integersHolder = new IntegersHolder();
+ LongsHolder longsHolder = new LongsHolder();
+ loopNumbers(integersHolder);
+ loopNumbers(longsHolder);
+ }
+ }
+}
diff --git a/test/compiler/types/TestTypePropagationToCmpU.java b/test/compiler/types/TestTypePropagationToCmpU.java
new file mode 100644
index 000000000..9e08a8b4c
--- /dev/null
+++ b/test/compiler/types/TestTypePropagationToCmpU.java
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8080156 8060036
+ * @summary Test correctness of type propagation to CmpUNodes.
+ * @run main TestTypePropagationToCmpU
+ */
+public class TestTypePropagationToCmpU {
+ public static void main(String[] args) {
+ try {
+ // Trigger compilation
+ for (int i = 0; i < 100_000; ++i) {
+ test();
+ }
+ } catch (NullPointerException e) {
+ // Test should never throw a NullPointerException
+ throw new RuntimeException("Test failed");
+ }
+ }
+
+ static int global = 42;
+
+ public static void test() {
+ int a = Integer.MIN_VALUE;
+ int b = global;
+ char[] buf = { 0 };
+ for (int i = 0; i <= b; ++i) {
+ a = i - b;
+ }
+ // C2 adds a range check and an uncommon trap here to ensure that the array index
+ // is in bounds. If type information is not propagated correctly to the corresponding
+ // CmpUNode, this trap may be always taken. Because C2 also removes the unnecessary
+ // allocation of 'buf', a NullPointerException is thrown in this case.
+ char c = buf[(a * 11) / 2 - a]; // a is 0 here if global >= 0
+ buf[0] = 0;
+ }
+}
diff --git a/test/compiler/uncommontrap/UncommonTrapStackBang.java b/test/compiler/uncommontrap/UncommonTrapStackBang.java
index 164453b7b..e0c093b7b 100644
--- a/test/compiler/uncommontrap/UncommonTrapStackBang.java
+++ b/test/compiler/uncommontrap/UncommonTrapStackBang.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
@@ -27,9 +27,7 @@
* @bug 8026775
* @summary Uncommon trap blob did not bang all the stack shadow pages
*
- * @run main/othervm -server -XX:+IgnoreUnrecognizedVMOptions -XX:+TieredCompilation UncommonTrapStackBang
- * @run main/othervm -server -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation UncommonTrapStackBang
- *
+ * @run main/othervm UncommonTrapStackBang
*
* Note: This test does not reproduce the problem with absolute
* certainty. Empirically the bug reproduces on Windows some 80+% of
diff --git a/test/compiler/unsafe/TestUnsafeLoadControl.java b/test/compiler/unsafe/TestUnsafeLoadControl.java
new file mode 100644
index 000000000..edd559753
--- /dev/null
+++ b/test/compiler/unsafe/TestUnsafeLoadControl.java
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8077504
+ * @summary Unsafe load can loose control dependency and cause crash
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestUnsafeLoadControl
+ *
+ */
+
+import java.lang.reflect.Field;
+import sun.misc.Unsafe;
+
+public class TestUnsafeLoadControl {
+
+ private static final Unsafe UNSAFE;
+
+ static {
+ try {
+ Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe");
+ unsafeField.setAccessible(true);
+ UNSAFE = (Unsafe) unsafeField.get(null);
+ } catch(Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ static int val;
+ static void test1(int[] a, boolean[] flags, boolean flag, long j) {
+ for (int i = 0; i < 10; i++) {
+ if (flags[i]) {
+ if (flag) {
+ long address = (j << 2) + UNSAFE.ARRAY_INT_BASE_OFFSET;
+ int v = UNSAFE.getInt(a, address);
+ val = v;
+ }
+ }
+ }
+ }
+
+ static int test2(int[] a, boolean[] flags, boolean flag, long j) {
+ int sum = 0;
+ for (int i = 0; i < 10; i++) {
+ if (flags[i]) {
+ if (flag) {
+ long address = (j << 2) + UNSAFE.ARRAY_INT_BASE_OFFSET;
+ int v = UNSAFE.getInt(a, address);
+ if (v == 0) {
+ sum++;
+ }
+ }
+ }
+ }
+ return sum;
+ }
+
+ static public void main(String[] args) {
+ boolean[] flags = new boolean[10];
+ for (int i = 0; i < flags.length; i++) {
+ flags[i] = true;
+ }
+ int[] array = new int[10];
+ for (int i = 0; i < 20000; i++) {
+ test1(array, flags, true, 0);
+ }
+ for (int i = 0; i < flags.length; i++) {
+ flags[i] = false;
+ }
+ test1(array, flags, true, Long.MAX_VALUE/4);
+
+ for (int i = 0; i < flags.length; i++) {
+ flags[i] = true;
+ }
+ for (int i = 0; i < 20000; i++) {
+ test2(array, flags, true, 0);
+ }
+ for (int i = 0; i < flags.length; i++) {
+ flags[i] = false;
+ }
+ test2(array, flags, true, Long.MAX_VALUE/4);
+ }
+}