Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/gc/shenandoah/TestAllocObjectArrays.java
40942 views
1
/*
2
* Copyright (c) 2016, 2018, Red Hat, Inc. 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
/*
26
* @test TestAllocObjectArrays
27
* @summary Acceptance tests: collector can withstand allocation
28
* @key randomness
29
* @requires vm.gc.Shenandoah
30
* @library /test/lib
31
*
32
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
33
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
34
* -XX:+ShenandoahDegeneratedGC -XX:+ShenandoahVerify
35
* TestAllocObjectArrays
36
*
37
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
38
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
39
* -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify
40
* TestAllocObjectArrays
41
*
42
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
43
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
44
* -XX:+ShenandoahDegeneratedGC
45
* TestAllocObjectArrays
46
*
47
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
48
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
49
* -XX:-ShenandoahDegeneratedGC
50
* TestAllocObjectArrays
51
*/
52
53
/*
54
* @test TestAllocObjectArrays
55
* @summary Acceptance tests: collector can withstand allocation
56
* @key randomness
57
* @requires vm.gc.Shenandoah
58
* @library /test/lib
59
*
60
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
61
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
62
* -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify
63
* TestAllocObjectArrays
64
*
65
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
66
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
67
* -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify
68
* TestAllocObjectArrays
69
*
70
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
71
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
72
* -XX:+ShenandoahOOMDuringEvacALot
73
* TestAllocObjectArrays
74
*
75
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
76
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
77
* -XX:+ShenandoahAllocFailureALot
78
* TestAllocObjectArrays
79
*
80
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
81
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
82
* TestAllocObjectArrays
83
*/
84
85
/*
86
* @test TestAllocObjectArrays
87
* @summary Acceptance tests: collector can withstand allocation
88
* @key randomness
89
* @requires vm.gc.Shenandoah
90
* @library /test/lib
91
*
92
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
93
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
94
* -XX:+ShenandoahVerify
95
* TestAllocObjectArrays
96
*
97
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
98
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
99
* TestAllocObjectArrays
100
*/
101
102
/*
103
* @test TestAllocObjectArrays
104
* @summary Acceptance tests: collector can withstand allocation
105
* @key randomness
106
* @requires vm.gc.Shenandoah
107
* @library /test/lib
108
*
109
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
110
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static
111
* TestAllocObjectArrays
112
*/
113
114
/*
115
* @test TestAllocObjectArrays
116
* @summary Acceptance tests: collector can withstand allocation
117
* @key randomness
118
* @requires vm.gc.Shenandoah
119
* @library /test/lib
120
*
121
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
122
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
123
* TestAllocObjectArrays
124
*/
125
126
/*
127
* @test TestAllocObjectArrays
128
* @summary Acceptance tests: collector can withstand allocation
129
* @key randomness
130
* @requires vm.gc.Shenandoah
131
* @library /test/lib
132
*
133
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
134
* -XX:+UseShenandoahGC
135
* -XX:-UseTLAB -XX:+ShenandoahVerify
136
* TestAllocObjectArrays
137
*/
138
139
/*
140
* @test TestAllocObjectArrays
141
* @summary Acceptance tests: collector can withstand allocation
142
* @key randomness
143
* @requires vm.gc.Shenandoah
144
* @library /test/lib
145
*
146
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
147
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
148
* -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify
149
* TestAllocObjectArrays
150
*
151
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
152
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
153
* -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify
154
* TestAllocObjectArrays
155
*
156
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
157
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
158
* -XX:+ShenandoahOOMDuringEvacALot
159
* TestAllocObjectArrays
160
*
161
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
162
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
163
* -XX:+ShenandoahAllocFailureALot
164
* TestAllocObjectArrays
165
*
166
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
167
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
168
* TestAllocObjectArrays
169
*/
170
171
/*
172
* @test TestAllocObjectArrays
173
* @summary Acceptance tests: collector can withstand allocation
174
* @key randomness
175
* @requires vm.gc.Shenandoah
176
* @library /test/lib
177
*
178
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
179
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
180
* -XX:+ShenandoahVerify
181
* TestAllocObjectArrays
182
*
183
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g
184
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
185
* TestAllocObjectArrays
186
*/
187
188
import java.util.Random;
189
import jdk.test.lib.Utils;
190
191
public class TestAllocObjectArrays {
192
193
static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation
194
195
static volatile Object sink;
196
197
public static void main(String[] args) throws Exception {
198
final int min = 0;
199
final int max = 384 * 1024;
200
long count = TARGET_MB * 1024 * 1024 / (16 + 4 * (min + (max - min) / 2));
201
202
Random r = Utils.getRandomInstance();
203
for (long c = 0; c < count; c++) {
204
sink = new Object[min + r.nextInt(max - min)];
205
}
206
}
207
208
}
209
210