Discussion about unifying the wording buffer/node/element in G1, especially classes using G1SegmentedArray and related classes

lihuaming (A) lihuaming3 at huawei.com
Fri Nov 12 08:23:00 UTC 2021


Hi all,

May I have your attention to discuss about unifying the wording buffer/node/element in G1, especially classes using G1SegmentedArray and related classes.

Background: 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: A segmented array consists of several buffers one of which consists of several element (or node? we should choose one of element or node).

I propose to use "segmented array -> buffer -> elem/element", the reasons are: first, "node" is used as memory node, numa node, which is used in lots of other places, e.g. heapRegion, heapRegionSet, G1Allocator,..., while "buffer + node" together is used as buffer in BufferNode/G1BufferNodeList (these classes will not be changes), so "node" should not be used as "element"; In G1CardSet and G1CardSetContainer, most of comments/variables use "elem" rather than "node" for single element.

Here is a list of proposed rename mappings, related JBS issues are attached below, would you mind to share your points about this renaming mapping? Thanks.

G1CardSetHashTableConfig::allocate_node

node -> elem

G1CardSetHashTableConfig::free_node

node -> elem


G1CardSetAllocOptions::BufferAlignment

G1CardSetAllocOptions::ElemAlignment


G1CardSetAllocator::next_ptr(G1CardSetContainer& node)

node -> elem

G1CardSetAllocator::NodeStack

node -> elem

G1CardSetAllocator::_free_nodes_list

node -> elem

G1CardSetAllocator::_pending_nodes_list

node -> elem

G1CardSetAllocator::_num_pending_nodes

node -> elem

G1CardSetAllocator::_num_free_nodes

node -> elem

G1CardSetAllocator comments

node -> elem


G1CardSetMemoryStats

G1SegmentedArrayMemoryStats


G1CardSetFreePool

G1SegmentedArrayFreePool


G1CardSetMemoryManager::allocate_node

node -> elem

G1CardSetMemoryManager::free_node

node -> elem


G1CardSetFreeMemoryTask

G1SegmentedArrayFreeMemoryTask


G1SegmentedArrayBufferList

G1SegmentedArrayFreeList

G1SegmentedArrayBufferList::next_ptr(G1SegmentedArrayBuffer<flag>& node)

node -> buffer

G1SegmentedArrayBufferList::NodeStack

node -> buffer



G1SegmentedArray::_num_available_nodes

node -> elem

G1SegmentedArray::_num_allocated_nodes

node -> elem

G1SegmentedArray::num_available_nodes()

node -> elem

G1SegmentedArray::num_allocated_nodes()

node -> elem

G1SegmentedArray::iterate_nodes

node -> buffer


G1EvacFailureObjectsIterationHelper::do_buffer(G1SegmentedArrayBuffer<mtGC>* node, uint length)

node -> elem


Thanks
-Hamlin

[1] https://bugs.openjdk.java.net/browse/JDK-8276299
[2] https://bugs.openjdk.java.net/browse/JDK-8276670




More information about the hotspot-gc-dev mailing list