Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/gc/g1/TestHumongousAllocNearlyFullRegion.java
40942 views
1
/*
2
* Copyright (c) 2012, 2019, 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 gc.g1;
25
26
import static gc.testlibrary.Allocation.blackHole;
27
28
/*
29
* @test TestHumongousAllocNearlyFullRegion
30
* @bug 8143587
31
* @summary G1: humongous object allocations should work even when there is
32
* not enough space in the heapRegion to fit a filler object.
33
* @requires vm.gc.G1
34
* @modules java.base/jdk.internal.misc
35
* @library /test/lib
36
* @library /
37
* @run driver gc.g1.TestHumongousAllocNearlyFullRegion
38
*/
39
40
import jdk.test.lib.process.OutputAnalyzer;
41
import jdk.test.lib.process.ProcessTools;
42
43
public class TestHumongousAllocNearlyFullRegion {
44
// Heap sizes < 224 MB are increased to 224 MB if vm_page_size == 64K to
45
// fulfill alignment constraints.
46
private static final int heapSize = 224; // MB
47
private static final int heapRegionSize = 1; // MB
48
49
public static void main(String[] args) throws Exception {
50
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
51
"-XX:+UseG1GC",
52
"-Xms" + heapSize + "m",
53
"-Xmx" + heapSize + "m",
54
"-XX:G1HeapRegionSize=" + heapRegionSize + "m",
55
"-Xlog:gc",
56
HumongousObjectAllocator.class.getName());
57
58
OutputAnalyzer output = new OutputAnalyzer(pb.start());
59
output.shouldContain("Pause Young (Concurrent Start) (G1 Humongous Allocation)");
60
output.shouldHaveExitValue(0);
61
}
62
63
static class HumongousObjectAllocator {
64
public static void main(String [] args) {
65
for (int i = 0; i < heapSize; i++) {
66
// 131069 is the number of longs it takes to fill a heapRegion except
67
// for 8 bytes on 64 bit.
68
blackHole(new long[131069]);
69
}
70
}
71
}
72
}
73
74
75