# HG changeset patch # User goetz # Date 1442576484 -7200 # Node ID 40bef41d5f92af3fac39c42f256ab6940d3b21b6 # Parent 476739c20b35f5ad9ee87ef314b4ad04b4337ae6 8134579: [TESTBUG] Some bmi tests fail if can_access_local_variables is on. Summary: Others fail because of uncommon trap. Also fix test file names. diff --git a/test/compiler/intrinsics/bmi/TestAndnI.java b/test/compiler/intrinsics/bmi/TestAndnI.java --- a/test/compiler/intrinsics/bmi/TestAndnI.java +++ b/test/compiler/intrinsics/bmi/TestAndnI.java @@ -61,15 +61,27 @@ } public int intExpr(int src1, Expr.MemI src2) { - return ~src1 & src2.value; + if (src2 != null) { + return ~src1 & src2.value; + } else { + return 0; + } } public int intExpr(Expr.MemI src1, int src2) { - return ~src1.value & src2; + if (src1 != null) { + return ~src1.value & src2; + } else { + return 0; + } } public int intExpr(Expr.MemI src1, Expr.MemI src2) { - return ~src1.value & src2.value; + if (src1 != null && src2 != null) { + return ~src1.value & src2.value; + } else { + return 0; + } } } @@ -80,15 +92,27 @@ } public int intExpr(int src1, Expr.MemI src2) { - return src1 & ~src2.value; + if (src2 != null) { + return src1 & ~src2.value; + } else { + return 0; + } } public int intExpr(Expr.MemI src1, int src2) { - return src1.value & ~src2; + if (src1 != null) { + return src1.value & ~src2; + } else { + return 0; + } } public int intExpr(Expr.MemI src1, Expr.MemI src2) { - return src1.value & ~src2.value; + if (src1 != null && src2 != null) { + return src1.value & ~src2.value; + } else { + return 0; + } } } } diff --git a/test/compiler/intrinsics/bmi/TestAndnL.java b/test/compiler/intrinsics/bmi/TestAndnL.java --- a/test/compiler/intrinsics/bmi/TestAndnL.java +++ b/test/compiler/intrinsics/bmi/TestAndnL.java @@ -61,15 +61,27 @@ } public long longExpr(long src1, Expr.MemL src2) { - return ~src1 & src2.value; + if (src2 != null) { + return ~src1 & src2.value; + } else { + return 0; + } } public long longExpr(Expr.MemL src1, long src2) { - return ~src1.value & src2; + if (src1 != null) { + return ~src1.value & src2; + } else { + return 0; + } } public long longExpr(Expr.MemL src1, Expr.MemL src2) { - return ~src1.value & src2.value; + if (src1 != null && src2 != null) { + return ~src1.value & src2.value; + } else { + return 0; + } } @@ -82,15 +94,27 @@ } public long longExpr(long src1, Expr.MemL src2) { - return src1 & ~src2.value; + if (src2 != null) { + return src1 & ~src2.value; + } else { + return 0; + } } public long longExpr(Expr.MemL src1, long src2) { - return src1.value & ~src2; + if (src1 != null) { + return src1.value & ~src2; + } else { + return 0; + } } public long longExpr(Expr.MemL src1, Expr.MemL src2) { - return src1.value & ~src2.value; + if (src1 != null && src2 != null) { + return src1.value & ~src2.value; + } else { + return 0; + } } } diff --git a/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java b/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java deleted file mode 100644 --- a/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2014, 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 8031321 - * @library /testlibrary /../../test/lib /compiler/whitebox .. - * @modules java.base/sun.misc - * java.management - * @build AddnTestI - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AddnTestI - */ - -import java.lang.reflect.Method; - -public class AddnTestI extends BmiIntrinsicBase.BmiTestCase { - - protected AddnTestI(Method method) { - super(method); - // from intel manual VEX.NDS.LZ.0F38.W0 F2 /r, example c4e260f2c2 - instrMask = new byte[]{ - (byte) 0xFF, - (byte) 0x1F, - (byte) 0x00, - (byte) 0xFF}; - instrPattern = new byte[]{ - (byte) 0xC4, // prefix for 3-byte VEX instruction - (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes - (byte) 0x00, - (byte) 0xF2}; - } - - public static void main(String[] args) throws Exception { - BmiIntrinsicBase.verifyTestCase(AddnTestI::new, TestAndnI.AndnIExpr.class.getDeclaredMethods()); - BmiIntrinsicBase.verifyTestCase(AddnTestI::new, TestAndnI.AndnICommutativeExpr.class.getDeclaredMethods()); - } -} diff --git a/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java b/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java deleted file mode 100644 --- a/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014, 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 8031321 - * @library /testlibrary /../../test/lib /compiler/whitebox .. - * @modules java.base/sun.misc - * java.management - * @build AddnTestL - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AddnTestL - */ - -import java.lang.reflect.Method; - -public class AddnTestL extends AddnTestI { - - protected AddnTestL(Method method) { - super(method); - isLongOperation = true; - } - - public static void main(String[] args) throws Exception { - BmiIntrinsicBase.verifyTestCase(AddnTestL::new, TestAndnL.AndnLExpr.class.getDeclaredMethods()); - BmiIntrinsicBase.verifyTestCase(AddnTestL::new, TestAndnL.AndnLCommutativeExpr.class.getDeclaredMethods()); - } -} diff --git a/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java b/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java new file mode 100644 --- /dev/null +++ b/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2014, 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 8031321 + * @library /testlibrary /../../test/lib /compiler/whitebox .. + * @modules java.base/sun.misc + * java.management + * @build AndnTestI + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestI + */ + +import java.lang.reflect.Method; + +public class AndnTestI extends BmiIntrinsicBase.BmiTestCase { + + protected AndnTestI(Method method) { + super(method); + // from intel manual VEX.NDS.LZ.0F38.W0 F2 /r, example c4e260f2c2 + instrMask = new byte[]{ + (byte) 0xFF, + (byte) 0x1F, + (byte) 0x00, + (byte) 0xFF}; + instrPattern = new byte[]{ + (byte) 0xC4, // prefix for 3-byte VEX instruction + (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes + (byte) 0x00, + (byte) 0xF2}; + } + + public static void main(String[] args) throws Exception { + BmiIntrinsicBase.verifyTestCase(AndnTestI::new, TestAndnI.AndnIExpr.class.getDeclaredMethods()); + BmiIntrinsicBase.verifyTestCase(AndnTestI::new, TestAndnI.AndnICommutativeExpr.class.getDeclaredMethods()); + } +} diff --git a/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java b/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java new file mode 100644 --- /dev/null +++ b/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014, 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 8031321 + * @library /testlibrary /../../test/lib /compiler/whitebox .. + * @modules java.base/sun.misc + * java.management + * @build AndnTestL + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestL + */ + +import java.lang.reflect.Method; + +public class AndnTestL extends AndnTestI { + + protected AndnTestL(Method method) { + super(method); + isLongOperation = true; + } + + public static void main(String[] args) throws Exception { + BmiIntrinsicBase.verifyTestCase(AndnTestL::new, TestAndnL.AndnLExpr.class.getDeclaredMethods()); + BmiIntrinsicBase.verifyTestCase(AndnTestL::new, TestAndnL.AndnLCommutativeExpr.class.getDeclaredMethods()); + } +} diff --git a/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java b/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java --- a/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java +++ b/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java @@ -50,6 +50,8 @@ public static void main(String[] args) throws Exception { // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods System.out.println("class java.lang.Integer should be loaded. Proof: " + Integer.class); + // Avoid uncommon traps. + System.out.println("Num leading zeroes: " + new TestLzcntI.LzcntIExpr().intExpr(12341341)); BmiIntrinsicBase.verifyTestCase(LZcntTestI::new, TestLzcntI.LzcntIExpr.class.getDeclaredMethods()); } diff --git a/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java b/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java --- a/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java +++ b/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java @@ -46,6 +46,8 @@ public static void main(String[] args) throws Exception { // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods System.out.println("classes java.lang.Long should be loaded. Proof: " + Long.class); + // Avoid uncommon traps. + System.out.println("Num leading zeroes: " + new TestLzcntL.LzcntLExpr().longExpr(12341341)); BmiIntrinsicBase.verifyTestCase(LZcntTestL::new, TestLzcntL.LzcntLExpr.class.getDeclaredMethods()); } } diff --git a/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java b/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java --- a/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java +++ b/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java @@ -50,6 +50,8 @@ public static void main(String[] args) throws Exception { // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods System.out.println("class java.lang.Integer should be loaded. Proof: " + Integer.class); + // Avoid uncommon traps. + System.out.println("Num trailing zeroes: " + new TestTzcntI.TzcntIExpr().intExpr(12341341)); BmiIntrinsicBase.verifyTestCase(TZcntTestI::new, TestTzcntI.TzcntIExpr.class.getDeclaredMethods()); } diff --git a/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java b/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java --- a/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java +++ b/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java @@ -46,6 +46,8 @@ public static void main(String[] args) throws Exception { // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods System.out.println("classes java.lang.Long should be loaded. Proof: " + Long.class); + // Avoid uncommon traps. + System.out.println("Num trailing zeroes: " + new TestTzcntL.TzcntLExpr().longExpr(12341341)); BmiIntrinsicBase.verifyTestCase(TZcntTestL::new, TestTzcntL.TzcntLExpr.class.getDeclaredMethods()); } }