8223759: Shenandoah should allow arbitrarily low initial heap size
Reviewed-by: rkennke
--- a/src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp Tue May 14 09:14:36 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp Tue May 14 09:12:00 2019 +0200
@@ -204,7 +204,7 @@
void ShenandoahArguments::initialize_alignments() {
// Need to setup sizes early to get correct alignments.
- ShenandoahHeapRegion::setup_sizes(InitialHeapSize, MaxHeapSize);
+ ShenandoahHeapRegion::setup_sizes(MaxHeapSize);
// This is expected by our algorithm for ShenandoahHeap::heap_region_containing().
size_t align = ShenandoahHeapRegion::region_size_bytes();
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp Tue May 14 09:14:36 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp Tue May 14 09:12:00 2019 +0200
@@ -516,7 +516,7 @@
}
}
-void ShenandoahHeapRegion::setup_sizes(size_t initial_heap_size, size_t max_heap_size) {
+void ShenandoahHeapRegion::setup_sizes(size_t max_heap_size) {
// Absolute minimums we should not ever break.
static const size_t MIN_REGION_SIZE = 256*K;
@@ -526,10 +526,10 @@
size_t region_size;
if (FLAG_IS_DEFAULT(ShenandoahHeapRegionSize)) {
- if (ShenandoahMinRegionSize > initial_heap_size / MIN_NUM_REGIONS) {
- err_msg message("Initial heap size (" SIZE_FORMAT "K) is too low to afford the minimum number "
+ if (ShenandoahMinRegionSize > max_heap_size / MIN_NUM_REGIONS) {
+ err_msg message("Max heap size (" SIZE_FORMAT "K) is too low to afford the minimum number "
"of regions (" SIZE_FORMAT ") of minimum region size (" SIZE_FORMAT "K).",
- initial_heap_size/K, MIN_NUM_REGIONS, ShenandoahMinRegionSize/K);
+ max_heap_size/K, MIN_NUM_REGIONS, ShenandoahMinRegionSize/K);
vm_exit_during_initialization("Invalid -XX:ShenandoahMinRegionSize option", message);
}
if (ShenandoahMinRegionSize < MIN_REGION_SIZE) {
@@ -562,10 +562,10 @@
region_size = MIN2(ShenandoahMaxRegionSize, region_size);
} else {
- if (ShenandoahHeapRegionSize > initial_heap_size / MIN_NUM_REGIONS) {
- err_msg message("Initial heap size (" SIZE_FORMAT "K) is too low to afford the minimum number "
+ if (ShenandoahHeapRegionSize > max_heap_size / MIN_NUM_REGIONS) {
+ err_msg message("Max heap size (" SIZE_FORMAT "K) is too low to afford the minimum number "
"of regions (" SIZE_FORMAT ") of requested size (" SIZE_FORMAT "K).",
- initial_heap_size/K, MIN_NUM_REGIONS, ShenandoahHeapRegionSize/K);
+ max_heap_size/K, MIN_NUM_REGIONS, ShenandoahHeapRegionSize/K);
vm_exit_during_initialization("Invalid -XX:ShenandoahHeapRegionSize option", message);
}
if (ShenandoahHeapRegionSize < ShenandoahMinRegionSize) {
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp Tue May 14 09:14:36 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp Tue May 14 09:12:00 2019 +0200
@@ -257,7 +257,7 @@
static const size_t MIN_NUM_REGIONS = 10;
- static void setup_sizes(size_t initial_heap_size, size_t max_heap_size);
+ static void setup_sizes(size_t max_heap_size);
double empty_time() {
return _empty_time;
--- a/test/hotspot/jtreg/gc/shenandoah/options/TestRegionSizeArgs.java Tue May 14 09:14:36 2019 +0200
+++ b/test/hotspot/jtreg/gc/shenandoah/options/TestRegionSizeArgs.java Tue May 14 09:12:00 2019 +0200
@@ -47,17 +47,6 @@
{
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",
"-XX:+UseShenandoahGC",
- "-Xms2m",
- "-Xmx1g",
- "-version");
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldMatch("Initial heap size");
- output.shouldHaveExitValue(1);
- }
-
- {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",
- "-XX:+UseShenandoahGC",
"-Xms4m",
"-Xmx1g",
"-version");
@@ -92,18 +81,6 @@
"-XX:+UseShenandoahGC",
"-Xms100m",
"-Xmx1g",
- "-XX:ShenandoahHeapRegionSize=11m",
- "-version");
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldMatch("Invalid -XX:ShenandoahHeapRegionSize option");
- output.shouldHaveExitValue(1);
- }
-
- {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",
- "-XX:+UseShenandoahGC",
- "-Xms100m",
- "-Xmx1g",
"-XX:ShenandoahHeapRegionSize=9m",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
@@ -223,18 +200,6 @@
"-XX:+UseShenandoahGC",
"-Xms100m",
"-Xmx1g",
- "-XX:ShenandoahMinRegionSize=11m",
- "-version");
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldMatch("Invalid -XX:ShenandoahMinRegionSize option");
- output.shouldHaveExitValue(1);
- }
-
- {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",
- "-XX:+UseShenandoahGC",
- "-Xms100m",
- "-Xmx1g",
"-XX:ShenandoahMinRegionSize=9m",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());