RFR: 8254739: G1: Optimize evacuation failure for regions with few failed objects [v18]

Hamlin Li mli at openjdk.java.net
Wed Nov 3 12:39:51 UTC 2021


On Wed, 3 Nov 2021 12:03:25 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> Hamlin Li has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 19 commits:
>> 
>>  - Merge branch 'openjdk:master' into speedup-iterate-evac-failure-objs-in-one-region
>>  - Refine code based on Thomas' suggestion
>>  - Merge branch 'openjdk:master' into speedup-iterate-evac-failure-objs-in-one-region
>>  - Fix compilation error
>>  - Fix compilation error
>>  - Refactor as Thomas suggested
>>  - Rename from g1EvacuationFailureObjsInHR to g1EvacFailureObjsInHR
>>  - Add asserts, comments
>>  - Use refactored G1SegmentedArray rather than home-made Array+Node
>>  - Fix wrong merge
>>  - ... and 9 more: https://git.openjdk.java.net/jdk/compare/bb92fb02...d33f87b4
>
> src/hotspot/share/gc/g1/g1EvacFailureObjectsSet.cpp line 114:
> 
>> 112:   void iterate(ObjectClosure* closure) {
>> 113:     join_and_sort();
>> 114:     iterate_internal(closure);
> 
> I would probably move the array allocation and freeing here instead of having this at the start and end of `join_and_sort` and `iterate_internal` respectively. Otherwise there is a hidden dependency on the first method allocating and the second freeing it, and looks cleaner as allocation and deallocation is obvious and on the same call level.
> 
> I.e.
> 
> 
>   void iterate(ObjectClosure* closure) {
>      uint num = _segments->num_allocated_nodes();
>     _offset_array = NEW_C_HEAP_ARRAY(OffsetInRegion, num, mtGC);
> 
>     join_and_sort();
>     iterate_internal(closure);
> 
>     FREE_C_HEAP_ARRAY(OffsetInRegion, _offset_array);
>   }

Thanks Thomas, good catch.

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

PR: https://git.openjdk.java.net/jdk/pull/5181


More information about the hotspot-gc-dev mailing list