test/compiler/5057225/Test5057225.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@1259 1 /*
trims@1907 2 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
twisti@1259 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
twisti@1259 4 *
twisti@1259 5 * This code is free software; you can redistribute it and/or modify it
twisti@1259 6 * under the terms of the GNU General Public License version 2 only, as
twisti@1259 7 * published by the Free Software Foundation.
twisti@1259 8 *
twisti@1259 9 * This code is distributed in the hope that it will be useful, but WITHOUT
twisti@1259 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
twisti@1259 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
twisti@1259 12 * version 2 for more details (a copy is included in the LICENSE file that
twisti@1259 13 * accompanied this code).
twisti@1259 14 *
twisti@1259 15 * You should have received a copy of the GNU General Public License version
twisti@1259 16 * 2 along with this work; if not, write to the Free Software Foundation,
twisti@1259 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
twisti@1259 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@1259 22 */
twisti@1259 23
twisti@1259 24 /**
twisti@1259 25 * @test
twisti@1259 26 * @bug 5057225
twisti@1259 27 * @summary Remove useless I2L conversions
twisti@1259 28 *
twisti@1259 29 * @run main/othervm -Xcomp -XX:CompileOnly=Test5057225.doload Test5057225
twisti@1259 30 */
twisti@1259 31
twisti@1259 32 import java.net.URLClassLoader;
twisti@1259 33
twisti@1259 34 public class Test5057225 {
twisti@1259 35 static byte[] ba = new byte[] { -1 };
twisti@1259 36 static short[] sa = new short[] { -1 };
twisti@1259 37 static int[] ia = new int[] { -1 };
twisti@1259 38
twisti@1259 39 static final long[] BYTE_MASKS = {
twisti@1259 40 0x0FL,
twisti@1259 41 0x7FL, // 7-bit
twisti@1259 42 0xFFL,
twisti@1259 43 };
twisti@1259 44
twisti@1259 45 static final long[] SHORT_MASKS = {
twisti@1259 46 0x000FL,
twisti@1259 47 0x007FL, // 7-bit
twisti@1259 48 0x00FFL,
twisti@1259 49 0x0FFFL,
twisti@1259 50 0x3FFFL, // 14-bit
twisti@1259 51 0x7FFFL, // 15-bit
twisti@1259 52 0xFFFFL,
twisti@1259 53 };
twisti@1259 54
twisti@1259 55 static final long[] INT_MASKS = {
twisti@1259 56 0x0000000FL,
twisti@1259 57 0x0000007FL, // 7-bit
twisti@1259 58 0x000000FFL,
twisti@1259 59 0x00000FFFL,
twisti@1259 60 0x00003FFFL, // 14-bit
twisti@1259 61 0x00007FFFL, // 15-bit
twisti@1259 62 0x0000FFFFL,
twisti@1259 63 0x00FFFFFFL,
twisti@1259 64 0x7FFFFFFFL, // 31-bit
twisti@1259 65 0xFFFFFFFFL,
twisti@1259 66 };
twisti@1259 67
twisti@1259 68 public static void main(String[] args) throws Exception {
twisti@1259 69 for (int i = 0; i < BYTE_MASKS.length; i++) {
twisti@1259 70 System.setProperty("value", "" + BYTE_MASKS[i]);
twisti@1259 71 loadAndRunClass("Test5057225$loadUB2L");
twisti@1259 72 }
twisti@1259 73
twisti@1259 74 for (int i = 0; i < SHORT_MASKS.length; i++) {
twisti@1259 75 System.setProperty("value", "" + SHORT_MASKS[i]);
twisti@1259 76 loadAndRunClass("Test5057225$loadUS2L");
twisti@1259 77 }
twisti@1259 78
twisti@1259 79 for (int i = 0; i < INT_MASKS.length; i++) {
twisti@1259 80 System.setProperty("value", "" + INT_MASKS[i]);
twisti@1259 81 loadAndRunClass("Test5057225$loadUI2L");
twisti@1259 82 }
twisti@1259 83 }
twisti@1259 84
twisti@1259 85 static void check(long result, long expected) {
twisti@1259 86 if (result != expected)
twisti@1259 87 throw new InternalError(result + " != " + expected);
twisti@1259 88 }
twisti@1259 89
twisti@1259 90 static void loadAndRunClass(String classname) throws Exception {
twisti@1259 91 Class cl = Class.forName(classname);
twisti@1259 92 URLClassLoader apploader = (URLClassLoader) cl.getClassLoader();
twisti@1259 93 ClassLoader loader = new URLClassLoader(apploader.getURLs(), apploader.getParent());
twisti@1259 94 Class c = loader.loadClass(classname);
twisti@1259 95 Runnable r = (Runnable) c.newInstance();
twisti@1259 96 r.run();
twisti@1259 97 }
twisti@1259 98
twisti@1259 99 public static class loadUB2L implements Runnable {
twisti@1259 100 static final long MASK;
twisti@1259 101 static {
twisti@1259 102 long value = 0;
twisti@1259 103 try {
twisti@1259 104 value = Long.decode(System.getProperty("value"));
twisti@1259 105 } catch (Throwable e) {}
twisti@1259 106 MASK = value;
twisti@1259 107 }
twisti@1259 108
twisti@1259 109 public void run() { check(doload(ba), MASK); }
twisti@1259 110 static long doload(byte[] ba) { return ba[0] & MASK; }
twisti@1259 111 }
twisti@1259 112
twisti@1259 113 public static class loadUS2L implements Runnable {
twisti@1259 114 static final long MASK;
twisti@1259 115 static {
twisti@1259 116 long value = 0;
twisti@1259 117 try {
twisti@1259 118 value = Long.decode(System.getProperty("value"));
twisti@1259 119 } catch (Throwable e) {}
twisti@1259 120 MASK = value;
twisti@1259 121 }
twisti@1259 122
twisti@1259 123 public void run() { check(doload(sa), MASK); }
twisti@1259 124 static long doload(short[] sa) { return sa[0] & MASK; }
twisti@1259 125 }
twisti@1259 126
twisti@1259 127 public static class loadUI2L implements Runnable {
twisti@1259 128 static final long MASK;
twisti@1259 129 static {
twisti@1259 130 long value = 0;
twisti@1259 131 try {
twisti@1259 132 value = Long.decode(System.getProperty("value"));
twisti@1259 133 } catch (Throwable e) {}
twisti@1259 134 MASK = value;
twisti@1259 135 }
twisti@1259 136
twisti@1259 137 public void run() { check(doload(ia), MASK); }
twisti@1259 138 static long doload(int[] ia) { return ia[0] & MASK; }
twisti@1259 139 }
twisti@1259 140 }

mercurial