test/compiler/6832293/Test.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

kvn@1218 1 /*
trims@1907 2 * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
kvn@1218 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
kvn@1218 4 *
kvn@1218 5 * This code is free software; you can redistribute it and/or modify it
kvn@1218 6 * under the terms of the GNU General Public License version 2 only, as
kvn@1218 7 * published by the Free Software Foundation.
kvn@1218 8 *
kvn@1218 9 * This code is distributed in the hope that it will be useful, but WITHOUT
kvn@1218 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
kvn@1218 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kvn@1218 12 * version 2 for more details (a copy is included in the LICENSE file that
kvn@1218 13 * accompanied this code).
kvn@1218 14 *
kvn@1218 15 * You should have received a copy of the GNU General Public License version
kvn@1218 16 * 2 along with this work; if not, write to the Free Software Foundation,
kvn@1218 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
kvn@1218 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@1218 22 *
kvn@1218 23 */
kvn@1218 24
kvn@1218 25 /*
kvn@1218 26 * @test
kvn@1218 27 * @bug 6832293
kvn@1218 28 * @summary JIT compiler got wrong result in type checking with -server
kvn@1218 29 * @run main/othervm -Xcomp -XX:CompileOnly=Test.run Test
kvn@1218 30 */
kvn@1218 31
kvn@1218 32 import java.io.PrintStream;
kvn@1218 33
kvn@1218 34 interface SomeInterface {
kvn@1218 35 int SEVENS = 777;
kvn@1218 36 }
kvn@1218 37
kvn@1218 38 interface AnotherInterface {
kvn@1218 39 int THIRDS = 33;
kvn@1218 40 }
kvn@1218 41
kvn@1218 42 class SomeClass implements SomeInterface {
kvn@1218 43 int i;
kvn@1218 44
kvn@1218 45 SomeClass(int i) {
kvn@1218 46 this.i = i;
kvn@1218 47 }
kvn@1218 48 }
kvn@1218 49
kvn@1218 50 class ImmediateSubclass extends SomeClass implements SomeInterface {
kvn@1218 51 float f;
kvn@1218 52
kvn@1218 53 ImmediateSubclass(int i, float f) {
kvn@1218 54 super(i);
kvn@1218 55 this.f = f;
kvn@1218 56 }
kvn@1218 57 }
kvn@1218 58
kvn@1218 59 final class FinalSubclass extends ImmediateSubclass implements AnotherInterface {
kvn@1218 60 double d;
kvn@1218 61
kvn@1218 62 FinalSubclass(int i, float f, double d) {
kvn@1218 63 super(i, f);
kvn@1218 64 this.d = d;
kvn@1218 65 }
kvn@1218 66 }
kvn@1218 67
kvn@1218 68 public class Test {
kvn@1218 69
kvn@1218 70 public static void main(String args[]) throws Exception{
kvn@1218 71 /* try to pre initialize */
kvn@1218 72 SomeClass[] a=new SomeClass[10];
kvn@1218 73 Class.forName("ImmediateSubclass");
kvn@1218 74 Class.forName("FinalSubclass");
kvn@1218 75 System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
kvn@1218 76 }
kvn@1218 77
kvn@1218 78 static int errorStatus = 0/*STATUS_PASSED*/;
kvn@1218 79
kvn@1218 80 static void errorAlert(PrintStream out, int errorLevel) {
kvn@1218 81 out.println("Test: failure #" + errorLevel);
kvn@1218 82 errorStatus = 2/*STATUS_FAILED*/;
kvn@1218 83 }
kvn@1218 84
kvn@1218 85 static SomeClass[] v2 = new FinalSubclass[4];
kvn@1218 86
kvn@1218 87 public static int run(String args[],PrintStream out) {
kvn@1218 88 int i [], j [];
kvn@1218 89 SomeInterface u [], v[] [];
kvn@1218 90 AnotherInterface w [];
kvn@1218 91 SomeClass x [] [];
kvn@1218 92
kvn@1218 93 i = new int [10];
kvn@1218 94 i[0] = 777;
kvn@1218 95 j = (int []) i;
kvn@1218 96 if (j != i)
kvn@1218 97 errorAlert(out, 2);
kvn@1218 98 else if (j.length != 10)
kvn@1218 99 errorAlert(out, 3);
kvn@1218 100 else if (j[0] != 777)
kvn@1218 101 errorAlert(out, 4);
kvn@1218 102
kvn@1218 103 v = new SomeClass [3] [];
kvn@1218 104 x = (SomeClass [] []) v;
kvn@1218 105 if (! (x instanceof SomeInterface [] []))
kvn@1218 106 errorAlert(out, 5);
kvn@1218 107 else if (! (x instanceof SomeClass [] []))
kvn@1218 108 errorAlert(out, 6);
kvn@1218 109 else if (x != v)
kvn@1218 110 errorAlert(out, 7);
kvn@1218 111
kvn@1218 112 x[0] = (SomeClass []) new ImmediateSubclass [4];
kvn@1218 113 if (! (x[0] instanceof ImmediateSubclass []))
kvn@1218 114 errorAlert(out, 8);
kvn@1218 115 else if (x[0].length != 4)
kvn@1218 116 errorAlert(out, 9);
kvn@1218 117
kvn@1218 118 x[1] = (SomeClass []) v2;
kvn@1218 119 if (! (x[1] instanceof FinalSubclass []))
kvn@1218 120 errorAlert(out, 10);
kvn@1218 121 else if (x[1].length != 4)
kvn@1218 122 errorAlert(out, 11);
kvn@1218 123
kvn@1218 124 w = (AnotherInterface []) x[1];
kvn@1218 125 if (! (w instanceof FinalSubclass []))
kvn@1218 126 errorAlert(out, 12);
kvn@1218 127 else if (w != x[1])
kvn@1218 128 errorAlert(out, 13);
kvn@1218 129 else if (w.length != 4)
kvn@1218 130 errorAlert(out, 14);
kvn@1218 131
kvn@1218 132 return errorStatus;
kvn@1218 133 }
kvn@1218 134 }
kvn@1218 135

mercurial