test/compiler/6636138/Test2.java

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

author
fzhinkin
date
Mon, 28 Jul 2014 15:06:38 -0700
changeset 6997
dbb05f6d93c4
parent 6198
55fb97c4c58d
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

cfang@1102 1 /*
mikael@6198 2 * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
cfang@1102 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cfang@1102 4 *
cfang@1102 5 * This code is free software; you can redistribute it and/or modify it
cfang@1102 6 * under the terms of the GNU General Public License version 2 only, as
cfang@1102 7 * published by the Free Software Foundation.
cfang@1102 8 *
cfang@1102 9 * This code is distributed in the hope that it will be useful, but WITHOUT
cfang@1102 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cfang@1102 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
cfang@1102 12 * version 2 for more details (a copy is included in the LICENSE file that
cfang@1102 13 * accompanied this code).
cfang@1102 14 *
cfang@1102 15 * You should have received a copy of the GNU General Public License version
cfang@1102 16 * 2 along with this work; if not, write to the Free Software Foundation,
cfang@1102 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cfang@1102 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.
cfang@1102 22 */
cfang@1102 23
cfang@1102 24 /**
cfang@1102 25 * @test
cfang@1102 26 * @bug 6636138
cfang@1102 27 * @summary SuperWord::co_locate_pack(Node_List* p) generates memory graph that leads to memory order violation.
cfang@1102 28 *
collins@4684 29 * @run main/othervm -Xbatch -XX:CompileOnly=Test2.shift Test2
cfang@1102 30 */
cfang@1102 31
twisti@1212 32 public class Test2 {
cfang@1102 33
cfang@1102 34 public static void init(int src[]) {
cfang@1102 35 // Initialize the array
cfang@1102 36 for (int i = 0; i < src.length; i++)
cfang@1102 37 src[i] = i;
cfang@1102 38 }
cfang@1102 39
cfang@1102 40 public static void shift(int src[]) {
cfang@1102 41 //left-shift the array
cfang@1102 42 for (int i = src.length-1; i > 0; i--){
cfang@1102 43 int tmp = src[i];
cfang@1102 44 src[i] = src[i-1];
cfang@1102 45 src[i-1] = tmp;
cfang@1102 46 }
cfang@1102 47 }
cfang@1102 48
cfang@1102 49 public static void verify(int src[]) {
cfang@1102 50 for (int i = 0; i < src.length; i++){
cfang@1102 51 int value = (i-1 + src.length)%src.length; // correct value after shifting
cfang@1102 52 if (src[i] != value) {
cfang@1102 53 System.out.println("Error: src["+i+"] should be "+ value + " instead of " + src[i]);
cfang@1387 54 System.exit(97);
cfang@1102 55 }
cfang@1102 56 }
cfang@1102 57 }
cfang@1102 58
cfang@1102 59 public static void test() {
cfang@1102 60 int[] src = new int[10];
cfang@1102 61 init(src);
cfang@1102 62 shift(src);
cfang@1102 63 verify(src);
cfang@1102 64 }
cfang@1102 65
cfang@1102 66 public static void main(String[] args) {
cfang@1102 67 for (int i=0; i< 2000; i++)
cfang@1102 68 test();
cfang@1102 69 }
cfang@1102 70 }

mercurial