Fri, 08 May 2009 15:16:38 -0700
6839151: Add a JPRT default test of -Xshare:dump when new hotspot is built
Reviewed-by: never, kvn
twisti@1078 | 1 | /* |
twisti@1078 | 2 | * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. |
twisti@1078 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
twisti@1078 | 4 | * |
twisti@1078 | 5 | * This code is free software; you can redistribute it and/or modify it |
twisti@1078 | 6 | * under the terms of the GNU General Public License version 2 only, as |
twisti@1078 | 7 | * published by the Free Software Foundation. |
twisti@1078 | 8 | * |
twisti@1078 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
twisti@1078 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
twisti@1078 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
twisti@1078 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
twisti@1078 | 13 | * accompanied this code). |
twisti@1078 | 14 | * |
twisti@1078 | 15 | * You should have received a copy of the GNU General Public License version |
twisti@1078 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
twisti@1078 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
twisti@1078 | 18 | * |
twisti@1078 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
twisti@1078 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
twisti@1078 | 21 | * have any questions. |
twisti@1078 | 22 | */ |
twisti@1078 | 23 | |
twisti@1078 | 24 | /** |
twisti@1078 | 25 | * @test |
twisti@1078 | 26 | * @bug 6378821 |
twisti@1078 | 27 | * @summary where available, bitCount() should use POPC on SPARC processors and AMD+10h |
twisti@1078 | 28 | * |
twisti@1078 | 29 | * @run main/othervm -Xcomp -XX:CompileOnly=Test6378821.fcomp Test6378821 |
twisti@1078 | 30 | */ |
twisti@1078 | 31 | |
twisti@1078 | 32 | public class Test6378821 { |
twisti@1078 | 33 | static final int[] ia = new int[] { 0x12345678 }; |
twisti@1078 | 34 | static final long[] la = new long[] { 0x12345678abcdefL }; |
twisti@1078 | 35 | |
twisti@1078 | 36 | public static void main(String [] args) { |
twisti@1078 | 37 | // Resolve the class and the method. |
twisti@1078 | 38 | Integer.bitCount(1); |
twisti@1078 | 39 | Long.bitCount(1); |
twisti@1078 | 40 | |
twisti@1078 | 41 | sub(ia[0]); |
twisti@1078 | 42 | sub(la[0]); |
twisti@1078 | 43 | sub(ia); |
twisti@1078 | 44 | sub(la); |
twisti@1078 | 45 | } |
twisti@1078 | 46 | |
twisti@1078 | 47 | static void check(int i, int expected, int result) { |
twisti@1078 | 48 | if (result != expected) { |
twisti@1078 | 49 | throw new InternalError("Wrong population count for " + i + ": " + result + " != " + expected); |
twisti@1078 | 50 | } |
twisti@1078 | 51 | } |
twisti@1078 | 52 | |
twisti@1078 | 53 | static void check(long l, int expected, int result) { |
twisti@1078 | 54 | if (result != expected) { |
twisti@1078 | 55 | throw new InternalError("Wrong population count for " + l + ": " + result + " != " + expected); |
twisti@1078 | 56 | } |
twisti@1078 | 57 | } |
twisti@1078 | 58 | |
twisti@1078 | 59 | static void sub(int i) { check(i, fint(i), fcomp(i) ); } |
twisti@1078 | 60 | static void sub(int[] ia) { check(ia[0], fint(ia), fcomp(ia)); } |
twisti@1078 | 61 | static void sub(long l) { check(l, fint(l), fcomp(l) ); } |
twisti@1078 | 62 | static void sub(long[] la) { check(la[0], fint(la), fcomp(la)); } |
twisti@1078 | 63 | |
twisti@1078 | 64 | static int fint (int i) { return Integer.bitCount(i); } |
twisti@1078 | 65 | static int fcomp(int i) { return Integer.bitCount(i); } |
twisti@1078 | 66 | |
twisti@1078 | 67 | static int fint (int[] ia) { return Integer.bitCount(ia[0]); } |
twisti@1078 | 68 | static int fcomp(int[] ia) { return Integer.bitCount(ia[0]); } |
twisti@1078 | 69 | |
twisti@1078 | 70 | static int fint (long l) { return Long.bitCount(l); } |
twisti@1078 | 71 | static int fcomp(long l) { return Long.bitCount(l); } |
twisti@1078 | 72 | |
twisti@1078 | 73 | static int fint (long[] la) { return Long.bitCount(la[0]); } |
twisti@1078 | 74 | static int fcomp(long[] la) { return Long.bitCount(la[0]); } |
twisti@1078 | 75 | } |