author | lmesnik |
Thu, 12 Jul 2018 13:32:45 -0700 | |
changeset 51048 | 5c58b4c10fbd |
parent 50169 | dd501973095c |
child 51283 | ac4f5ef0edd9 |
permissions | -rw-r--r-- |
50169
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
1 |
/* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
2 |
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
4 |
* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
8 |
* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
13 |
* accompanied this code). |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
14 |
* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
18 |
* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
21 |
* questions. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
22 |
*/ |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
23 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
24 |
/* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
25 |
* @test |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
26 |
* @key stress |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
27 |
* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
28 |
* @summary converted from VM testbase nsk/stress/stack/stack006. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
29 |
* VM testbase keywords: [stress, stack, nonconcurrent] |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
30 |
* VM testbase readme: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
31 |
* DESCRIPTION |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
32 |
* This test provokes multiple stack overflows in the same thread |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
33 |
* by invoking virtual recursive method for the given fixed depth |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
34 |
* of recursion (though, for a large depth). |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
35 |
* This test makes measures a number of recursive invocations |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
36 |
* before 1st StackOverflowError, and then tries to reproduce |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
37 |
* such StackOverflowError 100 times -- each time by trying to |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
38 |
* invoke the same recursive method for the given fixed depth |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
39 |
* of invocations (which is twice that depth just measured). |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
40 |
* The test is deemed passed, if VM have not crashed. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
41 |
* COMMENTS |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
42 |
* This test crashes all HS versions (2.0, 1.3, 1.4) on all |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
43 |
* platforms (Win32, Solaris, Linux) in all execution modes |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
44 |
* (-Xint, -Xmixed, -Xcomp) in 100% of executions in which |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
45 |
* I had tryied it. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
46 |
* See the bug: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
47 |
* 4366625 (P4/S4) multiple stack overflow causes HS crash |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
48 |
* |
51048
5c58b4c10fbd
8139876: Exclude hanging nsk/stress/stack from execution with deoptimization enabled
lmesnik
parents:
50169
diff
changeset
|
49 |
* @requires vm.opt.DeoptimizeALot == null | vm.opt.DeoptimizeALot == false |
50169
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
50 |
* @run main/othervm nsk.stress.stack.stack006 |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
51 |
*/ |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
52 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
53 |
package nsk.stress.stack; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
54 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
55 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
56 |
import java.io.PrintStream; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
57 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
58 |
public class stack006 implements stack006i { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
59 |
public static void main(String[] args) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
60 |
int exitCode = run(args, System.out); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
61 |
System.exit(exitCode + 95); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
62 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
63 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
64 |
public static int run(String args[], PrintStream out) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
65 |
stack006i test = new stack006(); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
66 |
int depth; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
67 |
for (depth = 100; ; depth += 100) |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
68 |
try { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
69 |
test.recurse(depth); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
70 |
} catch (StackOverflowError soe) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
71 |
break; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
72 |
} catch (OutOfMemoryError oome) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
73 |
break; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
74 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
75 |
out.println("Max. depth: " + depth); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
76 |
for (int i = 0; i < 100; i++) |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
77 |
try { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
78 |
test.recurse(2 * depth); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
79 |
out.println("?"); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
80 |
} catch (StackOverflowError soe) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
81 |
// OK. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
82 |
} catch (OutOfMemoryError oome) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
83 |
// Also OK. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
84 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
85 |
return 0; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
86 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
87 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
88 |
public void recurse(int depth) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
89 |
if (depth > 0) |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
90 |
recurse(depth - 1); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
91 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
92 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
93 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
94 |
interface stack006i { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
95 |
void recurse(int depth); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
96 |
} |