RFR: Initial sizing refactor [v2]

William Kemper wkemper at openjdk.org
Wed Dec 21 23:55:18 UTC 2022


On Wed, 21 Dec 2022 22:03:03 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:

>> William Kemper has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Improve assertions and comments
>
> src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp line 268:
> 
>> 266: }
>> 267: 
>> 268: size_t round_down_to_multiple_of_region_size(size_t bytes) {
> 
> I could have sworn there was a rounding utility/macro extensively used in sizing code, but the only one I found was a power of 2 rounder. The alternative, if one maintained a log of heap region size (being a power of 2) would be to use a bit-mask here.
> 
> Anyway, nothing to do here; this looks good for now.

I wasn't sure if region size was coerced to a power of a 2, but it seems to be the case:

size_t ShenandoahHeapRegion::setup_sizes(size_t max_heap_size) {
// ...
  int region_size_log = log2i(region_size);
  // Recalculate the region size to make sure it's a power of
  // 2. This means that region_size is the largest power of 2 that's
  // <= what we've calculated so far.
  region_size = size_t(1) << region_size_log;

I'll make that change.

-------------

PR: https://git.openjdk.org/shenandoah/pull/185


More information about the shenandoah-dev mailing list