@@ -41,6 +41,17 @@ G1CardSet::ContainerPtr G1CardSet::FullCardSet = (G1CardSet::ContainerPtr)-1;
41
41
uint G1CardSet::_split_card_shift = 0 ;
42
42
size_t G1CardSet::_split_card_mask = 0 ;
43
43
44
+ class G1CardSetHashTableConfig : public StackObj {
45
+ public:
46
+ using Value = G1CardSetHashTableValue;
47
+
48
+ static uintx get_hash (Value const & value, bool * is_dead);
49
+ static void * allocate_node (void * context, size_t size, Value const & value);
50
+ static void free_node (void * context, void * memory, Value const & value);
51
+ };
52
+
53
+ using CardSetHash = ConcurrentHashTable<G1CardSetHashTableConfig, mtGCCardSet>;
54
+
44
55
static uint default_log2_card_regions_per_region () {
45
56
uint log2_card_regions_per_heap_region = 0 ;
46
57
@@ -241,7 +252,7 @@ class G1CardSetHashTable : public CHeapObj<mtGCCardSet> {
241
252
public:
242
253
explicit G1CardSetHashTableLookUp (uint region_idx) : _region_idx(region_idx) { }
243
254
244
- uintx get_hash () const { return _region_idx; }
255
+ uintx get_hash () const { return G1CardSetHashTable::get_hash ( _region_idx) ; }
245
256
246
257
bool equals (G1CardSetHashTableValue* value, bool * is_dead) {
247
258
*is_dead = false ;
@@ -307,6 +318,10 @@ class G1CardSetHashTable : public CHeapObj<mtGCCardSet> {
307
318
return found.value ();
308
319
}
309
320
321
+ static uint get_hash (uint region_idx) {
322
+ return region_idx;
323
+ }
324
+
310
325
G1CardSetHashTableValue* get (uint region_idx) {
311
326
G1CardSetHashTableLookUp lookup (region_idx);
312
327
G1CardSetHashTableFound found;
@@ -345,6 +360,11 @@ class G1CardSetHashTable : public CHeapObj<mtGCCardSet> {
345
360
size_t log_table_size () { return _table.get_size_log2 (Thread::current ()); }
346
361
};
347
362
363
+ uintx G1CardSetHashTableConfig::get_hash (Value const & value, bool * is_dead) {
364
+ *is_dead = false ;
365
+ return G1CardSetHashTable::get_hash (value._region_idx );
366
+ }
367
+
348
368
void * G1CardSetHashTableConfig::allocate_node (void * context, size_t size, Value const & value) {
349
369
G1CardSetMemoryManager* mm = (G1CardSetMemoryManager*)context;
350
370
return mm->allocate_node ();
0 commit comments