RFR: 8370850: Shenandoah: Simplify collector allocation to save unnecessary region iteration [v2]

Xiaolong Peng xpeng at openjdk.org
Fri Oct 31 20:45:37 UTC 2025


> To allocate an object in Collector/OldCollector partition, current implementation may traverse the regions in the partition twice:
> 1. fast path: traverse regions between left most and right most in the partition,  and try to allocate in an affiliated region in the partition;  
> 2. if fails in fast path, traverse regions between left most empty and right most empty in the partition, and try try to allocate in a FREE region.
> 
> 2 can be saved if we also remember the first FREE region seem in 1.
> 
> The PR makes the code much cleaner, and more efficient(although the performance impact may not be measurable, I have run some dacapo benchmarks and didn't see meaningful difference) 
> 
> 
> Test:
> - [x] hotspot_gc_shenandoah

Xiaolong Peng has updated the pull request incrementally with two additional commits since the last revision:

 - Remove condition check for trash region
 - Address the PR review comments

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/28036/files
  - new: https://git.openjdk.org/jdk/pull/28036/files/81cd8ab0..2c73b9f7

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28036&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28036&range=00-01

  Stats: 31 lines in 2 files changed: 22 ins; 2 del; 7 mod
  Patch: https://git.openjdk.org/jdk/pull/28036.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28036/head:pull/28036

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


More information about the hotspot-gc-dev mailing list