Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/jit/graph/test4.java
40948 views
1
/*
2
* Copyright (c) 2008, 2021, 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
package jit.graph;
25
26
import java.lang.reflect.InvocationTargetException;
27
import java.util.Vector;
28
29
class test4 extends test2 {
30
private final int[] MethodID = {Globals.MethodID_Array[1], Globals.MethodID_Array[5], Globals.MethodID_Array[6]};
31
32
// this method verifies that a child can make a call to its parent
33
public void CallCallMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth)
34
throws InvocationTargetException {
35
Globals.appendSumToSummationVector(MethodID[1], summation);
36
37
if (CGT.shouldFinish()) {
38
return;
39
}
40
41
if (Globals.VERBOSE) {
42
System.out.println("test4.CallCallMe");
43
}
44
45
if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <= 0)) {
46
return;
47
}
48
49
MethodData methodCallStr;
50
Long numFcalls;
51
Integer staticFcalls;
52
if (staticFunctionDepth.intValue() > 0) {
53
numFcalls = functionDepth;
54
staticFcalls = Integer.valueOf(staticFunctionDepth.intValue() - 1);
55
methodCallStr = Globals.returnNextStaticMethod(MethodID[1]);
56
57
Globals.addFunctionIDToVector(methodCallStr.id, ID);
58
} else {
59
numFcalls = Long.valueOf(functionDepth.longValue() - 1);
60
staticFcalls = staticFunctionDepth;
61
Globals.addFunctionIDToVector(MethodID[0], ID);
62
super.callMe(summation, ID, numFcalls, staticFcalls);
63
return;
64
}
65
66
67
Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls);
68
}
69
70
// this method makes a Y fork in the method call structure
71
public void callMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth)
72
throws InvocationTargetException {
73
Globals.appendSumToSummationVector(MethodID[2], summation);
74
75
if (CGT.shouldFinish()) {
76
return;
77
}
78
79
if (Globals.VERBOSE) {
80
System.out.println("test4.callMe");
81
}
82
83
if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <= 0)) {
84
return;
85
}
86
87
MethodData methodCallStr;
88
Long numFcalls;
89
Integer staticFcalls;
90
if (staticFunctionDepth.intValue() > 0) {
91
numFcalls = functionDepth;
92
staticFcalls = Integer.valueOf(staticFunctionDepth.intValue() - 1);
93
methodCallStr = Globals.returnNextStaticMethod(MethodID[2]);
94
} else {
95
long temp = functionDepth.longValue() - 2;
96
numFcalls = Long.valueOf(temp / 2);
97
staticFcalls = staticFunctionDepth;
98
99
if (Globals.VERBOSE) {
100
System.out.println(" test4.callMe - Starting Branch 1");
101
}
102
methodCallStr = Globals.nextRandomMethod();
103
Globals.addFunctionIDToVector(methodCallStr.id, ID);
104
Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls);
105
106
if (CGT.shouldFinish()) {
107
return;
108
}
109
110
temp -= temp / 2;
111
if (temp < 0) {
112
if (Globals.VERBOSE) {
113
System.out.println(" test4.callMe - Skipping Branch 2");
114
}
115
return;
116
}
117
if (Globals.VERBOSE) {
118
System.out.println(" test4.callMe - Starting Branch 2");
119
}
120
numFcalls = Long.valueOf(temp);
121
methodCallStr = Globals.nextRandomMethod();
122
}
123
Globals.addFunctionIDToVector(methodCallStr.id, ID);
124
Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls);
125
}
126
127
}
128
129