1 /*
2 * Copyright (c) 2020, 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 *
82 * @test id=adaptive
83 * @key randomness
84 * @summary Test that Shenandoah is able to work with(out) resizeable TLABs
85 * @requires vm.gc.Shenandoah
86 * @library /test/lib
87 *
88 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
89 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
90 * -XX:+ShenandoahVerify
91 * -XX:+ResizeTLAB
92 * TestResizeTLAB
93 *
94 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
95 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
96 * -XX:+ShenandoahVerify
97 * -XX:-ResizeTLAB
98 * TestResizeTLAB
99 */
100
101 /*
102 * @test id=static
103 * @key randomness
104 * @summary Test that Shenandoah is able to work with(out) resizeable TLABs
105 * @requires vm.gc.Shenandoah
106 * @library /test/lib
107 *
108 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
109 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static
110 * -XX:+ShenandoahVerify
111 * -XX:+ResizeTLAB
112 * TestResizeTLAB
113 *
114 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
115 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static
116 * -XX:+ShenandoahVerify
117 * -XX:-ResizeTLAB
118 * TestResizeTLAB
119 */
120
121 /*
122 * @test id=compact
123 * @key randomness
124 * @summary Test that Shenandoah is able to work with(out) resizeable TLABs
125 * @requires vm.gc.Shenandoah
126 * @library /test/lib
127 *
128 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
129 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
130 * -XX:+ShenandoahVerify
131 * -XX:+ResizeTLAB
132 * TestResizeTLAB
133 *
134 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
135 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
136 * -XX:+ShenandoahVerify
137 * -XX:-ResizeTLAB
138 * TestResizeTLAB
139 */
140
141 /*
142 * @test id=iu-aggressive
143 * @key randomness
144 * @summary Test that Shenandoah is able to work with(out) resizeable TLABs
145 * @requires vm.gc.Shenandoah
146 * @library /test/lib
147 *
148 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
149 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
150 * -XX:+ShenandoahVerify
151 * -XX:+ResizeTLAB
152 * TestResizeTLAB
153 *
154 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
155 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
156 * -XX:+ShenandoahVerify
157 * -XX:-ResizeTLAB
158 * TestResizeTLAB
159 */
160
161 /*
162 * @test id=iu
163 * @key randomness
164 * @summary Test that Shenandoah is able to work with(out) resizeable TLABs
165 * @requires vm.gc.Shenandoah
166 * @library /test/lib
167 *
168 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
169 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
170 * -XX:+ShenandoahVerify
171 * -XX:+ResizeTLAB
172 * TestResizeTLAB
173 *
174 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
175 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
176 * -XX:+ShenandoahVerify
177 * -XX:-ResizeTLAB
178 * TestResizeTLAB
179 */
180
181 import java.util.Random;
182 import jdk.test.lib.Utils;
183
184 public class TestResizeTLAB {
185
186 static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation
187
188 static volatile Object sink;
189
190 public static void main(String[] args) throws Exception {
191 final int min = 0;
192 final int max = 384 * 1024;
193 long count = TARGET_MB * 1024 * 1024 / (16 + 4 * (min + (max - min) / 2));
194
195 Random r = Utils.getRandomInstance();
|
1 /*
2 * Copyright (c) 2020, Red Hat, Inc. All rights reserved.
3 * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
83 * @test id=adaptive
84 * @key randomness
85 * @summary Test that Shenandoah is able to work with(out) resizeable TLABs
86 * @requires vm.gc.Shenandoah
87 * @library /test/lib
88 *
89 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
90 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
91 * -XX:+ShenandoahVerify
92 * -XX:+ResizeTLAB
93 * TestResizeTLAB
94 *
95 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
96 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
97 * -XX:+ShenandoahVerify
98 * -XX:-ResizeTLAB
99 * TestResizeTLAB
100 */
101
102 /*
103 * @test id=generational
104 * @key randomness
105 * @summary Test that Shenandoah is able to work with(out) resizeable TLABs
106 * @requires vm.gc.Shenandoah
107 * @library /test/lib
108 *
109 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
110 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive -XX:ShenandoahGCMode=generational
111 * -XX:+ShenandoahVerify
112 * -XX:+ResizeTLAB
113 * TestResizeTLAB
114 *
115 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
116 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive -XX:ShenandoahGCMode=generational
117 * -XX:+ShenandoahVerify
118 * -XX:-ResizeTLAB
119 * TestResizeTLAB
120 */
121
122 /*
123 * @test id=static
124 * @key randomness
125 * @summary Test that Shenandoah is able to work with(out) resizeable TLABs
126 * @requires vm.gc.Shenandoah
127 * @library /test/lib
128 *
129 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
130 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static
131 * -XX:+ShenandoahVerify
132 * -XX:+ResizeTLAB
133 * TestResizeTLAB
134 *
135 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
136 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static
137 * -XX:+ShenandoahVerify
138 * -XX:-ResizeTLAB
139 * TestResizeTLAB
140 */
141
142 /*
143 * @test id=compact
144 * @key randomness
145 * @summary Test that Shenandoah is able to work with(out) resizeable TLABs
146 * @requires vm.gc.Shenandoah
147 * @library /test/lib
148 *
149 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
150 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
151 * -XX:+ShenandoahVerify
152 * -XX:+ResizeTLAB
153 * TestResizeTLAB
154 *
155 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
156 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
157 * -XX:+ShenandoahVerify
158 * -XX:-ResizeTLAB
159 * TestResizeTLAB
160 */
161
162 import java.util.Random;
163 import jdk.test.lib.Utils;
164
165 public class TestResizeTLAB {
166
167 static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation
168
169 static volatile Object sink;
170
171 public static void main(String[] args) throws Exception {
172 final int min = 0;
173 final int max = 384 * 1024;
174 long count = TARGET_MB * 1024 * 1024 / (16 + 4 * (min + (max - min) / 2));
175
176 Random r = Utils.getRandomInstance();
|