RFR: 8377011: Shenandoah: assert_bounds should be only called when boundaries have changed [v3]

Xiaolong Peng xpeng at openjdk.org
Mon Feb 9 21:23:38 UTC 2026


On Sat, 7 Feb 2026 00:34:11 GMT, William Kemper <wkemper at openjdk.org> wrote:

>> Xiaolong Peng has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   code format
>
> src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 1677:
> 
>> 1675:   }
>> 1676:   DEBUG_ONLY(bool boundary_changed = false;)
>> 1677:   if ((result != nullptr) && in_new_region) {
> 
> Why make this a standalone test instead of having it be subordinate to `alloc_capacity(r) < PLAB::min_size() * HeapWordSize` as it was before?

Logically the new code is same as before, the old control flow is like:

if (alloc_capacity(r) < PLAB::min_size() * HeapWordSize) {
   ...// do sth.
   if ((result != nullptr) && in_new_region) {
      _partitions.one_region_is_no_longer_empty(orig_partition);
   }
} else if ((result != nullptr) && in_new_region) {
   _partitions.one_region_is_no_longer_empty(orig_partition);
}
``` 

The test  `if ((result != nullptr) && in_new_region)` is always done, having standalone test make it easier to read and understand.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29537#discussion_r2776602684


More information about the hotspot-gc-dev mailing list