Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java
32284 views
1
/*
2
* Copyright (c) 2014, 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
/**
25
* @test
26
* @bug 8031323
27
* @summary Verify that objects promoted from survivor space to tenured space
28
* during full GC are not aligned to SurvivorAlignmentInBytes value.
29
* @requires vm.gc != "Shenandoah"
30
* @library /testlibrary /testlibrary/whitebox
31
* @build TestPromotionFromSurvivorToTenuredAfterFullGC
32
* SurvivorAlignmentTestMain AlignmentHelper
33
* @run main ClassFileInstaller sun.hotspot.WhiteBox
34
* sun.hotspot.WhiteBox$WhiteBoxPermission
35
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
36
* -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
37
* -XX:OldSize=32m -XX:MaxHeapSize=160m
38
* -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
39
* -XX:+UnlockExperimentalVMOptions
40
* -XX:SurvivorAlignmentInBytes=32
41
* TestPromotionFromSurvivorToTenuredAfterFullGC 10m 9 TENURED
42
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
43
* -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
44
* -XX:OldSize=32m -XX:MaxHeapSize=160m
45
* -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
46
* -XX:+UnlockExperimentalVMOptions
47
* -XX:SurvivorAlignmentInBytes=32
48
* TestPromotionFromSurvivorToTenuredAfterFullGC 20m 47
49
* TENURED
50
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
51
* -XX:+WhiteBoxAPI -XX:NewSize=200m -XX:MaxNewSize=200m
52
* -XX:OldSize=32m -XX:MaxHeapSize=232m
53
* -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
54
* -XX:+UnlockExperimentalVMOptions
55
* -XX:SurvivorAlignmentInBytes=64
56
* TestPromotionFromSurvivorToTenuredAfterFullGC 10m 9 TENURED
57
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
58
* -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
59
* -XX:OldSize=32m -XX:MaxHeapSize=160m
60
* -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
61
* -XX:+UnlockExperimentalVMOptions
62
* -XX:SurvivorAlignmentInBytes=64
63
* TestPromotionFromSurvivorToTenuredAfterFullGC 20m 87
64
* TENURED
65
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
66
* -XX:+WhiteBoxAPI -XX:NewSize=256m -XX:MaxNewSize=256m
67
* -XX:OldSize=32M -XX:MaxHeapSize=288m
68
* -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
69
* -XX:+UnlockExperimentalVMOptions
70
* -XX:SurvivorAlignmentInBytes=128
71
* TestPromotionFromSurvivorToTenuredAfterFullGC 10m 9
72
* TENURED
73
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
74
* -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
75
* -XX:OldSize=32m -XX:MaxHeapSize=160m
76
* -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
77
* -XX:+UnlockExperimentalVMOptions
78
* -XX:SurvivorAlignmentInBytes=128
79
* TestPromotionFromSurvivorToTenuredAfterFullGC 20m 147
80
* TENURED
81
*/
82
public class TestPromotionFromSurvivorToTenuredAfterFullGC {
83
public static void main(String args[]) {
84
SurvivorAlignmentTestMain test
85
= SurvivorAlignmentTestMain.fromArgs(args);
86
System.out.println(test);
87
88
long expectedMemoryUsage = test.getExpectedMemoryUsage();
89
test.baselineMemoryAllocation();
90
System.gc();
91
// increase expected usage by current old gen usage
92
expectedMemoryUsage += SurvivorAlignmentTestMain.getAlignmentHelper(
93
SurvivorAlignmentTestMain.HeapSpace.TENURED)
94
.getActualMemoryUsage();
95
96
test.allocate();
97
SurvivorAlignmentTestMain.WHITE_BOX.youngGC();
98
System.gc();
99
100
test.verifyMemoryUsage(expectedMemoryUsage);
101
}
102
}
103
104