Skip to content

Commit ff5bb8c

Browse files
committed
8265239: Shenandoah: Shenandoah heap region count could be off by 1
Reviewed-by: shade
1 parent 17b6592 commit ff5bb8c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ jint ShenandoahHeap::initialize() {
153153
Universe::check_alignment(init_byte_size, reg_size_bytes, "Shenandoah heap");
154154

155155
_num_regions = ShenandoahHeapRegion::region_count();
156+
assert(_num_regions == (max_byte_size / reg_size_bytes), "Must match");
156157

157158
// Now we know the number of regions, initialize the heuristics.
158159
initialize_heuristics();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ void ShenandoahHeapRegion::setup_sizes(size_t max_heap_size) {
575575
RegionSizeBytesMask = RegionSizeBytes - 1;
576576

577577
guarantee(RegionCount == 0, "we should only set it once");
578-
RegionCount = max_heap_size / RegionSizeBytes;
578+
RegionCount = align_up(max_heap_size, RegionSizeBytes) / RegionSizeBytes;
579579
guarantee(RegionCount >= MIN_NUM_REGIONS, "Should have at least minimum regions");
580580

581581
guarantee(HumongousThresholdWords == 0, "we should only set it once");

0 commit comments

Comments
 (0)