RFR: 8273626: G1: Factor out concurrent segmented array from G1CardSetAllocator [v6]

Albert Mingkun Yang ayang at openjdk.java.net
Sun Oct 17 22:44:50 UTC 2021


On Fri, 15 Oct 2021 01:24:23 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> To finish https://bugs.openjdk.java.net/browse/JDK-8254739, we need a segmented array to store a growing regions index array, in the initial version of that patch, a newly home made segmented array was used, but the memory efficiency is not as good as expected, G1CardSetAllocator is a potential candidate to fullfill the requirement, but need some enhancement.
>> 
>> This is a try to enhance G1CardSetAllocator(and G1CardSetBuffer, G1CardSetBufferList) to support element size less pointer size, and strip this basic function as a more generic segmented array (G1SegmentedArray).
>
> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
> 
>   refine code

This PR incorporates some cleanup/small improvement into the main refactoring, extraction of the segmented array class. Such additional and unnecessary changes make reviewing this PR much harder that it should be.

I will give a concrete example. `G1CardSetAllocator<Elem>::num_buffers` used to live in `inline.hpp`, but was moved the header and updated to use the new segmented array. It could be argued that this is more consistent together with its neighbor (`mem_size` and `wasted_mem_size`), so it's a fine change. However, embedding this change inside this relatively invasive refactoring is *very* distracting; what could have been a one-line change was scattered in multiple places.

src/hotspot/share/gc/g1/g1SegmentedArray.hpp line 175:

> 173: template <class Elem, MEMFLAGS flag>
> 174: class G1SegmentedArray {
> 175:   // G1CardSetAllocOptions provides parameters for allocation buffer

The name, `G1CardSetAllocOptions`, is incorrect.

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

Marked as reviewed by ayang (Reviewer).

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



More information about the hotspot-gc-dev mailing list