Fri, 11 Apr 2014 00:34:51 +0400
8038953: Add sanity tests for BMI1 and LZCNT instructions
Reviewed-by: kvn, iignatyev
Contributed-by: anton.ivanov@oracle.com
1.1 --- a/test/TEST.groups Wed Apr 09 22:37:37 2014 +0400 1.2 +++ b/test/TEST.groups Fri Apr 11 00:34:51 2014 +0400 1.3 @@ -135,7 +135,8 @@ 1.4 runtime/InternalApi/ThreadCpuTimesDeadlock.java \ 1.5 serviceability/threads/TestFalseDeadLock.java \ 1.6 compiler/tiered/NonTieredLevelsTest.java \ 1.7 - compiler/tiered/TieredLevelsTest.java 1.8 + compiler/tiered/TieredLevelsTest.java \ 1.9 + compiler/intrinsics/bmi/verifycode 1.10 1.11 # Compact 2 adds full VM tests 1.12 compact2 = \
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java Fri Apr 11 00:34:51 2014 +0400 2.3 @@ -0,0 +1,57 @@ 2.4 +/* 2.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.7 + * 2.8 + * This code is free software; you can redistribute it and/or modify it 2.9 + * under the terms of the GNU General Public License version 2 only, as 2.10 + * published by the Free Software Foundation. 2.11 + * 2.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 2.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2.15 + * version 2 for more details (a copy is included in the LICENSE file that 2.16 + * accompanied this code). 2.17 + * 2.18 + * You should have received a copy of the GNU General Public License version 2.19 + * 2 along with this work; if not, write to the Free Software Foundation, 2.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2.21 + * 2.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2.23 + * or visit www.oracle.com if you need additional information or have any 2.24 + * questions. 2.25 + */ 2.26 + 2.27 +/* 2.28 + * @test 2.29 + * @bug 8031321 2.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. 2.31 + * @build AddnTestI 2.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 2.33 + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI 2.34 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AddnTestI 2.35 + */ 2.36 + 2.37 +import java.lang.reflect.Method; 2.38 + 2.39 +public class AddnTestI extends BmiIntrinsicBase.BmiTestCase { 2.40 + 2.41 + protected AddnTestI(Method method) { 2.42 + super(method); 2.43 + // from intel manual VEX.NDS.LZ.0F38.W0 F2 /r, example c4e260f2c2 2.44 + instrMask = new byte[]{ 2.45 + (byte) 0xFF, 2.46 + (byte) 0x1F, 2.47 + (byte) 0x00, 2.48 + (byte) 0xFF}; 2.49 + instrPattern = new byte[]{ 2.50 + (byte) 0xC4, // prefix for 3-byte VEX instruction 2.51 + (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes 2.52 + (byte) 0x00, 2.53 + (byte) 0xF2}; 2.54 + } 2.55 + 2.56 + public static void main(String[] args) throws Exception { 2.57 + BmiIntrinsicBase.verifyTestCase(AddnTestI::new, TestAndnI.AndnIExpr.class.getDeclaredMethods()); 2.58 + BmiIntrinsicBase.verifyTestCase(AddnTestI::new, TestAndnI.AndnICommutativeExpr.class.getDeclaredMethods()); 2.59 + } 2.60 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java Fri Apr 11 00:34:51 2014 +0400 3.3 @@ -0,0 +1,47 @@ 3.4 +/* 3.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.7 + * 3.8 + * This code is free software; you can redistribute it and/or modify it 3.9 + * under the terms of the GNU General Public License version 2 only, as 3.10 + * published by the Free Software Foundation. 3.11 + * 3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.15 + * version 2 for more details (a copy is included in the LICENSE file that 3.16 + * accompanied this code). 3.17 + * 3.18 + * You should have received a copy of the GNU General Public License version 3.19 + * 2 along with this work; if not, write to the Free Software Foundation, 3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.21 + * 3.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3.23 + * or visit www.oracle.com if you need additional information or have any 3.24 + * questions. 3.25 + */ 3.26 + 3.27 +/* 3.28 + * @test 3.29 + * @bug 8031321 3.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. 3.31 + * @build AddnTestL 3.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 3.33 + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI 3.34 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AddnTestL 3.35 + */ 3.36 + 3.37 +import java.lang.reflect.Method; 3.38 + 3.39 +public class AddnTestL extends AddnTestI { 3.40 + 3.41 + protected AddnTestL(Method method) { 3.42 + super(method); 3.43 + isLongOperation = true; 3.44 + } 3.45 + 3.46 + public static void main(String[] args) throws Exception { 3.47 + BmiIntrinsicBase.verifyTestCase(AddnTestL::new, TestAndnL.AndnLExpr.class.getDeclaredMethods()); 3.48 + BmiIntrinsicBase.verifyTestCase(AddnTestL::new, TestAndnL.AndnLCommutativeExpr.class.getDeclaredMethods()); 3.49 + } 3.50 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java Fri Apr 11 00:34:51 2014 +0400 4.3 @@ -0,0 +1,59 @@ 4.4 +/* 4.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 + * 4.8 + * This code is free software; you can redistribute it and/or modify it 4.9 + * under the terms of the GNU General Public License version 2 only, as 4.10 + * published by the Free Software Foundation. 4.11 + * 4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.15 + * version 2 for more details (a copy is included in the LICENSE file that 4.16 + * accompanied this code). 4.17 + * 4.18 + * You should have received a copy of the GNU General Public License version 4.19 + * 2 along with this work; if not, write to the Free Software Foundation, 4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.21 + * 4.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.23 + * or visit www.oracle.com if you need additional information or have any 4.24 + * questions. 4.25 + */ 4.26 + 4.27 +/* 4.28 + * @test 4.29 + * @bug 8031321 4.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. 4.31 + * @build BlsiTestI 4.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 4.33 + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI 4.34 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsiTestI 4.35 + */ 4.36 + 4.37 +import java.lang.reflect.Method; 4.38 + 4.39 +public class BlsiTestI extends BmiIntrinsicBase.BmiTestCase { 4.40 + 4.41 + protected BlsiTestI(Method method) { 4.42 + super(method); 4.43 + //from intel manual VEX.NDD.LZ.0F38.W0 F3 /3 4.44 + instrMask = new byte[]{ 4.45 + (byte) 0xFF, 4.46 + (byte) 0x1F, 4.47 + (byte) 0x00, 4.48 + (byte) 0xFF, 4.49 + (byte) 0b0011_1000}; 4.50 + instrPattern = new byte[]{ 4.51 + (byte) 0xC4, // prefix for 3-byte VEX instruction 4.52 + (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes 4.53 + (byte) 0x00, 4.54 + (byte) 0xF3, 4.55 + (byte) 0b0001_1000}; // bits 543 == 011 (3) 4.56 + } 4.57 + 4.58 + public static void main(String[] args) throws Exception { 4.59 + BmiIntrinsicBase.verifyTestCase(BlsiTestI::new, TestBlsiI.BlsiIExpr.class.getDeclaredMethods()); 4.60 + BmiIntrinsicBase.verifyTestCase(BlsiTestI::new, TestBlsiI.BlsiICommutativeExpr.class.getDeclaredMethods()); 4.61 + } 4.62 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java Fri Apr 11 00:34:51 2014 +0400 5.3 @@ -0,0 +1,47 @@ 5.4 +/* 5.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.7 + * 5.8 + * This code is free software; you can redistribute it and/or modify it 5.9 + * under the terms of the GNU General Public License version 2 only, as 5.10 + * published by the Free Software Foundation. 5.11 + * 5.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 5.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 5.15 + * version 2 for more details (a copy is included in the LICENSE file that 5.16 + * accompanied this code). 5.17 + * 5.18 + * You should have received a copy of the GNU General Public License version 5.19 + * 2 along with this work; if not, write to the Free Software Foundation, 5.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 5.21 + * 5.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 5.23 + * or visit www.oracle.com if you need additional information or have any 5.24 + * questions. 5.25 + */ 5.26 + 5.27 +/* 5.28 + * @test 5.29 + * @bug 8031321 5.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. 5.31 + * @build BlsiTestL 5.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 5.33 + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI 5.34 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsiTestL 5.35 + */ 5.36 + 5.37 +import java.lang.reflect.Method; 5.38 + 5.39 +public class BlsiTestL extends BlsiTestI { 5.40 + 5.41 + protected BlsiTestL(Method method) { 5.42 + super(method); 5.43 + isLongOperation = true; 5.44 + } 5.45 + 5.46 + public static void main(String[] args) throws Exception { 5.47 + BmiIntrinsicBase.verifyTestCase(BlsiTestL::new, TestBlsiL.BlsiLExpr.class.getDeclaredMethods()); 5.48 + BmiIntrinsicBase.verifyTestCase(BlsiTestL::new, TestBlsiL.BlsiLCommutativeExpr.class.getDeclaredMethods()); 5.49 + } 5.50 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java Fri Apr 11 00:34:51 2014 +0400 6.3 @@ -0,0 +1,59 @@ 6.4 +/* 6.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 6.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.7 + * 6.8 + * This code is free software; you can redistribute it and/or modify it 6.9 + * under the terms of the GNU General Public License version 2 only, as 6.10 + * published by the Free Software Foundation. 6.11 + * 6.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 6.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 6.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 6.15 + * version 2 for more details (a copy is included in the LICENSE file that 6.16 + * accompanied this code). 6.17 + * 6.18 + * You should have received a copy of the GNU General Public License version 6.19 + * 2 along with this work; if not, write to the Free Software Foundation, 6.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 6.21 + * 6.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 6.23 + * or visit www.oracle.com if you need additional information or have any 6.24 + * questions. 6.25 + */ 6.26 + 6.27 +/* 6.28 + * @test 6.29 + * @bug 8031321 6.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. 6.31 + * @build BlsmskTestI 6.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 6.33 + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI 6.34 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsmskTestI 6.35 + */ 6.36 + 6.37 +import java.lang.reflect.Method; 6.38 + 6.39 +public class BlsmskTestI extends BmiIntrinsicBase.BmiTestCase { 6.40 + 6.41 + protected BlsmskTestI(Method method) { 6.42 + super(method); 6.43 + //from intel manual VEX.NDD.LZ.0F38.W0 F3 /2 6.44 + instrMask = new byte[]{ 6.45 + (byte) 0xFF, 6.46 + (byte) 0x1F, 6.47 + (byte) 0x00, 6.48 + (byte) 0xFF, 6.49 + (byte) 0b0011_1000}; 6.50 + instrPattern = new byte[]{ 6.51 + (byte) 0xC4, // prefix for 3-byte VEX instruction 6.52 + (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes 6.53 + (byte) 0x00, 6.54 + (byte) 0xF3, 6.55 + (byte) 0b0001_0000}; // bits 543 == 011 (3) 6.56 + } 6.57 + 6.58 + public static void main(String[] args) throws Exception { 6.59 + BmiIntrinsicBase.verifyTestCase(BlsmskTestI::new, TestBlsmskI.BlsmskIExpr.class.getDeclaredMethods()); 6.60 + BmiIntrinsicBase.verifyTestCase(BlsmskTestI::new, TestBlsmskI.BlsmskICommutativeExpr.class.getDeclaredMethods()); 6.61 + } 6.62 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java Fri Apr 11 00:34:51 2014 +0400 7.3 @@ -0,0 +1,47 @@ 7.4 +/* 7.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.7 + * 7.8 + * This code is free software; you can redistribute it and/or modify it 7.9 + * under the terms of the GNU General Public License version 2 only, as 7.10 + * published by the Free Software Foundation. 7.11 + * 7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 7.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 7.15 + * version 2 for more details (a copy is included in the LICENSE file that 7.16 + * accompanied this code). 7.17 + * 7.18 + * You should have received a copy of the GNU General Public License version 7.19 + * 2 along with this work; if not, write to the Free Software Foundation, 7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 7.21 + * 7.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 7.23 + * or visit www.oracle.com if you need additional information or have any 7.24 + * questions. 7.25 + */ 7.26 + 7.27 +/* 7.28 + * @test 7.29 + * @bug 8031321 7.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. 7.31 + * @build BlsmskTestL 7.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 7.33 + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI 7.34 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsmskTestL 7.35 + */ 7.36 + 7.37 +import java.lang.reflect.Method; 7.38 + 7.39 +public class BlsmskTestL extends BlsmskTestI { 7.40 + 7.41 + protected BlsmskTestL(Method method) { 7.42 + super(method); 7.43 + isLongOperation = true; 7.44 + } 7.45 + 7.46 + public static void main(String[] args) throws Exception { 7.47 + BmiIntrinsicBase.verifyTestCase(BlsmskTestL::new, TestBlsmskL.BlsmskLExpr.class.getDeclaredMethods()); 7.48 + BmiIntrinsicBase.verifyTestCase(BlsmskTestL::new, TestBlsmskL.BlsmskLCommutativeExpr.class.getDeclaredMethods()); 7.49 + } 7.50 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java Fri Apr 11 00:34:51 2014 +0400 8.3 @@ -0,0 +1,59 @@ 8.4 +/* 8.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.7 + * 8.8 + * This code is free software; you can redistribute it and/or modify it 8.9 + * under the terms of the GNU General Public License version 2 only, as 8.10 + * published by the Free Software Foundation. 8.11 + * 8.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 8.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 8.15 + * version 2 for more details (a copy is included in the LICENSE file that 8.16 + * accompanied this code). 8.17 + * 8.18 + * You should have received a copy of the GNU General Public License version 8.19 + * 2 along with this work; if not, write to the Free Software Foundation, 8.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 8.21 + * 8.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 8.23 + * or visit www.oracle.com if you need additional information or have any 8.24 + * questions. 8.25 + */ 8.26 + 8.27 +/* 8.28 + * @test 8.29 + * @bug 8031321 8.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. 8.31 + * @build BlsrTestI 8.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 8.33 + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI 8.34 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsrTestI 8.35 + */ 8.36 + 8.37 +import java.lang.reflect.Method; 8.38 + 8.39 +public class BlsrTestI extends BmiIntrinsicBase.BmiTestCase { 8.40 + 8.41 + protected BlsrTestI(Method method) { 8.42 + super(method); 8.43 + //from intel manual VEX.NDD.LZ.0F38.W0 F3 /1 8.44 + instrMask = new byte[]{ 8.45 + (byte) 0xFF, 8.46 + (byte) 0x1F, 8.47 + (byte) 0x00, 8.48 + (byte) 0xFF, 8.49 + (byte) 0b0011_1000}; 8.50 + instrPattern = new byte[]{ 8.51 + (byte) 0xC4, // prefix for 3-byte VEX instruction 8.52 + (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes 8.53 + (byte) 0x00, 8.54 + (byte) 0xF3, 8.55 + (byte) 0b0000_1000}; // bits 543 == 011 (3) 8.56 + } 8.57 + 8.58 + public static void main(String[] args) throws Exception { 8.59 + BmiIntrinsicBase.verifyTestCase(BlsrTestI::new, TestBlsrI.BlsrIExpr.class.getDeclaredMethods()); 8.60 + BmiIntrinsicBase.verifyTestCase(BlsrTestI::new, TestBlsrI.BlsrICommutativeExpr.class.getDeclaredMethods()); 8.61 + } 8.62 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java Fri Apr 11 00:34:51 2014 +0400 9.3 @@ -0,0 +1,47 @@ 9.4 +/* 9.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.7 + * 9.8 + * This code is free software; you can redistribute it and/or modify it 9.9 + * under the terms of the GNU General Public License version 2 only, as 9.10 + * published by the Free Software Foundation. 9.11 + * 9.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 9.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 9.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 9.15 + * version 2 for more details (a copy is included in the LICENSE file that 9.16 + * accompanied this code). 9.17 + * 9.18 + * You should have received a copy of the GNU General Public License version 9.19 + * 2 along with this work; if not, write to the Free Software Foundation, 9.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 9.21 + * 9.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 9.23 + * or visit www.oracle.com if you need additional information or have any 9.24 + * questions. 9.25 + */ 9.26 + 9.27 +/* 9.28 + * @test 9.29 + * @bug 8031321 9.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. 9.31 + * @build BlsrTestL 9.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 9.33 + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI 9.34 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsrTestL 9.35 + */ 9.36 + 9.37 +import java.lang.reflect.Method; 9.38 + 9.39 +public class BlsrTestL extends BlsrTestI { 9.40 + 9.41 + protected BlsrTestL(Method method) { 9.42 + super(method); 9.43 + isLongOperation = true; 9.44 + } 9.45 + 9.46 + public static void main(String[] args) throws Exception { 9.47 + BmiIntrinsicBase.verifyTestCase(BlsrTestL::new, TestBlsrL.BlsrLExpr.class.getDeclaredMethods()); 9.48 + BmiIntrinsicBase.verifyTestCase(BlsrTestL::new, TestBlsrL.BlsrLCommutativeExpr.class.getDeclaredMethods()); 9.49 + } 9.50 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java Fri Apr 11 00:34:51 2014 +0400 10.3 @@ -0,0 +1,186 @@ 10.4 +/* 10.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 10.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.7 + * 10.8 + * This code is free software; you can redistribute it and/or modify it 10.9 + * under the terms of the GNU General Public License version 2 only, as 10.10 + * published by the Free Software Foundation. 10.11 + * 10.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 10.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.15 + * version 2 for more details (a copy is included in the LICENSE file that 10.16 + * accompanied this code). 10.17 + * 10.18 + * You should have received a copy of the GNU General Public License version 10.19 + * 2 along with this work; if not, write to the Free Software Foundation, 10.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.21 + * 10.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 10.23 + * or visit www.oracle.com if you need additional information or have any 10.24 + * questions. 10.25 + * 10.26 + */ 10.27 + 10.28 +import com.oracle.java.testlibrary.Asserts; 10.29 +import com.oracle.java.testlibrary.Platform; 10.30 +import com.oracle.java.testlibrary.Utils; 10.31 +import sun.hotspot.code.NMethod; 10.32 +import sun.hotspot.cpuinfo.CPUInfo; 10.33 + 10.34 +import java.lang.reflect.Executable; 10.35 +import java.lang.reflect.Method; 10.36 +import java.util.concurrent.Callable; 10.37 +import java.util.function.Function; 10.38 + 10.39 +public class BmiIntrinsicBase extends CompilerWhiteBoxTest { 10.40 + 10.41 + protected BmiIntrinsicBase(BmiTestCase testCase) { 10.42 + super(testCase); 10.43 + } 10.44 + 10.45 + public static void verifyTestCase(Function<Method, BmiTestCase> constructor, Method... methods) throws Exception { 10.46 + for (Method method : methods) { 10.47 + new BmiIntrinsicBase(constructor.apply(method)).test(); 10.48 + } 10.49 + } 10.50 + 10.51 + @Override 10.52 + protected void test() throws Exception { 10.53 + BmiTestCase bmiTestCase = (BmiTestCase) testCase; 10.54 + 10.55 + if (!(Platform.isX86() || Platform.isX64())) { 10.56 + System.out.println("Unsupported platform, test SKIPPED"); 10.57 + return; 10.58 + } 10.59 + 10.60 + if (!Platform.isServer()) { 10.61 + System.out.println("Not server VM, test SKIPPED"); 10.62 + return; 10.63 + } 10.64 + 10.65 + if (!CPUInfo.hasFeature(bmiTestCase.getCpuFlag())) { 10.66 + System.out.println("Unsupported hardware, no required CPU flag " + bmiTestCase.getCpuFlag() + " , test SKIPPED"); 10.67 + return; 10.68 + } 10.69 + 10.70 + if (!Boolean.valueOf(getVMOption(bmiTestCase.getVMFlag()))) { 10.71 + System.out.println("VM flag " + bmiTestCase.getVMFlag() + " disabled, test SKIPPED"); 10.72 + return; 10.73 + } 10.74 + 10.75 + System.out.println(testCase.name()); 10.76 + 10.77 + switch (MODE) { 10.78 + case "compiled mode": 10.79 + case "mixed mode": 10.80 + if (TIERED_COMPILATION && TIERED_STOP_AT_LEVEL != CompilerWhiteBoxTest.COMP_LEVEL_MAX) { 10.81 + System.out.println("TieredStopAtLevel value (" + TIERED_STOP_AT_LEVEL + ") is too low, test SKIPPED"); 10.82 + return; 10.83 + } 10.84 + deoptimize(); 10.85 + compileAtLevelAndCheck(CompilerWhiteBoxTest.COMP_LEVEL_MAX); 10.86 + break; 10.87 + case "interpreted mode": // test is not applicable in this mode; 10.88 + System.err.println("Warning: This test is not applicable in mode: " + MODE); 10.89 + break; 10.90 + default: 10.91 + throw new AssertionError("Test bug, unknown VM mode: " + MODE); 10.92 + } 10.93 + } 10.94 + 10.95 + protected void compileAtLevelAndCheck(int level) { 10.96 + WHITE_BOX.enqueueMethodForCompilation(method, level); 10.97 + waitBackgroundCompilation(); 10.98 + checkCompilation(method, level); 10.99 + checkEmittedCode(method); 10.100 + } 10.101 + 10.102 + protected void checkCompilation(Executable executable, int level) { 10.103 + if (!WHITE_BOX.isMethodCompiled(executable)) { 10.104 + throw new AssertionError("Test bug, expected compilation (level): " + level + ", but not compiled" + WHITE_BOX.isMethodCompilable(executable, level)); 10.105 + } 10.106 + final int compilationLevel = WHITE_BOX.getMethodCompilationLevel(executable); 10.107 + if (compilationLevel != level) { 10.108 + throw new AssertionError("Test bug, expected compilation (level): " + level + ", but level: " + compilationLevel); 10.109 + } 10.110 + } 10.111 + 10.112 + protected void checkEmittedCode(Executable executable) { 10.113 + final byte[] nativeCode = NMethod.get(executable, false).insts; 10.114 + if (!((BmiTestCase) testCase).verifyPositive(nativeCode)) { 10.115 + throw new AssertionError(testCase.name() + "CPU instructions expected not found: " + Utils.toHexString(nativeCode)); 10.116 + } else { 10.117 + System.out.println("CPU instructions found, PASSED"); 10.118 + } 10.119 + } 10.120 + 10.121 + abstract static class BmiTestCase implements CompilerWhiteBoxTest.TestCase { 10.122 + private final Method method; 10.123 + protected byte[] instrMask; 10.124 + protected byte[] instrPattern; 10.125 + protected boolean isLongOperation; 10.126 + 10.127 + public BmiTestCase(Method method) { 10.128 + this.method = method; 10.129 + } 10.130 + 10.131 + @Override 10.132 + public String name() { 10.133 + return method.toGenericString(); 10.134 + } 10.135 + 10.136 + @Override 10.137 + public Executable getExecutable() { 10.138 + return method; 10.139 + } 10.140 + 10.141 + @Override 10.142 + public Callable<Integer> getCallable() { 10.143 + return null; 10.144 + } 10.145 + 10.146 + @Override 10.147 + public boolean isOsr() { 10.148 + return false; 10.149 + } 10.150 + 10.151 + protected int countCpuInstructions(byte[] nativeCode) { 10.152 + int count = 0; 10.153 + int patternSize = Math.min(instrMask.length, instrPattern.length); 10.154 + boolean found; 10.155 + Asserts.assertGreaterThan(patternSize, 0); 10.156 + for (int i = 0, n = nativeCode.length - patternSize; i < n; i++) { 10.157 + found = true; 10.158 + for (int j = 0; j < patternSize; j++) { 10.159 + if ((nativeCode[i + j] & instrMask[j]) != instrPattern[j]) { 10.160 + found = false; 10.161 + break; 10.162 + } 10.163 + } 10.164 + if (found) { 10.165 + ++count; 10.166 + i += patternSize - 1; 10.167 + } 10.168 + } 10.169 + return count; 10.170 + } 10.171 + 10.172 + public boolean verifyPositive(byte[] nativeCode) { 10.173 + final int cnt = countCpuInstructions(nativeCode); 10.174 + if (Platform.isX86()) { 10.175 + return cnt >= (isLongOperation ? 2 : 1); 10.176 + } else { 10.177 + return Platform.isX64() && cnt >= 1; 10.178 + } 10.179 + } 10.180 + 10.181 + protected String getCpuFlag() { 10.182 + return "bmi1"; 10.183 + } 10.184 + 10.185 + protected String getVMFlag() { 10.186 + return "UseBMI1Instructions"; 10.187 + } 10.188 + } 10.189 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java Fri Apr 11 00:34:51 2014 +0400 11.3 @@ -0,0 +1,59 @@ 11.4 +/* 11.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.7 + * 11.8 + * This code is free software; you can redistribute it and/or modify it 11.9 + * under the terms of the GNU General Public License version 2 only, as 11.10 + * published by the Free Software Foundation. 11.11 + * 11.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 11.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11.15 + * version 2 for more details (a copy is included in the LICENSE file that 11.16 + * accompanied this code). 11.17 + * 11.18 + * You should have received a copy of the GNU General Public License version 11.19 + * 2 along with this work; if not, write to the Free Software Foundation, 11.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 11.21 + * 11.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 11.23 + * or visit www.oracle.com if you need additional information or have any 11.24 + * questions. 11.25 + */ 11.26 + 11.27 +/* 11.28 + * @test 11.29 + * @bug 8031321 11.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. 11.31 + * @build LZcntTestI 11.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 11.33 + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI 11.34 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountLeadingZerosInstruction LZcntTestI 11.35 + */ 11.36 + 11.37 +import java.lang.reflect.Method; 11.38 + 11.39 +public class LZcntTestI extends BmiIntrinsicBase.BmiTestCase { 11.40 + 11.41 + protected LZcntTestI(Method method) { 11.42 + super(method); 11.43 + instrMask = new byte[]{(byte) 0xFF, (byte) 0xFF, (byte) 0xFF}; 11.44 + instrPattern = new byte[]{(byte) 0xF3, (byte) 0x0F, (byte) 0xBD}; 11.45 + } 11.46 + 11.47 + public static void main(String[] args) throws Exception { 11.48 + // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods 11.49 + System.out.println("class java.lang.Integer should be loaded. Proof: " + Integer.class); 11.50 + BmiIntrinsicBase.verifyTestCase(LZcntTestI::new, TestLzcntI.LzcntIExpr.class.getDeclaredMethods()); 11.51 + } 11.52 + 11.53 + @Override 11.54 + protected String getVMFlag() { 11.55 + return "UseCountLeadingZerosInstruction"; 11.56 + } 11.57 + 11.58 + @Override 11.59 + protected String getCpuFlag() { 11.60 + return "lzcnt"; 11.61 + } 11.62 +}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java Fri Apr 11 00:34:51 2014 +0400 12.3 @@ -0,0 +1,54 @@ 12.4 +/* 12.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 12.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.7 + * 12.8 + * This code is free software; you can redistribute it and/or modify it 12.9 + * under the terms of the GNU General Public License version 2 only, as 12.10 + * published by the Free Software Foundation. 12.11 + * 12.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 12.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12.15 + * version 2 for more details (a copy is included in the LICENSE file that 12.16 + * accompanied this code). 12.17 + * 12.18 + * You should have received a copy of the GNU General Public License version 12.19 + * 2 along with this work; if not, write to the Free Software Foundation, 12.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 12.21 + * 12.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 12.23 + * or visit www.oracle.com if you need additional information or have any 12.24 + * questions. 12.25 + */ 12.26 + 12.27 +/* 12.28 + * @test 12.29 + * @bug 8031321 12.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. 12.31 + * @build LZcntTestL 12.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 12.33 + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI 12.34 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountLeadingZerosInstruction LZcntTestL 12.35 + */ 12.36 + 12.37 +import com.oracle.java.testlibrary.Platform; 12.38 + 12.39 +import java.lang.reflect.Method; 12.40 + 12.41 +public class LZcntTestL extends LZcntTestI { 12.42 + 12.43 + protected LZcntTestL(Method method) { 12.44 + super(method); 12.45 + isLongOperation = true; 12.46 + if (Platform.isX64()) { 12.47 + instrMask = new byte[]{(byte) 0xFF, (byte) 0x00, (byte) 0xFF, (byte) 0xFF}; 12.48 + instrPattern = new byte[]{(byte) 0xF3, (byte) 0x00, (byte) 0x0F, (byte) 0xBD}; 12.49 + } 12.50 + } 12.51 + 12.52 + public static void main(String[] args) throws Exception { 12.53 + // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods 12.54 + System.out.println("classes java.lang.Long should be loaded. Proof: " + Long.class); 12.55 + BmiIntrinsicBase.verifyTestCase(LZcntTestL::new, TestLzcntL.LzcntLExpr.class.getDeclaredMethods()); 12.56 + } 12.57 +}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java Fri Apr 11 00:34:51 2014 +0400 13.3 @@ -0,0 +1,54 @@ 13.4 +/* 13.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 13.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.7 + * 13.8 + * This code is free software; you can redistribute it and/or modify it 13.9 + * under the terms of the GNU General Public License version 2 only, as 13.10 + * published by the Free Software Foundation. 13.11 + * 13.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 13.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13.15 + * version 2 for more details (a copy is included in the LICENSE file that 13.16 + * accompanied this code). 13.17 + * 13.18 + * You should have received a copy of the GNU General Public License version 13.19 + * 2 along with this work; if not, write to the Free Software Foundation, 13.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 13.21 + * 13.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 13.23 + * or visit www.oracle.com if you need additional information or have any 13.24 + * questions. 13.25 + */ 13.26 + 13.27 +/* 13.28 + * @test 13.29 + * @bug 8031321 13.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. 13.31 + * @build TZcntTestI 13.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 13.33 + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI 13.34 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountTrailingZerosInstruction TZcntTestI 13.35 + */ 13.36 + 13.37 +import java.lang.reflect.Method; 13.38 + 13.39 +public class TZcntTestI extends BmiIntrinsicBase.BmiTestCase { 13.40 + 13.41 + protected TZcntTestI(Method method) { 13.42 + super(method); 13.43 + instrMask = new byte[]{(byte) 0xFF, (byte) 0xFF, (byte) 0xFF}; 13.44 + instrPattern = new byte[]{(byte) 0xF3, (byte) 0x0F, (byte) 0xBC}; 13.45 + } 13.46 + 13.47 + public static void main(String[] args) throws Exception { 13.48 + // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods 13.49 + System.out.println("class java.lang.Integer should be loaded. Proof: " + Integer.class); 13.50 + BmiIntrinsicBase.verifyTestCase(TZcntTestI::new, TestTzcntI.TzcntIExpr.class.getDeclaredMethods()); 13.51 + } 13.52 + 13.53 + @Override 13.54 + protected String getVMFlag() { 13.55 + return "UseCountTrailingZerosInstruction"; 13.56 + } 13.57 +}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java Fri Apr 11 00:34:51 2014 +0400 14.3 @@ -0,0 +1,55 @@ 14.4 +/* 14.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 14.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.7 + * 14.8 + * This code is free software; you can redistribute it and/or modify it 14.9 + * under the terms of the GNU General Public License version 2 only, as 14.10 + * published by the Free Software Foundation. 14.11 + * 14.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 14.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14.15 + * version 2 for more details (a copy is included in the LICENSE file that 14.16 + * accompanied this code). 14.17 + * 14.18 + * You should have received a copy of the GNU General Public License version 14.19 + * 2 along with this work; if not, write to the Free Software Foundation, 14.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 14.21 + * 14.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 14.23 + * or visit www.oracle.com if you need additional information or have any 14.24 + * questions. 14.25 + */ 14.26 + 14.27 +/* 14.28 + * @test 14.29 + * @bug 8031321 14.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. 14.31 + * @build TZcntTestL 14.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 14.33 + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI 14.34 + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountTrailingZerosInstruction TZcntTestL 14.35 + */ 14.36 + 14.37 +import com.oracle.java.testlibrary.Platform; 14.38 + 14.39 +import java.lang.reflect.Method; 14.40 + 14.41 +public class TZcntTestL extends TZcntTestI { 14.42 + 14.43 + protected TZcntTestL(Method method) { 14.44 + super(method); 14.45 + isLongOperation = true; 14.46 + if (Platform.isX64()) { 14.47 + instrMask = new byte[]{(byte) 0xFF, (byte) 0x00, (byte) 0xFF, (byte) 0xFF}; 14.48 + instrPattern = new byte[]{(byte) 0xF3, (byte) 0x00, (byte) 0x0F, (byte) 0xBC}; 14.49 + } 14.50 + isLongOperation = true; 14.51 + } 14.52 + 14.53 + public static void main(String[] args) throws Exception { 14.54 + // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods 14.55 + System.out.println("classes java.lang.Long should be loaded. Proof: " + Long.class); 14.56 + BmiIntrinsicBase.verifyTestCase(TZcntTestL::new, TestTzcntL.TzcntLExpr.class.getDeclaredMethods()); 14.57 + } 14.58 +}
15.1 --- a/test/testlibrary/com/oracle/java/testlibrary/Utils.java Wed Apr 09 22:37:37 2014 +0400 15.2 +++ b/test/testlibrary/com/oracle/java/testlibrary/Utils.java Fri Apr 11 00:34:51 2014 +0400 15.3 @@ -294,4 +294,23 @@ 15.4 return output; 15.5 } 15.6 15.7 + private static final char[] hexArray = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; 15.8 + 15.9 + /** 15.10 + * Returns hex view of byte array 15.11 + * 15.12 + * @param bytes byte array to process 15.13 + * @return Space separated hexadecimal string representation of bytes 15.14 + */ 15.15 + 15.16 + public static String toHexString(byte[] bytes) { 15.17 + char[] hexView = new char[bytes.length * 3]; 15.18 + int i = 0; 15.19 + for (byte b : bytes) { 15.20 + hexView[i++] = hexArray[(b >> 4) & 0x0F]; 15.21 + hexView[i++] = hexArray[b & 0x0F]; 15.22 + hexView[i++] = ' '; 15.23 + } 15.24 + return new String(hexView); 15.25 + } 15.26 }