Skip to content

Commit a5ebcc0

Browse files
author
Ivan Walulya
committedMar 17, 2022
8282072: G1: Rename CardSetPtr to CardSetContainerPtr
Reviewed-by: ayang, tschatzl
1 parent 3da5204 commit a5ebcc0

8 files changed

+346
-353
lines changed
 

‎src/hotspot/share/gc/g1/g1CardSet.cpp

+201-204
Large diffs are not rendered by default.

‎src/hotspot/share/gc/g1/g1CardSet.hpp

+65-68
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@
2626
#define SHARE_GC_G1_G1CARDSET_HPP
2727

2828
#include "memory/allocation.hpp"
29-
#include "memory/padded.hpp"
30-
#include "oops/oopsHierarchy.hpp"
3129
#include "utilities/concurrentHashTable.hpp"
32-
#include "utilities/lockFreeStack.hpp"
3330

3431
class G1CardSetAllocOptions;
3532
class G1CardSetHashTable;
@@ -147,10 +144,10 @@ class G1CardSetConfiguration {
147144
class G1CardSetCoarsenStats {
148145
public:
149146
// Number of entries in the statistics tables: since we index with the source
150-
// cardset of the coarsening, this is the total number of combinations of
151-
// card sets - 1.
147+
// container of the coarsening, this is the total number of combinations of
148+
// card set containers - 1.
152149
static constexpr size_t NumCoarsenCategories = 7;
153-
// Coarsening statistics for the possible CardSetPtr in the Howl card set
150+
// Coarsening statistics for the possible ContainerPtr in the Howl card set
154151
// start from this offset.
155152
static constexpr size_t CoarsenHowlOffset = 4;
156153

@@ -173,14 +170,14 @@ class G1CardSetCoarsenStats {
173170
void print_on(outputStream* out);
174171
};
175172

176-
// Sparse set of card indexes comprising a remembered set on the Java heap. Card
173+
// Set of card indexes comprising a remembered set on the Java heap. Card
177174
// size is assumed to be card table card size.
178175
//
179176
// Technically it is implemented using a ConcurrentHashTable that stores a card
180177
// set container for every region containing at least one card.
181178
//
182179
// There are in total five different containers, encoded in the ConcurrentHashTable
183-
// node as CardSetPtr. A CardSetPtr may cover the whole region or just a part of
180+
// node as ContainerPtr. A ContainerPtr may cover the whole region or just a part of
184181
// it.
185182
// See its description below for more information.
186183
class G1CardSet : public CHeapObj<mtGCCardSet> {
@@ -194,46 +191,46 @@ class G1CardSet : public CHeapObj<mtGCCardSet> {
194191
static G1CardSetCoarsenStats _coarsen_stats; // Coarsening statistics since VM start.
195192
static G1CardSetCoarsenStats _last_coarsen_stats; // Coarsening statistics at last GC.
196193
public:
197-
// Two lower bits are used to encode the card storage types
198-
static const uintptr_t CardSetPtrHeaderSize = 2;
194+
// Two lower bits are used to encode the card set container types
195+
static const uintptr_t ContainerPtrHeaderSize = 2;
199196

200-
// CardSetPtr represents the card storage type of a given covered area. It encodes
201-
// a type in the LSBs, in addition to having a few significant values.
197+
// ContainerPtr represents the card set container type of a given covered area.
198+
// It encodes a type in the LSBs, in addition to having a few significant values.
202199
//
203200
// Possible encodings:
204201
//
205202
// 0...00000 free (Empty, should never happen)
206-
// 1...11111 full All card indexes in the whole area this CardSetPtr covers are part of this container.
207-
// X...XXX00 inline-ptr-cards A handful of card indexes covered by this CardSetPtr are encoded within the CardSetPtr.
203+
// 1...11111 full All card indexes in the whole area this ContainerPtr covers are part of this container.
204+
// X...XXX00 inline-ptr-cards A handful of card indexes covered by this ContainerPtr are encoded within the ContainerPtr.
208205
// X...XXX01 array of cards The container is a contiguous array of card indexes.
209206
// X...XXX10 bitmap The container uses a bitmap to determine whether a given index is part of this set.
210-
// X...XXX11 howl This is a card set container containing an array of CardSetPtr, with each CardSetPtr
207+
// X...XXX11 howl This is a card set container containing an array of ContainerPtr, with each ContainerPtr
211208
// limited to a sub-range of the original range. Currently only one level of this
212209
// container is supported.
213-
typedef void* CardSetPtr;
210+
using ContainerPtr = void*;
214211
// Coarsening happens in the order below:
215-
// CardSetInlinePtr -> CardSetArrayOfCards -> CardSetHowl -> Full
216-
// Corsening of containers inside the CardSetHowl happens in the order:
217-
// CardSetInlinePtr -> CardSetArrayOfCards -> CardSetBitMap -> Full
218-
static const uintptr_t CardSetInlinePtr = 0x0;
219-
static const uintptr_t CardSetArrayOfCards = 0x1;
220-
static const uintptr_t CardSetBitMap = 0x2;
221-
static const uintptr_t CardSetHowl = 0x3;
212+
// ContainerInlinePtr -> ContainerArrayOfCards -> ContainerHowl -> Full
213+
// Corsening of containers inside the ContainerHowl happens in the order:
214+
// ContainerInlinePtr -> ContainerArrayOfCards -> ContainerBitMap -> Full
215+
static const uintptr_t ContainerInlinePtr = 0x0;
216+
static const uintptr_t ContainerArrayOfCards = 0x1;
217+
static const uintptr_t ContainerBitMap = 0x2;
218+
static const uintptr_t ContainerHowl = 0x3;
222219

223220
// The special sentinel values
224-
static constexpr CardSetPtr FreeCardSet = nullptr;
225-
// Unfortunately we can't make (G1CardSet::CardSetPtr)-1 constexpr because
221+
static constexpr ContainerPtr FreeCardSet = nullptr;
222+
// Unfortunately we can't make (G1CardSet::ContainerPtr)-1 constexpr because
226223
// reinterpret_casts are forbidden in constexprs. Use a regular static instead.
227-
static CardSetPtr FullCardSet;
224+
static ContainerPtr FullCardSet;
228225

229-
static const uintptr_t CardSetPtrTypeMask = ((uintptr_t)1 << CardSetPtrHeaderSize) - 1;
226+
static const uintptr_t ContainerPtrTypeMask = ((uintptr_t)1 << ContainerPtrHeaderSize) - 1;
230227

231-
static CardSetPtr strip_card_set_type(CardSetPtr ptr) { return (CardSetPtr)((uintptr_t)ptr & ~CardSetPtrTypeMask); }
228+
static ContainerPtr strip_container_type(ContainerPtr ptr) { return (ContainerPtr)((uintptr_t)ptr & ~ContainerPtrTypeMask); }
232229

233-
static uint card_set_type(CardSetPtr ptr) { return (uintptr_t)ptr & CardSetPtrTypeMask; }
230+
static uint container_type(ContainerPtr ptr) { return (uintptr_t)ptr & ContainerPtrTypeMask; }
234231

235232
template <class T>
236-
static T* card_set_ptr(CardSetPtr ptr);
233+
static T* container_ptr(ContainerPtr ptr);
237234

238235
private:
239236
G1CardSetMemoryManager* _mm;
@@ -245,42 +242,42 @@ class G1CardSet : public CHeapObj<mtGCCardSet> {
245242
// be (slightly) more cards in the card set than this value in reality.
246243
size_t _num_occupied;
247244

248-
CardSetPtr make_card_set_ptr(void* value, uintptr_t type);
245+
ContainerPtr make_container_ptr(void* value, uintptr_t type);
249246

250-
CardSetPtr acquire_card_set(CardSetPtr volatile* card_set_addr);
251-
// Returns true if the card set should be released
252-
bool release_card_set(CardSetPtr card_set);
247+
ContainerPtr acquire_container(ContainerPtr volatile* container_addr);
248+
// Returns true if the card set container should be released
249+
bool release_container(ContainerPtr container);
253250
// Release card set and free if needed.
254-
void release_and_maybe_free_card_set(CardSetPtr card_set);
251+
void release_and_maybe_free_container(ContainerPtr container);
255252
// Release card set and free (and it must be freeable).
256-
void release_and_must_free_card_set(CardSetPtr card_set);
253+
void release_and_must_free_container(ContainerPtr container);
257254

258-
// Coarsens the CardSet cur_card_set to the next level; tries to replace the
259-
// previous CardSet with a new one which includes the given card_in_region.
260-
// coarsen_card_set does not transfer cards from cur_card_set
261-
// to the new card_set. Transfer is achieved by transfer_cards.
262-
// Returns true if this was the thread that coarsened the CardSet (and added the card).
263-
bool coarsen_card_set(CardSetPtr volatile* card_set_addr,
264-
CardSetPtr cur_card_set,
265-
uint card_in_region, bool within_howl = false);
255+
// Coarsens the card set container cur_container to the next level; tries to replace the
256+
// previous ContainerPtr with a new one which includes the given card_in_region.
257+
// coarsen_container does not transfer cards from cur_container
258+
// to the new container. Transfer is achieved by transfer_cards.
259+
// Returns true if this was the thread that coarsened the container (and added the card).
260+
bool coarsen_container(ContainerPtr volatile* container_addr,
261+
ContainerPtr cur_container,
262+
uint card_in_region, bool within_howl = false);
266263

267-
CardSetPtr create_coarsened_array_of_cards(uint card_in_region, bool within_howl);
264+
ContainerPtr create_coarsened_array_of_cards(uint card_in_region, bool within_howl);
268265

269266
// Transfer entries from source_card_set to a recently installed coarser storage type
270-
// We only need to transfer anything finer than CardSetBitMap. "Full" contains
267+
// We only need to transfer anything finer than ContainerBitMap. "Full" contains
271268
// all elements anyway.
272-
void transfer_cards(G1CardSetHashTableValue* table_entry, CardSetPtr source_card_set, uint card_region);
273-
void transfer_cards_in_howl(CardSetPtr parent_card_set, CardSetPtr source_card_set, uint card_region);
269+
void transfer_cards(G1CardSetHashTableValue* table_entry, ContainerPtr source_container, uint card_region);
270+
void transfer_cards_in_howl(ContainerPtr parent_container, ContainerPtr source_container, uint card_region);
274271

275-
G1AddCardResult add_to_card_set(CardSetPtr volatile* card_set_addr, CardSetPtr card_set, uint card_region, uint card, bool increment_total = true);
272+
G1AddCardResult add_to_container(ContainerPtr volatile* container_addr, ContainerPtr container, uint card_region, uint card, bool increment_total = true);
276273

277-
G1AddCardResult add_to_inline_ptr(CardSetPtr volatile* card_set_addr, CardSetPtr card_set, uint card_in_region);
278-
G1AddCardResult add_to_array(CardSetPtr card_set, uint card_in_region);
279-
G1AddCardResult add_to_bitmap(CardSetPtr card_set, uint card_in_region);
280-
G1AddCardResult add_to_howl(CardSetPtr parent_card_set, uint card_region, uint card_in_region, bool increment_total = true);
274+
G1AddCardResult add_to_inline_ptr(ContainerPtr volatile* container_addr, ContainerPtr container, uint card_in_region);
275+
G1AddCardResult add_to_array(ContainerPtr container, uint card_in_region);
276+
G1AddCardResult add_to_bitmap(ContainerPtr container, uint card_in_region);
277+
G1AddCardResult add_to_howl(ContainerPtr parent_container, uint card_region, uint card_in_region, bool increment_total = true);
281278

282-
G1CardSetHashTableValue* get_or_add_card_set(uint card_region, bool* should_grow_table);
283-
G1CardSetHashTableValue* get_card_set(uint card_region);
279+
G1CardSetHashTableValue* get_or_add_container(uint card_region, bool* should_grow_table);
280+
G1CardSetHashTableValue* get_container(uint card_region);
284281

285282
// Iterate over cards of a card set container during transfer of the cards from
286283
// one container to another. Executes
@@ -289,11 +286,11 @@ class G1CardSet : public CHeapObj<mtGCCardSet> {
289286
//
290287
// on the given class.
291288
template <class CardVisitor>
292-
void iterate_cards_during_transfer(CardSetPtr const card_set, CardVisitor& vl);
289+
void iterate_cards_during_transfer(ContainerPtr const container, CardVisitor& vl);
293290

294-
uint card_set_type_to_mem_object_type(uintptr_t type) const;
291+
uint container_type_to_mem_object_type(uintptr_t type) const;
295292
uint8_t* allocate_mem_object(uintptr_t type);
296-
void free_mem_object(CardSetPtr card_set);
293+
void free_mem_object(ContainerPtr container);
297294

298295
public:
299296
G1CardSetConfiguration* config() const { return _config; }
@@ -302,8 +299,8 @@ class G1CardSet : public CHeapObj<mtGCCardSet> {
302299
G1CardSet(G1CardSetConfiguration* config, G1CardSetMemoryManager* mm);
303300
virtual ~G1CardSet();
304301

305-
// Adds the given card to this set, returning an appropriate result. If added,
306-
// updates the total count.
302+
// Adds the given card to this set, returning an appropriate result.
303+
// If incremental_count is true and the card has been added, updates the total count.
307304
G1AddCardResult add_card(uint card_region, uint card_in_region, bool increment_total = true);
308305

309306
bool contains_card(uint card_region, uint card_in_region);
@@ -351,14 +348,14 @@ class G1CardSet : public CHeapObj<mtGCCardSet> {
351348
// start_iterate().
352349
//
353350
template <class CardOrRangeVisitor>
354-
void iterate_cards_or_ranges_in_container(CardSetPtr const card_set, CardOrRangeVisitor& cl);
351+
void iterate_cards_or_ranges_in_container(ContainerPtr const container, CardOrRangeVisitor& cl);
355352

356-
class CardSetPtrClosure {
353+
class ContainerPtrClosure {
357354
public:
358-
virtual void do_cardsetptr(uint region_idx, size_t num_occupied, CardSetPtr card_set) = 0;
355+
virtual void do_containerptr(uint region_idx, size_t num_occupied, ContainerPtr container) = 0;
359356
};
360357

361-
void iterate_containers(CardSetPtrClosure* cl, bool safepoint = false);
358+
void iterate_containers(ContainerPtrClosure* cl, bool safepoint = false);
362359

363360
class CardClosure {
364361
public:
@@ -370,13 +367,13 @@ class G1CardSet : public CHeapObj<mtGCCardSet> {
370367

371368
class G1CardSetHashTableValue {
372369
public:
373-
using CardSetPtr = G1CardSet::CardSetPtr;
370+
using ContainerPtr = G1CardSet::ContainerPtr;
374371

375372
const uint _region_idx;
376373
uint volatile _num_occupied;
377-
CardSetPtr volatile _card_set;
374+
ContainerPtr volatile _container;
378375

379-
G1CardSetHashTableValue(uint region_idx, CardSetPtr card_set) : _region_idx(region_idx), _num_occupied(0), _card_set(card_set) { }
376+
G1CardSetHashTableValue(uint region_idx, ContainerPtr container) : _region_idx(region_idx), _num_occupied(0), _container(container) { }
380377
};
381378

382379
class G1CardSetHashTableConfig : public StackObj {
@@ -391,6 +388,6 @@ class G1CardSetHashTableConfig : public StackObj {
391388
static void free_node(void* context, void* memory, Value const& value);
392389
};
393390

394-
typedef ConcurrentHashTable<G1CardSetHashTableConfig, mtGCCardSet> CardSetHash;
391+
using CardSetHash = ConcurrentHashTable<G1CardSetHashTableConfig, mtGCCardSet>;
395392

396393
#endif // SHARE_GC_G1_G1CARDSET_HPP

‎src/hotspot/share/gc/g1/g1CardSet.inline.hpp

+17-18
Original file line numberDiff line numberDiff line change
@@ -28,55 +28,54 @@
2828
#include "gc/g1/g1CardSet.hpp"
2929
#include "gc/g1/g1CardSetContainers.inline.hpp"
3030
#include "gc/g1/g1GCPhaseTimes.hpp"
31-
#include "runtime/atomic.hpp"
3231
#include "logging/log.hpp"
3332

3433
template <class T>
35-
inline T* G1CardSet::card_set_ptr(CardSetPtr ptr) {
36-
return (T*)strip_card_set_type(ptr);
34+
inline T* G1CardSet::container_ptr(ContainerPtr ptr) {
35+
return (T*)strip_container_type(ptr);
3736
}
3837

39-
inline G1CardSet::CardSetPtr G1CardSet::make_card_set_ptr(void* value, uintptr_t type) {
40-
assert(card_set_type(value) == 0, "Given ptr " PTR_FORMAT " already has type bits set", p2i(value));
41-
return (CardSetPtr)((uintptr_t)value | type);
38+
inline G1CardSet::ContainerPtr G1CardSet::make_container_ptr(void* value, uintptr_t type) {
39+
assert(container_type(value) == 0, "Given ptr " PTR_FORMAT " already has type bits set", p2i(value));
40+
return (ContainerPtr)((uintptr_t)value | type);
4241
}
4342

4443
template <class CardOrRangeVisitor>
45-
inline void G1CardSet::iterate_cards_or_ranges_in_container(CardSetPtr const card_set, CardOrRangeVisitor& cl) {
46-
switch (card_set_type(card_set)) {
47-
case CardSetInlinePtr: {
44+
inline void G1CardSet::iterate_cards_or_ranges_in_container(ContainerPtr const container, CardOrRangeVisitor& cl) {
45+
switch (container_type(container)) {
46+
case ContainerInlinePtr: {
4847
if (cl.start_iterate(G1GCPhaseTimes::MergeRSMergedInline)) {
49-
G1CardSetInlinePtr ptr(card_set);
48+
G1CardSetInlinePtr ptr(container);
5049
ptr.iterate(cl, _config->inline_ptr_bits_per_card());
5150
}
5251
return;
5352
}
54-
case CardSetArrayOfCards : {
53+
case ContainerArrayOfCards: {
5554
if (cl.start_iterate(G1GCPhaseTimes::MergeRSMergedArrayOfCards)) {
56-
card_set_ptr<G1CardSetArray>(card_set)->iterate(cl);
55+
container_ptr<G1CardSetArray>(container)->iterate(cl);
5756
}
5857
return;
5958
}
60-
case CardSetBitMap: {
59+
case ContainerBitMap: {
6160
// There is no first-level bitmap spanning the whole area.
6261
ShouldNotReachHere();
6362
return;
6463
}
65-
case CardSetHowl: {
66-
assert(card_set_type(FullCardSet) == CardSetHowl, "Must be");
67-
if (card_set == FullCardSet) {
64+
case ContainerHowl: {
65+
assert(container_type(FullCardSet) == ContainerHowl, "Must be");
66+
if (container == FullCardSet) {
6867
if (cl.start_iterate(G1GCPhaseTimes::MergeRSMergedFull)) {
6968
cl(0, _config->max_cards_in_region());
7069
}
7170
return;
7271
}
7372
if (cl.start_iterate(G1GCPhaseTimes::MergeRSMergedHowl)) {
74-
card_set_ptr<G1CardSetHowl>(card_set)->iterate(cl, _config);
73+
container_ptr<G1CardSetHowl>(container)->iterate(cl, _config);
7574
}
7675
return;
7776
}
7877
}
79-
log_error(gc)("Unkown card set type %u", card_set_type(card_set));
78+
log_error(gc)("Unkown card set container type %u", container_type(container));
8079
ShouldNotReachHere();
8180
}
8281

‎src/hotspot/share/gc/g1/g1CardSetContainers.hpp

+29-29
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "utilities/bitMap.hpp"
3232
#include "utilities/globalDefinitions.hpp"
3333

34-
// A helper class to encode a few card indexes within a CardSetPtr.
34+
// A helper class to encode a few card indexes within a ContainerPtr.
3535
//
3636
// The pointer value (either 32 or 64 bits) is split into two areas:
3737
//
@@ -65,26 +65,26 @@
6565
class G1CardSetInlinePtr : public StackObj {
6666
friend class G1CardSetContainersTest;
6767

68-
typedef G1CardSet::CardSetPtr CardSetPtr;
68+
using ContainerPtr = G1CardSet::ContainerPtr;
6969

70-
CardSetPtr volatile * _value_addr;
71-
CardSetPtr _value;
70+
ContainerPtr volatile * _value_addr;
71+
ContainerPtr _value;
7272

7373
static const uint SizeFieldLen = 3;
7474
static const uint SizeFieldPos = 2;
75-
static const uint HeaderSize = G1CardSet::CardSetPtrHeaderSize + SizeFieldLen;
75+
static const uint HeaderSize = G1CardSet::ContainerPtrHeaderSize + SizeFieldLen;
7676

77-
static const uint BitsInValue = sizeof(CardSetPtr) * BitsPerByte;
77+
static const uint BitsInValue = sizeof(ContainerPtr) * BitsPerByte;
7878

7979
static const uintptr_t SizeFieldMask = (((uint)1 << SizeFieldLen) - 1) << SizeFieldPos;
8080

8181
static uint8_t card_pos_for(uint const idx, uint const bits_per_card) {
8282
return (idx * bits_per_card + HeaderSize);
8383
}
8484

85-
static CardSetPtr merge(CardSetPtr orig_value, uint card_in_region, uint idx, uint bits_per_card);
85+
static ContainerPtr merge(ContainerPtr orig_value, uint card_in_region, uint idx, uint bits_per_card);
8686

87-
static uint card_at(CardSetPtr value, uint const idx, uint const bits_per_card) {
87+
static uint card_at(ContainerPtr value, uint const idx, uint const bits_per_card) {
8888
uint8_t card_pos = card_pos_for(idx, bits_per_card);
8989
uint result = ((uintptr_t)value >> card_pos) & (((uintptr_t)1 << bits_per_card) - 1);
9090
return result;
@@ -93,14 +93,14 @@ class G1CardSetInlinePtr : public StackObj {
9393
uint find(uint const card_idx, uint const bits_per_card, uint start_at, uint num_cards);
9494

9595
public:
96-
G1CardSetInlinePtr() : _value_addr(nullptr), _value((CardSetPtr)G1CardSet::CardSetInlinePtr) { }
96+
G1CardSetInlinePtr() : _value_addr(nullptr), _value((ContainerPtr)G1CardSet::ContainerInlinePtr) { }
9797

98-
G1CardSetInlinePtr(CardSetPtr value) : _value_addr(nullptr), _value(value) {
99-
assert(G1CardSet::card_set_type(_value) == G1CardSet::CardSetInlinePtr, "Value " PTR_FORMAT " is not a valid G1CardSetInPtr.", p2i(_value));
98+
G1CardSetInlinePtr(ContainerPtr value) : _value_addr(nullptr), _value(value) {
99+
assert(G1CardSet::container_type(_value) == G1CardSet::ContainerInlinePtr, "Value " PTR_FORMAT " is not a valid G1CardSetInlinePtr.", p2i(_value));
100100
}
101101

102-
G1CardSetInlinePtr(CardSetPtr volatile* value_addr, CardSetPtr value) : _value_addr(value_addr), _value(value) {
103-
assert(G1CardSet::card_set_type(_value) == G1CardSet::CardSetInlinePtr, "Value " PTR_FORMAT " is not a valid G1CardSetInPtr.", p2i(_value));
102+
G1CardSetInlinePtr(ContainerPtr volatile* value_addr, ContainerPtr value) : _value_addr(value_addr), _value(value) {
103+
assert(G1CardSet::container_type(_value) == G1CardSet::ContainerInlinePtr, "Value " PTR_FORMAT " is not a valid G1CardSetInlinePtr.", p2i(_value));
104104
}
105105

106106
G1AddCardResult add(uint const card_idx, uint const bits_per_card, uint const max_cards_in_inline_ptr);
@@ -110,13 +110,13 @@ class G1CardSetInlinePtr : public StackObj {
110110
template <class CardVisitor>
111111
void iterate(CardVisitor& found, uint const bits_per_card);
112112

113-
operator CardSetPtr () { return _value; }
113+
operator ContainerPtr () { return _value; }
114114

115115
static uint max_cards_in_inline_ptr(uint bits_per_card) {
116116
return (BitsInValue - HeaderSize) / bits_per_card;
117117
}
118118

119-
static uint num_cards_in(CardSetPtr value) {
119+
static uint num_cards_in(ContainerPtr value) {
120120
return ((uintptr_t)value & SizeFieldMask) >> SizeFieldPos;
121121
}
122122
};
@@ -139,7 +139,7 @@ class G1CardSetInlinePtr : public StackObj {
139139
// which requires that we increment the reference counts by 2 starting at _ref_count = 3.
140140
//
141141
// All but inline pointers are of this kind. For those, card entries are stored
142-
// directly in the CardSetPtr of the ConcurrentHashTable node.
142+
// directly in the ContainerPtr of the ConcurrentHashTable node.
143143
class G1CardSetContainer {
144144
uintptr_t _ref_count;
145145
protected:
@@ -163,7 +163,7 @@ class G1CardSetArray : public G1CardSetContainer {
163163
public:
164164
typedef uint16_t EntryDataType;
165165
typedef uint EntryCountType;
166-
using CardSetPtr = G1CardSet::CardSetPtr;
166+
using ContainerPtr = G1CardSet::ContainerPtr;
167167
private:
168168
EntryCountType _size;
169169
EntryCountType volatile _num_entries;
@@ -217,7 +217,7 @@ class G1CardSetBitMap : public G1CardSetContainer {
217217
size_t _num_bits_set;
218218
BitMap::bm_word_t _bits[1];
219219

220-
using CardSetPtr = G1CardSet::CardSetPtr;
220+
using ContainerPtr = G1CardSet::ContainerPtr;
221221

222222
template<typename Derived>
223223
static size_t header_size_in_bytes_internal() {
@@ -252,43 +252,43 @@ class G1CardSetBitMap : public G1CardSetContainer {
252252
class G1CardSetHowl : public G1CardSetContainer {
253253
public:
254254
typedef uint EntryCountType;
255-
using CardSetPtr = G1CardSet::CardSetPtr;
255+
using ContainerPtr = G1CardSet::ContainerPtr;
256256
EntryCountType volatile _num_entries;
257257
private:
258-
CardSetPtr _buckets[2];
258+
ContainerPtr _buckets[2];
259259
// Do not add class member variables beyond this point
260260

261261
template<typename Derived>
262262
static size_t header_size_in_bytes_internal() {
263263
return offset_of(Derived, _buckets);
264264
}
265265

266-
// Iterates over the given CardSetPtr with at index in this Howl card set,
266+
// Iterates over the given ContainerPtr with at index in this Howl card set,
267267
// applying a CardOrRangeVisitor on it.
268268
template <class CardOrRangeVisitor>
269-
void iterate_cardset(CardSetPtr const card_set, uint index, CardOrRangeVisitor& found, G1CardSetConfiguration* config);
269+
void iterate_cardset(ContainerPtr const container, uint index, CardOrRangeVisitor& found, G1CardSetConfiguration* config);
270270

271271
public:
272272
G1CardSetHowl(EntryCountType card_in_region, G1CardSetConfiguration* config);
273273

274-
CardSetPtr* get_card_set_addr(EntryCountType index) {
274+
ContainerPtr* get_container_addr(EntryCountType index) {
275275
return &_buckets[index];
276276
}
277277

278278
bool contains(uint card_idx, G1CardSetConfiguration* config);
279279

280-
// Iterates over all CardSetPtrs in this Howl card set, applying a CardOrRangeVisitor
280+
// Iterates over all ContainerPtrs in this Howl card set, applying a CardOrRangeVisitor
281281
// on it.
282282
template <class CardOrRangeVisitor>
283283
void iterate(CardOrRangeVisitor& found, G1CardSetConfiguration* config);
284284

285-
// Iterates over all CardSetPtrs in this Howl card set. Calls
285+
// Iterates over all ContainerPtrs in this Howl card set. Calls
286286
//
287-
// void operator ()(CardSetPtr* card_set_addr);
287+
// void operator ()(ContainerPtr* card_set_addr);
288288
//
289289
// on all of them.
290-
template <class CardSetPtrVisitor>
291-
void iterate(CardSetPtrVisitor& found, uint num_card_sets);
290+
template <class ContainerPtrVisitor>
291+
void iterate(ContainerPtrVisitor& found, uint num_card_sets);
292292

293293
static EntryCountType num_buckets(size_t size_in_bits, size_t num_cards_in_array, size_t max_buckets);
294294

@@ -300,7 +300,7 @@ class G1CardSetHowl : public G1CardSetContainer {
300300
static size_t header_size_in_bytes() { return header_size_in_bytes_internal<G1CardSetHowl>(); }
301301

302302
static size_t size_in_bytes(size_t num_arrays) {
303-
return header_size_in_bytes() + sizeof(CardSetPtr) * num_arrays;
303+
return header_size_in_bytes() + sizeof(ContainerPtr) * num_arrays;
304304
}
305305
};
306306

‎src/hotspot/share/gc/g1/g1CardSetContainers.inline.hpp

+28-28
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "utilities/globalDefinitions.hpp"
3232
#include "utilities/spinYield.hpp"
3333

34-
inline G1CardSetInlinePtr::CardSetPtr G1CardSetInlinePtr::merge(CardSetPtr orig_value, uint card_in_region, uint idx, uint bits_per_card) {
34+
inline G1CardSetInlinePtr::ContainerPtr G1CardSetInlinePtr::merge(ContainerPtr orig_value, uint card_in_region, uint idx, uint bits_per_card) {
3535
assert((idx & (SizeFieldMask >> SizeFieldPos)) == idx, "Index %u too large to fit into size field", idx);
3636
assert(card_in_region < ((uint)1 << bits_per_card), "Card %u too large to fit into card value field", card_in_region);
3737

@@ -44,7 +44,7 @@ inline G1CardSetInlinePtr::CardSetPtr G1CardSetInlinePtr::merge(CardSetPtr orig_
4444

4545
uintptr_t value = ((uintptr_t)(idx + 1) << SizeFieldPos) | ((uintptr_t)card_in_region << card_pos);
4646
uintptr_t res = (((uintptr_t)orig_value & ~SizeFieldMask) | value);
47-
return (CardSetPtr)res;
47+
return (ContainerPtr)res;
4848
}
4949

5050
inline G1AddCardResult G1CardSetInlinePtr::add(uint card_idx, uint bits_per_card, uint max_cards_in_inline_ptr) {
@@ -64,16 +64,16 @@ inline G1AddCardResult G1CardSetInlinePtr::add(uint card_idx, uint bits_per_card
6464
if (num_cards >= max_cards_in_inline_ptr) {
6565
return Overflow;
6666
}
67-
CardSetPtr new_value = merge(_value, card_idx, num_cards, bits_per_card);
68-
CardSetPtr old_value = Atomic::cmpxchg(_value_addr, _value, new_value, memory_order_relaxed);
67+
ContainerPtr new_value = merge(_value, card_idx, num_cards, bits_per_card);
68+
ContainerPtr old_value = Atomic::cmpxchg(_value_addr, _value, new_value, memory_order_relaxed);
6969
if (_value == old_value) {
7070
return Added;
7171
}
7272
// Update values and retry.
7373
_value = old_value;
7474
// The value of the pointer may have changed to something different than
7575
// an inline card set. Exit then instead of overwriting.
76-
if (G1CardSet::card_set_type(_value) != G1CardSet::CardSetInlinePtr) {
76+
if (G1CardSet::container_type(_value) != G1CardSet::ContainerInlinePtr) {
7777
return Overflow;
7878
}
7979
}
@@ -268,23 +268,23 @@ inline G1CardSetHowl::G1CardSetHowl(EntryCountType card_in_region, G1CardSetConf
268268

269269
inline bool G1CardSetHowl::contains(uint card_idx, G1CardSetConfiguration* config) {
270270
EntryCountType bucket = config->howl_bucket_index(card_idx);
271-
CardSetPtr* array_entry = get_card_set_addr(bucket);
272-
CardSetPtr card_set = Atomic::load_acquire(array_entry);
271+
ContainerPtr* array_entry = get_container_addr(bucket);
272+
ContainerPtr container = Atomic::load_acquire(array_entry);
273273

274-
switch (G1CardSet::card_set_type(card_set)) {
275-
case G1CardSet::CardSetArrayOfCards : {
276-
return G1CardSet::card_set_ptr<G1CardSetArray>(card_set)->contains(card_idx);
274+
switch (G1CardSet::container_type(container)) {
275+
case G1CardSet::ContainerArrayOfCards: {
276+
return G1CardSet::container_ptr<G1CardSetArray>(container)->contains(card_idx);
277277
}
278-
case G1CardSet::CardSetBitMap: {
278+
case G1CardSet::ContainerBitMap: {
279279
uint card_offset = config->howl_bitmap_offset(card_idx);
280-
return G1CardSet::card_set_ptr<G1CardSetBitMap>(card_set)->contains(card_offset, config->max_cards_in_howl_bitmap());
280+
return G1CardSet::container_ptr<G1CardSetBitMap>(container)->contains(card_offset, config->max_cards_in_howl_bitmap());
281281
}
282-
case G1CardSet::CardSetInlinePtr: {
283-
G1CardSetInlinePtr ptr(card_set);
282+
case G1CardSet::ContainerInlinePtr: {
283+
G1CardSetInlinePtr ptr(container);
284284
return ptr.contains(card_idx, config->inline_ptr_bits_per_card());
285285
}
286-
case G1CardSet::CardSetHowl: {// Fullcard set entry
287-
assert(card_set == G1CardSet::FullCardSet, "Must be");
286+
case G1CardSet::ContainerHowl: {// Fullcard set entry
287+
assert(container == G1CardSet::FullCardSet, "Must be");
288288
return true;
289289
}
290290
}
@@ -298,38 +298,38 @@ inline void G1CardSetHowl::iterate(CardOrRangeVisitor& found, G1CardSetConfigura
298298
}
299299
}
300300

301-
template <class CardSetPtrVisitor>
302-
inline void G1CardSetHowl::iterate(CardSetPtrVisitor& found, uint num_card_sets) {
301+
template <class ContainerPtrVisitor>
302+
inline void G1CardSetHowl::iterate(ContainerPtrVisitor& found, uint num_card_sets) {
303303
for (uint i = 0; i < num_card_sets; ++i) {
304304
found(&_buckets[i]);
305305
}
306306
}
307307

308308
template <class CardOrRangeVisitor>
309-
inline void G1CardSetHowl::iterate_cardset(CardSetPtr const card_set, uint index, CardOrRangeVisitor& found, G1CardSetConfiguration* config) {
310-
switch (G1CardSet::card_set_type(card_set)) {
311-
case G1CardSet::CardSetInlinePtr: {
309+
inline void G1CardSetHowl::iterate_cardset(ContainerPtr const container, uint index, CardOrRangeVisitor& found, G1CardSetConfiguration* config) {
310+
switch (G1CardSet::container_type(container)) {
311+
case G1CardSet::ContainerInlinePtr: {
312312
if (found.start_iterate(G1GCPhaseTimes::MergeRSHowlInline)) {
313-
G1CardSetInlinePtr ptr(card_set);
313+
G1CardSetInlinePtr ptr(container);
314314
ptr.iterate(found, config->inline_ptr_bits_per_card());
315315
}
316316
return;
317317
}
318-
case G1CardSet::CardSetArrayOfCards : {
318+
case G1CardSet::ContainerArrayOfCards: {
319319
if (found.start_iterate(G1GCPhaseTimes::MergeRSHowlArrayOfCards)) {
320-
G1CardSet::card_set_ptr<G1CardSetArray>(card_set)->iterate(found);
320+
G1CardSet::container_ptr<G1CardSetArray>(container)->iterate(found);
321321
}
322322
return;
323323
}
324-
case G1CardSet::CardSetBitMap: {
324+
case G1CardSet::ContainerBitMap: {
325325
if (found.start_iterate(G1GCPhaseTimes::MergeRSHowlBitmap)) {
326326
uint offset = index << config->log2_max_cards_in_howl_bitmap();
327-
G1CardSet::card_set_ptr<G1CardSetBitMap>(card_set)->iterate(found, config->max_cards_in_howl_bitmap(), offset);
327+
G1CardSet::container_ptr<G1CardSetBitMap>(container)->iterate(found, config->max_cards_in_howl_bitmap(), offset);
328328
}
329329
return;
330330
}
331-
case G1CardSet::CardSetHowl: { // actually FullCardSet
332-
assert(card_set == G1CardSet::FullCardSet, "Must be");
331+
case G1CardSet::ContainerHowl: { // actually FullCardSet
332+
assert(container == G1CardSet::FullCardSet, "Must be");
333333
if (found.start_iterate(G1GCPhaseTimes::MergeRSHowlFull)) {
334334
uint offset = index << config->log2_max_cards_in_howl_bitmap();
335335
found(offset, config->max_cards_in_howl_bitmap());

‎src/hotspot/share/gc/g1/heapRegionRemSet.inline.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class G1ContainerCardsOrRanges {
7878
};
7979

8080
template <typename Closure, template <typename> class CardOrRanges>
81-
class G1HeapRegionRemSetMergeCardClosure : public G1CardSet::CardSetPtrClosure {
81+
class G1HeapRegionRemSetMergeCardClosure : public G1CardSet::ContainerPtrClosure {
8282
G1CardSet* _card_set;
8383
Closure& _cl;
8484
uint _log_card_regions_per_region;
@@ -98,11 +98,11 @@ class G1HeapRegionRemSetMergeCardClosure : public G1CardSet::CardSetPtrClosure {
9898
_log_card_region_size(log_card_region_size) {
9999
}
100100

101-
void do_cardsetptr(uint card_region_idx, size_t num_occupied, G1CardSet::CardSetPtr card_set) override {
101+
void do_containerptr(uint card_region_idx, size_t num_occupied, G1CardSet::ContainerPtr container) override {
102102
CardOrRanges<Closure> cl(_cl,
103103
card_region_idx >> _log_card_regions_per_region,
104104
(card_region_idx & _card_regions_per_region_mask) << _log_card_region_size);
105-
_card_set->iterate_cards_or_ranges_in_container(card_set, cl);
105+
_card_set->iterate_cards_or_ranges_in_container(container, cl);
106106
}
107107
};
108108

‎test/hotspot/gtest/gc/g1/test_g1CardSet.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,13 @@ void G1CardSetTest::translate_cards(uint cards_per_region, uint region_idx, uint
165165
}
166166
}
167167

168-
class G1CountCardsOccupied : public G1CardSet::CardSetPtrClosure {
168+
class G1CountCardsOccupied : public G1CardSet::ContainerPtrClosure {
169169
size_t _num_occupied;
170170

171171
public:
172172
G1CountCardsOccupied() : _num_occupied(0) { }
173173

174-
void do_cardsetptr(uint region_idx, size_t num_occupied, G1CardSet::CardSetPtr card_set) override {
174+
void do_containerptr(uint region_idx, size_t num_occupied, G1CardSet::ContainerPtr container) override {
175175
_num_occupied += num_occupied;
176176
}
177177

‎test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void G1CardSetContainersTest::cardset_inlineptr_test(uint bits_per_card) {
8383

8484
G1AddCardResult res;
8585

86-
G1CardSet::CardSetPtr value = G1CardSetInlinePtr();
86+
G1CardSet::ContainerPtr value = G1CardSetInlinePtr();
8787

8888
for (uint i = 0; i < CardsPerSet; i++) {
8989
{

0 commit comments

Comments
 (0)
Please sign in to comment.