Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8265239: Shenandoah: Shenandoah heap region count could be off by 1
Reviewed-by: shade
  • Loading branch information
zhengyu123 committed Apr 16, 2021
1 parent 17b6592 commit ff5bb8c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Expand Up @@ -153,6 +153,7 @@ jint ShenandoahHeap::initialize() {
Universe::check_alignment(init_byte_size, reg_size_bytes, "Shenandoah heap");

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

// Now we know the number of regions, initialize the heuristics.
initialize_heuristics();
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp
Expand Up @@ -575,7 +575,7 @@ void ShenandoahHeapRegion::setup_sizes(size_t max_heap_size) {
RegionSizeBytesMask = RegionSizeBytes - 1;

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

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

1 comment on commit ff5bb8c

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.