test/compiler/6378821/Test6378821.java

Mon, 28 Jul 2014 15:06:38 -0700

author
fzhinkin
date
Mon, 28 Jul 2014 15:06:38 -0700
changeset 6997
dbb05f6d93c4
parent 1907
c18cbe5936b8
child 6876
710a3c8b516e
permissions
-rw-r--r--

8051344: JVM crashed in Compile::start() during method parsing w/ UseRTMDeopt turned on
Summary: call rtm_deopt() only if there were no compilation bailouts before.
Reviewed-by: kvn

twisti@1078 1 /*
trims@1907 2 * Copyright (c) 2009, Oracle and/or its affiliates. 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 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * 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 }

mercurial