Skip to content

Commit 5acbf8b

Browse files
pf0nmrserb
authored andcommitted
8381871: GenShen: ShenandoahGCHeuristics flag not reset after ignoring non-adaptive value
Reviewed-by: xpeng, kdnilsen, ysr, serb, wkemper
1 parent 29434cc commit 5acbf8b

2 files changed

Lines changed: 85 additions & 0 deletions

File tree

src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ void ShenandoahArguments::initialize() {
200200
&& strcmp(ShenandoahGCHeuristics, "adaptive") != 0) {
201201
log_warning(gc)("Ignoring -XX:ShenandoahGCHeuristics input: %s, because generational shenandoah only"
202202
" supports adaptive heuristics", ShenandoahGCHeuristics);
203+
FLAG_SET_ERGO(ShenandoahGCHeuristics, "adaptive");
203204
}
204205

205206
FullGCForwarding::initialize_flags(MaxHeapSize);
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* Copyright Amazon.com Inc. 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+
/*
26+
* @test id=generational
27+
* @bug 8381871
28+
* @summary Test that ShenandoahGCHeuristics is always adaptive in generational mode
29+
* @requires vm.gc.Shenandoah
30+
* @library /test/lib
31+
* @run driver TestGenerationalHeuristics
32+
*/
33+
34+
import jdk.test.lib.process.ProcessTools;
35+
import jdk.test.lib.process.OutputAnalyzer;
36+
37+
public class TestGenerationalHeuristics {
38+
public static void main(String[] args) throws Exception {
39+
{
40+
OutputAnalyzer output = ProcessTools.executeLimitedTestJava(
41+
"-XX:+UseShenandoahGC",
42+
"-XX:ShenandoahGCMode=generational",
43+
"-XX:ShenandoahGCHeuristics=adaptive",
44+
"-XX:+PrintFlagsFinal",
45+
"-version");
46+
output.shouldMatch("ShenandoahGCHeuristics(.*)= adaptive ");
47+
output.shouldHaveExitValue(0);
48+
}
49+
50+
{
51+
OutputAnalyzer output = ProcessTools.executeLimitedTestJava(
52+
"-XX:+UseShenandoahGC",
53+
"-XX:ShenandoahGCMode=generational",
54+
"-XX:ShenandoahGCHeuristics=static",
55+
"-XX:+PrintFlagsFinal",
56+
"-version");
57+
output.shouldMatch("ShenandoahGCHeuristics(.*)= adaptive ");
58+
output.shouldHaveExitValue(0);
59+
}
60+
61+
{
62+
OutputAnalyzer output = ProcessTools.executeLimitedTestJava(
63+
"-XX:+UseShenandoahGC",
64+
"-XX:ShenandoahGCMode=generational",
65+
"-XX:ShenandoahGCHeuristics=aggressive",
66+
"-XX:+PrintFlagsFinal",
67+
"-version");
68+
output.shouldMatch("ShenandoahGCHeuristics(.*)= adaptive ");
69+
output.shouldHaveExitValue(0);
70+
}
71+
72+
{
73+
OutputAnalyzer output = ProcessTools.executeLimitedTestJava(
74+
"-XX:+UseShenandoahGC",
75+
"-XX:ShenandoahGCMode=generational",
76+
"-XX:ShenandoahGCHeuristics=compact",
77+
"-XX:+PrintFlagsFinal",
78+
"-version");
79+
output.shouldMatch("ShenandoahGCHeuristics(.*)= adaptive ");
80+
output.shouldHaveExitValue(0);
81+
}
82+
}
83+
84+
}

0 commit comments

Comments
 (0)