Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/stress/stack/stack001.java
41159 views
1
/*
2
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
* @test
26
* @key stress
27
*
28
* @summary converted from VM testbase nsk/stress/stack/stack001.
29
* VM testbase keywords: [stress, quick, stack, nonconcurrent]
30
* VM testbase readme:
31
* DESCRIPTION
32
* Provoke StackOverflowError by infinite recursion in Java method,
33
* intercept the exception try to make one more invocation.
34
* COMMENTS
35
* Kestrel for Solaris_JDK_1.3-b10 crashes while trying to execute
36
* this test with Client HS VM.
37
* See lots of bugs concerning similar failures:
38
* Evaluated:
39
* 4217960 [native stack overflow bug] reflection test causes crash
40
* Accepted:
41
* 4285716 native stack overflow causes crash on Solaris
42
* 4281578 Second stack overflow crashes HotSpot VM
43
* Closed (duplicate):
44
* 4027933 Native stack overflows not detected or handled correctly
45
* 4134353 (hpi) sysThreadCheckStack is a no-op on win32
46
* 4185411 Various crashes when using recursive reflection.
47
* 4167055 infinite recursion in FindClass
48
* 4222359 Infinite recursion crashes jvm
49
* Closed (will not fix):
50
* 4231968 StackOverflowError in a native method causes Segmentation Fault
51
* 4254634 println() while catching StackOverflowError causes hotspot VM crash
52
* 4302288 the second stack overflow causes Classic VM to exit on win32
53
*
54
* @requires vm.opt.DeoptimizeALot != true
55
* @run main/othervm/timeout=900 nsk.stress.stack.stack001
56
*/
57
58
package nsk.stress.stack;
59
60
61
import java.io.PrintStream;
62
63
public class stack001 {
64
public static void main(String[] args) {
65
int exitCode = run(args, System.out);
66
System.exit(exitCode + 95);
67
}
68
69
public static int run(String args[], PrintStream out) {
70
stack001 test = new stack001();
71
test.recurse(0);
72
out.println("Maximal depth: " + test.maxdepth);
73
return 0;
74
}
75
76
private int maxdepth;
77
78
private void recurse(int depth) {
79
maxdepth = depth;
80
try {
81
recurse(depth + 1);
82
} catch (Error error) {
83
if (!(error instanceof StackOverflowError) &&
84
!(error instanceof OutOfMemoryError))
85
throw error;
86
87
if (maxdepth == depth)
88
recurse(depth + 1);
89
}
90
}
91
}
92
93