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