test/hotspot/jtreg/compiler/c2/Test8004741.java
author iignatyev
Fri, 15 Nov 2019 14:22:24 -0800
changeset 59116 8e7f29b1ad4a
parent 50407 3dfdcca00ecc
permissions -rw-r--r--
8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5" Reviewed-by: kvn, epavlova
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     1
/*
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
     2
 * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     4
 *
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     7
 * published by the Free Software Foundation.
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     8
 *
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    13
 * accompanied this code).
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    14
 *
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    18
 *
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    21
 * questions.
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    22
 */
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    23
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    24
/*
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
    25
 * @test
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    26
 * @bug 8004741
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    27
 * @summary Missing compiled exception handle table entry for multidimensional array allocation
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 34254
diff changeset
    28
 *
47576
7645833d326f 8185134: [Graal] Introduce vm.graal predicate and tag tests which are not applicable for Graal
epavlova
parents: 47216
diff changeset
    29
 * @requires !vm.graal.enabled
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
    30
 * @library /test/lib
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
    31
 *
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
    32
 * @build sun.hotspot.WhiteBox
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
    33
 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
    34
 *                                sun.hotspot.WhiteBox$WhiteBoxPermission
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
    35
 *
50407
3dfdcca00ecc 8204168: Increase small heap sizes in tests to accommodate ZGC
stefank
parents: 47576
diff changeset
    36
 * @run main/othervm -Xmx128m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 34254
diff changeset
    37
 *    -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 34254
diff changeset
    38
 *    -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
    39
 *    -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 34254
diff changeset
    40
 *    compiler.c2.Test8004741
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
    41
 *
50407
3dfdcca00ecc 8204168: Increase small heap sizes in tests to accommodate ZGC
stefank
parents: 47576
diff changeset
    42
 * @run main/othervm -Xmx128m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 34254
diff changeset
    43
 *    -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
    44
 *    -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 34254
diff changeset
    45
 *    compiler.c2.Test8004741
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    46
 */
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    47
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 34254
diff changeset
    48
package compiler.c2;
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    49
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
    50
import sun.hotspot.WhiteBox;
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
    51
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    52
public class Test8004741 extends Thread {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    53
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    54
  static int passed = 0;
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    55
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    56
  /**
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    57
   * Loop forever allocating 2-d arrays.
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    58
   * Catches and rethrows all exceptions; in the case of ThreadDeath, increments passed.
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    59
   * Note that passed is incremented here because this is the exception handler with
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    60
   * the smallest scope; we only want to declare success in the case where it is highly
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    61
   * likely that the test condition
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    62
   * (exception in 2-d array alloc interrupted by ThreadDeath)
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    63
   * actually occurs.
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    64
   */
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    65
  static int[][] test(int a, int b) throws Exception {
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    66
    int[][] ar;
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    67
    try {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    68
      ar = new int[a][b];
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    69
    } catch (ThreadDeath e) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    70
      System.out.println("test got ThreadDeath");
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    71
      passed++;
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
    72
      throw e;
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    73
    }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    74
    return ar;
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    75
  }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    76
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    77
  /* Cookbook wait-notify to track progress of test thread. */
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    78
  Object progressLock = new Object();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    79
  private static final int NOT_STARTED = 0;
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    80
  private static final int RUNNING = 1;
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    81
  private static final int STOPPING = 2;
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    82
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    83
  int progressState = NOT_STARTED;
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    84
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    85
  void toState(int state) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    86
    synchronized (progressLock) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    87
      progressState = state;
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    88
      progressLock.notify();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    89
    }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    90
  }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    91
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    92
  void waitFor(int state) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    93
    synchronized (progressLock) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    94
      while (progressState < state) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    95
        try {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    96
          progressLock.wait();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    97
        } catch (InterruptedException e) {
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
    98
          throw new Error("unexpected InterruptedException", e);
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    99
        }
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   100
      }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   101
      if (progressState > state) {
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
   102
        throw new Error("unexpected test state change, state = " + state + ", progressState = " + progressState);
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   103
      }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   104
    }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   105
  }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   106
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   107
  /**
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   108
   * Loops running test until some sort of an exception or error,
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   109
   * expects to see ThreadDeath.
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   110
   */
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   111
  public void run() {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   112
    try {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   113
      // Print before state change, so that other thread is most likely
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   114
      // to see this thread executing calls to test() in a loop.
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   115
      System.out.println("thread running");
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   116
      toState(RUNNING);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   117
      while (true) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   118
        // (2,2) (2,10) (2,100) were observed to tickle the bug;
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   119
        test(2, 100);
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   120
      }
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   121
    } catch (ThreadDeath e) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   122
      // nothing to say, passing was incremented by the test.
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   123
    } catch (Throwable e) {
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
   124
      throw new Error("unexpected Throwable " + e, e);
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   125
    }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   126
    toState(STOPPING);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   127
  }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   128
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   129
  /**
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   130
   * Runs a single trial of the test in a thread.
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   131
   * No single trial is definitive, since the ThreadDeath
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   132
   * exception might not land in the tested region of code.
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   133
   */
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   134
  public static void threadTest() throws InterruptedException {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   135
    Test8004741 t = new Test8004741();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   136
    t.start();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   137
    t.waitFor(RUNNING);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   138
    Thread.sleep(100);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   139
    System.out.println("stopping thread");
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   140
    t.stop();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   141
    t.waitFor(STOPPING);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   142
    t.join();
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   143
  }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   144
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   145
  public static void main(String[] args) throws Exception {
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   146
    // Warm up "test"
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   147
    // t will never be started.
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   148
    for (int n = 0; n < 11000; n++) {
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   149
      test(2, 100);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   150
    }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   151
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
   152
    var method = Test8004741.class.getDeclaredMethod("test", int.class, int.class);
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
   153
    if (!WhiteBox.getWhiteBox().isMethodCompiled(method)) {
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
   154
        throw new Error("test method didn't get compiled");
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
   155
    }
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   156
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   157
    try {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   158
      test(-1, 100);
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
   159
      throw new AssertionError("Missing NegativeArraySizeException");
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
   160
    } catch (NegativeArraySizeException e) {
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   161
      System.out.println("Saw expected NegativeArraySizeException #1");
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   162
    }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   163
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   164
    try {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   165
      test(100, -1);
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
   166
      throw new AssertionError("Missing NegativeArraySizeException");
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
   167
    } catch (NegativeArraySizeException e) {
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   168
      System.out.println("Saw expected NegativeArraySizeException #2");
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   169
    }
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   170
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   171
    /* Test repetitions.  If the test succeeds-mostly, it succeeds,
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   172
     * as long as it does not crash (the outcome if the exception range
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   173
     * table entry for the array allocation is missing).
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   174
     */
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
   175
    passed = 0;
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
   176
    int limit = 6;
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
   177
    while (passed != limit) {
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   178
      threadTest();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   179
    }
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   180
  }
59116
8e7f29b1ad4a 8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"
iignatyev
parents: 50407
diff changeset
   181
}