Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/gc/g1/TestHumongousRemsetsMatch.java
40942 views
1
/*
2
* Copyright (c) 2018, 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 gc.g1;
25
26
/*
27
* @test TestHumongousRemSetsMatch
28
* @bug 8205426
29
* @summary Test to make sure that humongous object remset states are in sync
30
* @requires vm.gc.G1 & os.maxMemory >= 2G
31
* @library /test/lib
32
* @build sun.hotspot.WhiteBox
33
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
34
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -Xmx512M -Xms512M -Xmn10M -XX:ParallelGCThreads=2 -XX:-UseDynamicNumberOfGCThreads -XX:+UseG1GC -XX:+WhiteBoxAPI -XX:G1HeapRegionSize=1M -XX:+VerifyAfterGC -Xlog:gc,gc+remset+tracking=trace gc.g1.TestHumongousRemsetsMatch
35
*/
36
37
import sun.hotspot.WhiteBox;
38
39
public class TestHumongousRemsetsMatch {
40
41
// G1 at the moment uses one thread every this amount of regions.
42
private static final int WorkerThreadBoundary = 384;
43
44
private static final int ObjSizeInRegions = 17;
45
private static final int M = 1024 * 1024;
46
private static final int TypeArrayObjSize = ObjSizeInRegions * M / 4 /* sizeof(int) */ - 1024 /* > header size */;
47
48
public static void main(String[] args) throws Exception {
49
WhiteBox wb = WhiteBox.getWhiteBox();
50
51
for (int j = 0; j < 3; j++) {
52
wb.fullGC(); // Start with a clean slate
53
54
// It may happen that our 7-region sized humongous objects may just be "misaligned"
55
// so that they do not cross the region 384 boundary. Try to counter this by offsetting
56
// the humongous objects just a little.
57
Object alignmentFudge = new int[(j + 1) * M / 4 /* sizeof(int) */ - 1024];
58
59
// Fill the heap so that more than WorkerThreadBoundary regions are occupied with humongous objects
60
// and hopefully one of these objects crosses the region WorkerThreadBoundary boundary.
61
Object[] lotsOfHumongousObjects = new Object[(WorkerThreadBoundary / ObjSizeInRegions) + 3];
62
63
for (int i = 0; i < lotsOfHumongousObjects.length; i++) {
64
lotsOfHumongousObjects[i] = new int[TypeArrayObjSize];
65
}
66
67
wb.fullGC();
68
69
// Trigger a concurrent cycle and wait until the Remark pause
70
wb.g1StartConcMarkCycle();
71
while (wb.g1InConcurrentMark()) {
72
Thread.sleep(200);
73
}
74
wb.youngGC(); // Trigger verification error.
75
76
System.out.println(lotsOfHumongousObjects + " " + alignmentFudge);
77
}
78
}
79
}
80
81
82