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

Xiaolong Peng xpeng at openjdk.org
Thu Nov 6 19:01:22 UTC 2025


On Fri, 31 Oct 2025 22:09:18 GMT, Xiaolong Peng <xpeng at openjdk.org> wrote:

>> 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

Thanks a lot for the review.

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

PR Comment: https://git.openjdk.org/jdk/pull/28036#issuecomment-3498932713


More information about the hotspot-gc-dev mailing list