author | phh |
Sat, 30 Nov 2019 14:33:05 -0800 | |
changeset 59330 | 5b96c12f909d |
parent 53523 | 4c5184c56dc2 |
permissions | -rw-r--r-- |
51007
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
1 |
/* |
53523
4c5184c56dc2
8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents:
51007
diff
changeset
|
2 |
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. |
51007
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
4 |
* |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
8 |
* |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
13 |
* accompanied this code). |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
14 |
* |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
18 |
* |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
21 |
* questions. |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
22 |
*/ |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
23 |
|
53523
4c5184c56dc2
8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents:
51007
diff
changeset
|
24 |
package gc.g1; |
4c5184c56dc2
8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents:
51007
diff
changeset
|
25 |
|
51007
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
26 |
/* |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
27 |
* @test TestHumongousRemSetsMatch |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
28 |
* @bug 8205426 |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
29 |
* @summary Test to make sure that humongous object remset states are in sync |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
30 |
* @key gc |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
31 |
* @requires vm.gc.G1 |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
32 |
* @library /test/lib |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
33 |
* @build sun.hotspot.WhiteBox |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
34 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox |
53523
4c5184c56dc2
8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents:
51007
diff
changeset
|
35 |
* @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 |
51007
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
36 |
*/ |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
37 |
|
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
38 |
import sun.hotspot.WhiteBox; |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
39 |
|
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
40 |
public class TestHumongousRemsetsMatch { |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
41 |
|
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
42 |
// G1 at the moment uses one thread every this amount of regions. |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
43 |
private static final int WorkerThreadBoundary = 384; |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
44 |
|
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
45 |
private static final int ObjSizeInRegions = 17; |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
46 |
private static final int M = 1024 * 1024; |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
47 |
private static final int TypeArrayObjSize = ObjSizeInRegions * M / 4 /* sizeof(int) */ - 1024 /* > header size */; |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
48 |
|
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
49 |
public static void main(String[] args) throws Exception { |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
50 |
WhiteBox wb = WhiteBox.getWhiteBox(); |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
51 |
|
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
52 |
for (int j = 0; j < 3; j++) { |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
53 |
wb.fullGC(); // Start with a clean slate |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
54 |
|
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
55 |
// It may happen that our 7-region sized humongous objects may just be "misaligned" |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
56 |
// so that they do not cross the region 384 boundary. Try to counter this by offsetting |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
57 |
// the humongous objects just a little. |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
58 |
Object alignmentFudge = new int[(j + 1) * M / 4 /* sizeof(int) */ - 1024]; |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
59 |
|
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
60 |
// Fill the heap so that more than WorkerThreadBoundary regions are occupied with humongous objects |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
61 |
// and hopefully one of these objects crosses the region WorkerThreadBoundary boundary. |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
62 |
Object[] lotsOfHumongousObjects = new Object[(WorkerThreadBoundary / ObjSizeInRegions) + 3]; |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
63 |
|
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
64 |
for (int i = 0; i < lotsOfHumongousObjects.length; i++) { |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
65 |
lotsOfHumongousObjects[i] = new int[TypeArrayObjSize]; |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
66 |
} |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
67 |
|
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
68 |
wb.fullGC(); |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
69 |
|
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
70 |
// Trigger a concurrent cycle and wait until the Remark pause |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
71 |
wb.g1StartConcMarkCycle(); |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
72 |
while (wb.g1InConcurrentMark()) { |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
73 |
Thread.sleep(200); |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
74 |
} |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
75 |
wb.youngGC(); // Trigger verification error. |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
76 |
|
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
77 |
System.out.println(lotsOfHumongousObjects + " " + alignmentFudge); |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
78 |
} |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
79 |
} |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
80 |
} |
fc9dd181d70e
8205426: Humongous continues remembered set does not match humongous start region one after Remark
tschatzl
parents:
diff
changeset
|
81 |