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

Xiaolong Peng xpeng at openjdk.org
Fri Oct 31 22:09:18 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 with a new target base due to a merge or a rebase. The pull request now contains 13 commits:

 - Remove can_allocate_in_new_region
 - Merge remote-tracking branch 'origin/master' into collector-allocation
 - Remove condition check for trash region
 - Address the PR review comments
 - Merge branch 'openjdk:master' into collector-allocation
 - Touch up
 - Remove test 'req.is_old()' when steal an empty region from the mutator view
 - Update comment
 - Fix wrong condition when steal an empty region from the mutator view
 - Fix potential failure in young evac
 - ... and 3 more: https://git.openjdk.org/jdk/compare/ec059c0e...8e01d691

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

Changes: https://git.openjdk.org/jdk/pull/28036/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28036&range=02
  Stats: 77 lines in 2 files changed: 18 ins; 45 del; 14 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