mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-13 11:55:38 +00:00
8223759: Shenandoah should allow arbitrarily low initial heap size
Reviewed-by: rkennke
This commit is contained in:
parent
e7f9a8a263
commit
92d97ce512
@ -204,7 +204,7 @@ size_t ShenandoahArguments::conservative_max_heap_alignment() {
|
||||
|
||||
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();
|
||||
|
||||
@ -516,7 +516,7 @@ HeapWord* ShenandoahHeapRegion::block_start_const(const void* p) const {
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ void ShenandoahHeapRegion::setup_sizes(size_t initial_heap_size, size_t max_heap
|
||||
|
||||
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 @@ void ShenandoahHeapRegion::setup_sizes(size_t initial_heap_size, size_t max_heap
|
||||
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) {
|
||||
|
||||
@ -257,7 +257,7 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
@ -44,17 +44,6 @@ public class TestRegionSizeArgs {
|
||||
|
||||
private static void testInvalidRegionSizes() throws Exception {
|
||||
|
||||
{
|
||||
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",
|
||||
@ -87,18 +76,6 @@ public class TestRegionSizeArgs {
|
||||
output.shouldHaveExitValue(1);
|
||||
}
|
||||
|
||||
{
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",
|
||||
"-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",
|
||||
@ -218,18 +195,6 @@ public class TestRegionSizeArgs {
|
||||
output.shouldHaveExitValue(1);
|
||||
}
|
||||
|
||||
{
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",
|
||||
"-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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user