RFR: 8361948: Shenandoah: region free capacity unit mismatch (byte or word?)

Xiaolong Peng xpeng at openjdk.org
Fri Jul 11 17:58:22 UTC 2025


In the code path of [mutator allocation](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp#L883
), looks like we assume that ShenandoahAllocRequest::size/min_size and region free capacity have same unit, which is apparently not right, unit used in ShenandoahAllocRequest is word but region free capacity is in bytes.

It should be just one line change like:

if (alloc_capacity(r) >= min_size * HeapWordSize) {
   ...
}



### Test
- [x] make test TEST=hotspot_gc_shenandoah

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

Commit messages:
 - Bug fix: unit mismatch

Changes: https://git.openjdk.org/jdk/pull/26259/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26259&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8361948
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/26259.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26259/head:pull/26259

PR: https://git.openjdk.org/jdk/pull/26259


More information about the shenandoah-dev mailing list