RFR: 8276299: G1: Unify the wording buffer/node/element in G1SegmentedArrayXxx, G1CardSetXxx and related classes

Thomas Schatzl tschatzl at openjdk.java.net
Wed Dec 1 10:19:28 UTC 2021


On Tue, 30 Nov 2021 02:11:30 GMT, Hamlin Li <mli at openjdk.org> wrote:

> Currently, the words "buffer", "node" and "element" are used together in G1SegmentedArrayXxx, G1CardSetXxx and related classes in an inconsistent way, which is very unfavorable for understanding.
> 
> We should not confuse buffer and node together, and not confuse node and element together. The new wording should be based on something like the following rule:
> 
> segmented array (1) -- segment (N) -- slot (M)

I think this is good apart from the minor formatting issues.

src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp line 169:

> 167: inline G1AddCardResult G1CardSetArray::add(uint card_idx) {
> 168:   assert(card_idx < (1u << (sizeof(_data[0]) * BitsPerByte)),
> 169:          "Card index %u does not fit card entry.", card_idx);

Suggestion:

         "Card index %u does not fit allowed card value range.", card_idx);

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

> 154: 
> 155: // A segmented array where G1SegmentedArraySegment is the segment, and
> 156: // G1SegmentedArrayFreeList is the free list to cache G1SegmentedArraySegment,

Suggestion:

// G1SegmentedArrayFreeList is the free list to cache G1SegmentedArraySegments,

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

> 193: 
> 194:   G1SegmentedArrayFreeList<flag>* _free_segment_list; // The global free segment list to
> 195:                                                          // preferentially get new segments from.

Suggestion:

  G1SegmentedArrayFreeList<flag>* _free_segment_list;  // The global free segment list to
                                                       // preferentially get new segments from.

(not sure I got the alignment of the comment slashes with the section above correct :); but at least the slashes should be aligned within that comment)

src/hotspot/share/gc/g1/g1SegmentedArray.inline.hpp line 222:

> 220: 
> 221:   while (true) {
> 222:     Slot* slot = (Slot*) cur->get_new_slot();

Suggestion:

    Slot* slot = (Slot*)cur->get_new_slot();

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

Marked as reviewed by tschatzl (Reviewer).

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



More information about the hotspot-gc-dev mailing list