test/hotspot/jtreg/compiler/c2/Test8004741.java
author stefank
Tue, 05 Jun 2018 15:56:21 +0200
changeset 50407 3dfdcca00ecc
parent 47576 7645833d326f
child 59116 8e7f29b1ad4a
permissions -rw-r--r--
8204168: Increase small heap sizes in tests to accommodate ZGC Reviewed-by: pliden, ehelin
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
/*
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
     2
 * Copyright (c) 2012, 2013, 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
/*
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    25
 * @test Test8004741.java
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
50407
3dfdcca00ecc 8204168: Increase small heap sizes in tests to accommodate ZGC
stefank
parents: 47576
diff changeset
    30
 * @run main/othervm -Xmx128m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 34254
diff changeset
    31
 *    -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 34254
diff changeset
    32
 *    -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 34254
diff changeset
    33
 *    compiler.c2.Test8004741
50407
3dfdcca00ecc 8204168: Increase small heap sizes in tests to accommodate ZGC
stefank
parents: 47576
diff changeset
    34
 * @run main/othervm -Xmx128m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 34254
diff changeset
    35
 *    -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 34254
diff changeset
    36
 *    compiler.c2.Test8004741
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    37
 */
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    38
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 34254
diff changeset
    39
package compiler.c2;
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    40
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    41
public class Test8004741 extends Thread {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    42
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    43
  static int passed = 0;
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    44
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    45
  /**
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    46
   * Loop forever allocating 2-d arrays.
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    47
   * 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
    48
   * 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
    49
   * 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
    50
   * likely that the test condition
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    51
   * (exception in 2-d array alloc interrupted by ThreadDeath)
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    52
   * actually occurs.
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    53
   */
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    54
  static int[][] test(int a, int b) throws Exception {
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    55
    int[][] ar;
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    56
    try {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    57
      ar = new int[a][b];
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    58
    } catch (ThreadDeath e) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    59
      System.out.println("test got ThreadDeath");
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    60
      passed++;
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    61
      throw(e);
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    62
    }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    63
    return ar;
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    64
  }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    65
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    66
  /* Cookbook wait-notify to track progress of test thread. */
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    67
  Object progressLock = new Object();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    68
  private static final int NOT_STARTED = 0;
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    69
  private static final int RUNNING = 1;
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    70
  private static final int STOPPING = 2;
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    71
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    72
  int progressState = NOT_STARTED;
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    73
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    74
  void toState(int state) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    75
    synchronized (progressLock) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    76
      progressState = state;
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    77
      progressLock.notify();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    78
    }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    79
  }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    80
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    81
  void waitFor(int state) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    82
    synchronized (progressLock) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    83
      while (progressState < state) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    84
        try {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    85
          progressLock.wait();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    86
        } catch (InterruptedException e) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    87
          e.printStackTrace();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    88
          System.out.println("unexpected InterruptedException");
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    89
          fail();
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    90
        }
15474
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
      if (progressState > state) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    93
        System.out.println("unexpected test state change, expected " +
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    94
                            state + " but saw " + progressState);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    95
        fail();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    96
      }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    97
    }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    98
  }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
    99
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
   * Loops running test until some sort of an exception or error,
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   102
   * expects to see ThreadDeath.
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
  public void run() {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   105
    try {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   106
      // Print before state change, so that other thread is most likely
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   107
      // to see this thread executing calls to test() in a loop.
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   108
      System.out.println("thread running");
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   109
      toState(RUNNING);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   110
      while (true) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   111
        // (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
   112
        test(2, 100);
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   113
      }
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   114
    } catch (ThreadDeath e) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   115
      // nothing to say, passing was incremented by the test.
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   116
    } catch (Throwable e) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   117
      e.printStackTrace();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   118
      System.out.println("unexpected Throwable " + e);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   119
      fail();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   120
    }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   121
    toState(STOPPING);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   122
  }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   123
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   124
  /**
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   125
   * Runs a single trial of the test in a thread.
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   126
   * No single trial is definitive, since the ThreadDeath
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   127
   * exception might not land in the tested region of code.
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
  public static void threadTest() throws InterruptedException {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   130
    Test8004741 t = new Test8004741();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   131
    t.start();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   132
    t.waitFor(RUNNING);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   133
    Thread.sleep(100);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   134
    System.out.println("stopping thread");
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   135
    t.stop();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   136
    t.waitFor(STOPPING);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   137
    t.join();
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   138
  }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   139
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   140
  public static void main(String[] args) throws Exception {
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   141
    // Warm up "test"
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   142
    // t will never be started.
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   143
    for (int n = 0; n < 11000; n++) {
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   144
      test(2, 100);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   145
    }
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   146
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   147
    // Will this sleep help ensure that the compiler is run?
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   148
    Thread.sleep(500);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   149
    passed = 0;
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
    try {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   152
      test(-1, 100);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   153
      System.out.println("Missing NegativeArraySizeException #1");
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   154
      fail();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   155
    } catch ( java.lang.NegativeArraySizeException e ) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   156
      System.out.println("Saw expected NegativeArraySizeException #1");
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   157
    }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   158
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   159
    try {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   160
      test(100, -1);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   161
      fail();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   162
      System.out.println("Missing NegativeArraySizeException #2");
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   163
      fail();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   164
    } catch ( java.lang.NegativeArraySizeException e ) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   165
      System.out.println("Saw expected NegativeArraySizeException #2");
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   166
    }
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   167
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   168
    /* Test repetitions.  If the test succeeds-mostly, it succeeds,
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   169
     * 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
   170
     * table entry for the array allocation is missing).
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   171
     */
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   172
    int N = 12;
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   173
    for (int n = 0; n < N; n++) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   174
      threadTest();
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   175
    }
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   176
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   177
    if (passed > N/2) {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   178
      System.out.println("Saw " + passed + " out of " + N + " possible ThreadDeath hits");
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   179
      System.out.println("PASSED");
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   180
    } else {
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   181
      System.out.println("Too few ThreadDeath hits; expected at least " + N/2 +
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   182
                         " but saw only " + passed);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   183
      fail();
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   184
    }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   185
  }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   186
15474
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   187
  static void fail() {
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   188
    System.out.println("FAILED");
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   189
    System.exit(97);
62425bb6b9e3 8006500: compiler/8004741/Test8004741.java fails intermediately
drchase
parents: 14835
diff changeset
   190
  }
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
   191
};