Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/com/sun/jdi/DeoptimizeWalk.java
41149 views
1
/*
2
* Copyright (c) 2002, 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
* @bug 4525714
27
* @summary jtreg test PopAsynchronousTest fails in build 85 with -Xcomp
28
* @comment converted from test/jdk/com/sun/jdi/DeoptimizeWalk.sh
29
*
30
* @library /test/lib
31
* @compile -g DeoptimizeWalk.java
32
* @run main/othervm DeoptimizeWalk
33
*/
34
35
import jdk.test.lib.process.OutputAnalyzer;
36
import lib.jdb.JdbCommand;
37
import lib.jdb.JdbTest;
38
39
/*
40
* The bug (JDK-4525714) is about failing PopAsynchronousTest test.
41
* This is another test of the same issue. The bug occurs when trying
42
* to walk the stack of a deoptimized thread. We can do this
43
* by running in -Xcomp mode and by doing a step which causes deopt,
44
* and then a 'where'. This will cause not all the frames to be shown.
45
*/
46
47
class DeoptimizeWalkTarg {
48
static public void main(String[] args) {
49
DeoptimizeWalkTarg mine = new DeoptimizeWalkTarg();
50
mine.a1(89);
51
}
52
53
public void a1(int p1) {
54
int v1 = 89;
55
System.out.println("a1" + v1);
56
a2(89);
57
}
58
59
public void a2(int pp) {
60
int v2 = 89;
61
System.out.println("a2" + v2);
62
a3(89);
63
}
64
65
public void a3(int pp) {
66
int v3 = 89;
67
System.out.println("a3"); //@ 1 breakpoint
68
a4(22); // it passes if this line is commented out
69
System.out.println("jj");
70
}
71
72
public void a4(int pp) {
73
int v4 = 90;
74
System.out.println("a4: @1 breakpoint here");
75
}
76
}
77
78
79
public class DeoptimizeWalk extends JdbTest {
80
public static void main(String argv[]) {
81
new DeoptimizeWalk().run();
82
}
83
84
private DeoptimizeWalk() {
85
super(new LaunchOptions(DEBUGGEE_CLASS)
86
.addDebuggeeOptions(DEBUGGEE_OPTIONS));
87
}
88
89
private static final String DEBUGGEE_CLASS = DeoptimizeWalkTarg.class.getName();
90
private static final String[] DEBUGGEE_OPTIONS = {"-Xcomp"};
91
92
@Override
93
protected void runCases() {
94
setBreakpointsFromTestSource("DeoptimizeWalk.java", 1);
95
jdb.command(JdbCommand.run());
96
97
jdb.command(JdbCommand.where(""));
98
jdb.command(JdbCommand.step());
99
jdb.command(JdbCommand.where(""));
100
101
jdb.contToExit(1);
102
103
new OutputAnalyzer(getJdbOutput())
104
.shouldContain(DEBUGGEE_CLASS + ".main");
105
new OutputAnalyzer(getDebuggeeOutput())
106
.shouldNotContain("Internal exception:");
107
}
108
}
109
110
111