test/compiler/6865265/StackOverflowBug.java

Wed, 22 Jan 2014 12:37:28 -0800

author
katleman
date
Wed, 22 Jan 2014 12:37:28 -0800
changeset 6575
2bac854670c0
parent 4311
7cc69864a29b
child 6876
710a3c8b516e
permissions
-rw-r--r--

Added tag jdk8u5-b05 for changeset b90de55aca30

kvn@3194 1 /*
kvn@3194 2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
kvn@3194 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
kvn@3194 4 *
kvn@3194 5 * This code is free software; you can redistribute it and/or modify it
kvn@3194 6 * under the terms of the GNU General Public License version 2 only, as
kvn@3194 7 * published by the Free Software Foundation.
kvn@3194 8 *
kvn@3194 9 * This code is distributed in the hope that it will be useful, but WITHOUT
kvn@3194 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
kvn@3194 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kvn@3194 12 * version 2 for more details (a copy is included in the LICENSE file that
kvn@3194 13 * accompanied this code).
kvn@3194 14 *
kvn@3194 15 * You should have received a copy of the GNU General Public License version
kvn@3194 16 * 2 along with this work; if not, write to the Free Software Foundation,
kvn@3194 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
kvn@3194 18 *
kvn@3194 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
kvn@3194 20 * or visit www.oracle.com if you need additional information or have any
kvn@3194 21 * questions.
kvn@3194 22 *
kvn@3194 23 */
kvn@3194 24
kvn@3194 25 /**
kvn@3194 26 * @test
kvn@3194 27 * @bug 6865265
kvn@3194 28 * @summary JVM crashes with "missing exception handler" error
kvn@3194 29 * @author volker.simonis@sap.com
kvn@3194 30 *
kvn@4311 31 * @run main/othervm -XX:CompileThreshold=100 -Xbatch -Xss248k StackOverflowBug
kvn@3194 32 */
kvn@3194 33
kvn@3194 34
kvn@3194 35 public class StackOverflowBug {
kvn@3194 36
kvn@3194 37 public static int run() {
kvn@3194 38 try {
kvn@3194 39 try {
kvn@3194 40 return run();
kvn@3194 41 } catch (Throwable e) {
kvn@3194 42 // Notice that the class 'Throwable' is NOT resolved by the verifier,
kvn@3194 43 // because the verifier only checks if 'Throwable' is assignable to
kvn@3194 44 // 'java.lang.Throwable' and this check succeeds immediately if the two
kvn@3194 45 // types have equal names (see 'VerificationType::is_assignable_from' which
kvn@3194 46 // is called from 'ClassVerifier::verify_exception_handler_table').
kvn@3194 47 // This is strange, because if the two classes have different names,
kvn@3194 48 // 'is_assignable_from()' calls 'is_reference_assignable_from()' which resolves
kvn@3194 49 // both classes by calling 'SystemDictionary::resolve_or_fail()'. This call
kvn@3194 50 // also takes into account the current class loader (i.e. the one which was used
kvn@3194 51 // to load this class) and would place a corresponding
kvn@3194 52 // "java.lang.Throwable / current-Classloader" entry into the system dictionary.
kvn@3194 53 // This would in turn allow C2 to see 'java.lang.Throwable' as "loaded"
kvn@3194 54 // (see 'Parse::catch_inline_exceptions()') when this method is compiled.
kvn@3194 55 return 42;
kvn@3194 56 }
kvn@3194 57 }
kvn@3194 58 finally {
kvn@3194 59 }
kvn@3194 60 }
kvn@3194 61
kvn@3194 62 public static void main(String argv[]) {
kvn@3194 63 run();
kvn@3194 64 }
kvn@3194 65 }
kvn@3194 66
kvn@3194 67 /*
kvn@3194 68 public static int run();
kvn@3194 69 Code:
kvn@3194 70 0: invokestatic #2 // Method run:()I
kvn@3194 71 3: istore_0
kvn@3194 72 4: iload_0
kvn@3194 73 5: ireturn
kvn@3194 74 6: astore_0
kvn@3194 75 7: bipush 42
kvn@3194 76 9: istore_1
kvn@3194 77 10: iload_1
kvn@3194 78 11: ireturn
kvn@3194 79 12: astore_2
kvn@3194 80 13: aload_2
kvn@3194 81 14: athrow
kvn@3194 82 Exception table:
kvn@3194 83 from to target type
kvn@3194 84 0 4 6 Class java/lang/Throwable
kvn@3194 85 0 4 12 any
kvn@3194 86 6 10 12 any
kvn@3194 87 12 13 12 any
kvn@3194 88
kvn@3194 89 */

mercurial