From 94e14da0ef06793c32f881188930481acaec0d97 Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Wed, 28 Sep 2022 08:27:35 +0000 Subject: [PATCH] 8294057: Parallel: Tighten ParallelCompactData::initialize_region_data Reviewed-by: tschatzl, sjohanss --- src/hotspot/share/gc/parallel/psParallelCompact.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp index 893a7a631f9..e1b5b61e866 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp @@ -432,8 +432,6 @@ bool ParallelCompactData::initialize(MemRegion covered_region) assert(region_align_down(_region_start) == _region_start, "region start not aligned"); - assert((region_size & RegionSizeOffsetMask) == 0, - "region size not a multiple of RegionSize"); bool result = initialize_region_data(region_size) && initialize_block_data(); return result; @@ -470,7 +468,10 @@ ParallelCompactData::create_vspace(size_t count, size_t element_size) bool ParallelCompactData::initialize_region_data(size_t region_size) { - const size_t count = (region_size + RegionSizeOffsetMask) >> Log2RegionSize; + assert((region_size & RegionSizeOffsetMask) == 0, + "region size not a multiple of RegionSize"); + + const size_t count = region_size >> Log2RegionSize; _region_vspace = create_vspace(count, sizeof(RegionData)); if (_region_vspace != 0) { _region_data = (RegionData*)_region_vspace->reserved_low_addr();