Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/c2/Test6357214.java
41149 views
1
/*
2
* Copyright (c) 2011, 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 6357214
27
* @summary Hotspot server compiler gets integer comparison wrong
28
*
29
* @run main/othervm/timeout=60 -DshowAll=ffo -DeventID=444 compiler.c2.Test6357214
30
*/
31
32
package compiler.c2;
33
34
// The test hangs after few iterations before the fix. So it fails if timeout.
35
public class Test6357214 {
36
static class MyResult {
37
public boolean next() {
38
return true;
39
}
40
41
public String getString(String in) {
42
if (in.equals("id"))
43
return "idFoo";
44
if (in.equals("contentKey"))
45
return "ckFoo";
46
return "Foo";
47
}
48
49
public int getInt(String in) {
50
if (in.equals("processingComplete"))
51
return 0;
52
return 1;
53
}
54
55
public byte[] getBytes(String in) {
56
byte[] arr = null;
57
if (in.equals("content")) {
58
arr = new byte[65536];
59
byte j = 32;
60
for (int i=0; i<65536; i++) {
61
arr[i] = j;
62
if (++j == 127)
63
j=32;
64
}
65
}
66
return arr;
67
}
68
}
69
70
public static volatile boolean bollocks = true;
71
public String create(String context) throws Exception {
72
73
//
74
// Extract HTTP parameters
75
//
76
77
boolean showAll = System.getProperty("showAll") != null;
78
String eventID = System.getProperty("eventID");
79
String eventContentKey = System.getProperty("cKey");
80
//
81
// Build ContentStaging query based on eventID or eventContentKey
82
//
83
84
String sql = "select id, processingComplete, contentKey, content "
85
+ "from ContentStaging cs, ContentStagingKey csk "
86
+ "where cs.eventContentKey = csk.eventContentKey ";
87
88
if (eventID != null) {
89
sql += "and id = " + eventID;
90
}
91
else if (eventContentKey != null) {
92
sql += "and cs.eventContentKey = '"
93
+ eventContentKey
94
+ "' having id = max(id)";
95
}
96
else {
97
throw new Exception("Need eventID or eventContentKey");
98
}
99
100
//
101
// This factory builds a static panel, there is no JSP
102
//
103
104
StringBuffer html = new StringBuffer();
105
106
try {
107
108
MyResult result = new MyResult();
109
if (result.next()) {
110
111
eventID = result.getString("id");
112
int processingComplete = result.getInt("processingComplete");
113
String contentKey = result.getString("contentKey");
114
byte[] bytes = result.getBytes("content");
115
116
//
117
// Print content status and associated controls
118
//
119
120
html.append("<br/><font class=\"small\">");
121
html.append("Status: ");
122
switch (processingComplete) {
123
case 0 :
124
case 1 : html.append("PENDING"); break;
125
case 2 : html.append(contentKey); break;
126
case 3 : html.append(eventID); break;
127
default : html.append("UNKNONW");
128
}
129
html.append("</font><br/>");
130
131
//
132
// Print at most 20Kb of content unless "showAll" is set
133
//
134
135
int limit = showAll ? Integer.MAX_VALUE : 1024 * 20;
136
System.out.println(limit);
137
html.append("<pre>");
138
for (int i = 0; bytes != null && i < bytes.length; i++) {
139
char c = (char) bytes[i];
140
switch (c) {
141
case '<' : html.append("&lt;"); break;
142
case '>' : html.append("&gt;"); break;
143
case '&' : html.append("&amp;"); break;
144
default : html.append(c);
145
}
146
147
if (i > limit) {
148
while (bollocks);
149
// System.out.println("i is " + i);
150
// System.out.println("limit is " + limit);
151
html.append("...\n</pre>");
152
html.append(eventID);
153
html.append("<pre>");
154
break;
155
}
156
}
157
html.append("</pre>");
158
}
159
}
160
catch (Exception exception) {
161
throw exception;
162
}
163
finally {
164
html.append("Oof!!");
165
}
166
String ret = html.toString();
167
System.out.println("Returning string length = "+ ret.length());
168
return ret;
169
}
170
171
public static void main(String[] args) throws Exception {
172
int length=0;
173
174
for (int i = 0; i < 100; i++) {
175
length = new Test6357214().create("boo").length();
176
System.out.println(length);
177
}
178
}
179
}
180
181
182