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
twisti@1003 | 1 | /* |
trims@1907 | 2 | * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
twisti@1003 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
twisti@1003 | 4 | * |
twisti@1003 | 5 | * This code is free software; you can redistribute it and/or modify it |
twisti@1003 | 6 | * under the terms of the GNU General Public License version 2 only, as |
twisti@1003 | 7 | * published by the Free Software Foundation. |
twisti@1003 | 8 | * |
twisti@1003 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
twisti@1003 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
twisti@1003 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
twisti@1003 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
twisti@1003 | 13 | * accompanied this code). |
twisti@1003 | 14 | * |
twisti@1003 | 15 | * You should have received a copy of the GNU General Public License version |
twisti@1003 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
twisti@1003 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
twisti@1003 | 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@1003 | 22 | */ |
twisti@1003 | 23 | |
twisti@1003 | 24 | /** |
twisti@1003 | 25 | * @test |
twisti@1003 | 26 | * @bug 6805724 |
twisti@1003 | 27 | * @summary ModLNode::Ideal() generates functionally incorrect graph when divisor is any (2^k-1) constant. |
twisti@1003 | 28 | * |
twisti@1003 | 29 | * @run main/othervm -Xcomp -XX:CompileOnly=Test6805724.fcomp Test6805724 |
twisti@1003 | 30 | */ |
twisti@1003 | 31 | |
twisti@1003 | 32 | import java.net.URLClassLoader; |
twisti@1003 | 33 | |
twisti@1003 | 34 | public class Test6805724 implements Runnable { |
twisti@1003 | 35 | // Initialize DIVISOR so that it is final in this class. |
twisti@1003 | 36 | static final long DIVISOR; // 2^k-1 constant |
twisti@1003 | 37 | |
twisti@1003 | 38 | static { |
twisti@1003 | 39 | long value = 0; |
twisti@1003 | 40 | try { |
twisti@1003 | 41 | value = Long.decode(System.getProperty("divisor")); |
twisti@1003 | 42 | } catch (Throwable t) { |
twisti@1003 | 43 | // This one is required for the Class.forName() in main. |
twisti@1003 | 44 | } |
twisti@1003 | 45 | DIVISOR = value; |
twisti@1003 | 46 | } |
twisti@1003 | 47 | |
twisti@1003 | 48 | static long fint(long x) { |
twisti@1003 | 49 | return x % DIVISOR; |
twisti@1003 | 50 | } |
twisti@1003 | 51 | |
twisti@1003 | 52 | static long fcomp(long x) { |
twisti@1003 | 53 | return x % DIVISOR; |
twisti@1003 | 54 | } |
twisti@1003 | 55 | |
twisti@1003 | 56 | public void run() { |
twisti@1003 | 57 | long a = 0x617981E1L; |
twisti@1003 | 58 | |
twisti@1003 | 59 | long expected = fint(a); |
twisti@1003 | 60 | long result = fcomp(a); |
twisti@1003 | 61 | |
twisti@1003 | 62 | if (result != expected) |
twisti@1003 | 63 | throw new InternalError(result + " != " + expected); |
twisti@1003 | 64 | } |
twisti@1003 | 65 | |
twisti@1003 | 66 | public static void main(String args[]) throws Exception { |
twisti@1003 | 67 | Class cl = Class.forName("Test6805724"); |
twisti@1003 | 68 | URLClassLoader apploader = (URLClassLoader) cl.getClassLoader(); |
twisti@1003 | 69 | |
twisti@1003 | 70 | // Iterate over all 2^k-1 divisors. |
twisti@1003 | 71 | for (int k = 1; k < Long.SIZE; k++) { |
twisti@1003 | 72 | long divisor = (1L << k) - 1; |
twisti@1003 | 73 | System.setProperty("divisor", "" + divisor); |
twisti@1003 | 74 | ClassLoader loader = new URLClassLoader(apploader.getURLs(), apploader.getParent()); |
twisti@1003 | 75 | Class c = loader.loadClass("Test6805724"); |
twisti@1003 | 76 | Runnable r = (Runnable) c.newInstance(); |
twisti@1003 | 77 | r.run(); |
twisti@1003 | 78 | } |
twisti@1003 | 79 | } |
twisti@1003 | 80 | } |