Mon, 28 Jul 2014 15:06:38 -0700
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
kvn@682 | 1 | /* |
trims@1907 | 2 | * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. |
kvn@682 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
kvn@682 | 4 | * |
kvn@682 | 5 | * This code is free software; you can redistribute it and/or modify it |
kvn@682 | 6 | * under the terms of the GNU General Public License version 2 only, as |
kvn@682 | 7 | * published by the Free Software Foundation. |
kvn@682 | 8 | * |
kvn@682 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
kvn@682 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
kvn@682 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
kvn@682 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
kvn@682 | 13 | * accompanied this code). |
kvn@682 | 14 | * |
kvn@682 | 15 | * You should have received a copy of the GNU General Public License version |
kvn@682 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
kvn@682 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
kvn@682 | 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. |
kvn@682 | 22 | */ |
kvn@682 | 23 | |
kvn@682 | 24 | /* |
kvn@682 | 25 | * @test |
kvn@682 | 26 | * @bug 6724218 |
kvn@682 | 27 | * @summary Fix raise_LCA_above_marks() early termination |
kvn@682 | 28 | * @run main/othervm -Xbatch -XX:CompileCommand=exclude,Test.update Test |
kvn@682 | 29 | */ |
kvn@682 | 30 | |
kvn@682 | 31 | public class Test { |
kvn@682 | 32 | Test next = null; |
kvn@682 | 33 | Object value = null; |
kvn@682 | 34 | |
kvn@682 | 35 | static boolean _closed = false; |
kvn@682 | 36 | static int size = 0; |
kvn@682 | 37 | static Test list = null; |
kvn@682 | 38 | static int cache_size = 0; |
kvn@682 | 39 | static Test cache = null; |
kvn@682 | 40 | |
kvn@682 | 41 | Object get(int i) { |
kvn@682 | 42 | Test t = list; |
kvn@682 | 43 | list = t.next; |
kvn@682 | 44 | size -= 1; |
kvn@682 | 45 | Object o = t.value; |
kvn@682 | 46 | if (i > 0) { |
kvn@682 | 47 | t.next = cache; |
kvn@682 | 48 | t.value = null; |
kvn@682 | 49 | cache = t; |
kvn@682 | 50 | cache_size = +1; |
kvn@682 | 51 | } |
kvn@682 | 52 | return o; |
kvn@682 | 53 | } |
kvn@682 | 54 | |
kvn@682 | 55 | void update() { |
kvn@682 | 56 | // Exclude compilation of this one. |
kvn@682 | 57 | if (size == 0) { |
kvn@682 | 58 | Test t; |
kvn@682 | 59 | if (cache_size > 0) { |
kvn@682 | 60 | t = cache; |
kvn@682 | 61 | cache = t.next; |
kvn@682 | 62 | cache_size = -1; |
kvn@682 | 63 | } else { |
kvn@682 | 64 | t = new Test(); |
kvn@682 | 65 | } |
kvn@682 | 66 | t.value = new Object(); |
kvn@682 | 67 | t.next = list; |
kvn@682 | 68 | list = t; |
kvn@682 | 69 | size += 1; |
kvn@682 | 70 | } |
kvn@682 | 71 | } |
kvn@682 | 72 | |
kvn@682 | 73 | synchronized Object test(int i) { |
kvn@682 | 74 | while (true) { |
kvn@682 | 75 | if (_closed) { |
kvn@682 | 76 | return null; |
kvn@682 | 77 | } else if (size > 0) { |
kvn@682 | 78 | return get(i); |
kvn@682 | 79 | } |
kvn@682 | 80 | update(); |
kvn@682 | 81 | } |
kvn@682 | 82 | } |
kvn@682 | 83 | |
kvn@682 | 84 | public static void main(String argv[]) throws Exception { |
kvn@682 | 85 | Test t = new Test(); |
kvn@682 | 86 | int lim = 500000; |
kvn@682 | 87 | Object o; |
kvn@682 | 88 | for (int j = 0; j < lim; j++) { |
kvn@682 | 89 | o = t.test(j&1); |
kvn@682 | 90 | if (o == null) { |
kvn@682 | 91 | throw new Exception("*** Failed on iteration " + j); |
kvn@682 | 92 | } |
kvn@682 | 93 | if ((j&1) == 0) { |
kvn@682 | 94 | t.update(); |
kvn@682 | 95 | } |
kvn@682 | 96 | } |
kvn@682 | 97 | } |
kvn@682 | 98 | } |