69 if (card_in_cache == card) {
70 return true;
71 } else {
72 set(worker_id, region_idx, card);
73 return false;
74 }
75 }
76
77 static int at(uint worker_id, uint region_idx) {
78 return _cache[worker_id][region_idx];
79 }
80
81 static void set(uint worker_id, uint region_idx, int val) {
82 _cache[worker_id][region_idx] = val;
83 }
84
85 static void initialize(uint n_par_rs, uint max_num_regions);
86
87 static void invalidate(uint start_idx, size_t num_regions);
88
89 static void print(outputStream* out = gclog_or_tty) PRODUCT_RETURN;
90
91 static size_t static_mem_size() {
92 return _static_mem_size;
93 }
94 };
95
96 // The "_coarse_map" is a bitmap with one bit for each region, where set
97 // bits indicate that the corresponding region may contain some pointer
98 // into the owning region.
99
100 // The "_fine_grain_entries" array is an open hash table of PerRegionTables
101 // (PRTs), indicating regions for which we're keeping the RS as a set of
102 // cards. The strategy is to cap the size of the fine-grain table,
103 // deleting an entry and setting the corresponding coarse-grained bit when
104 // we would overflow this cap.
105
106 // We use a mixture of locking and lock-free techniques here. We allow
107 // threads to locate PRTs without locking, but threads attempting to alter
108 // a bucket list obtain a lock. This means that any failing attempt to
109 // find a PRT must be retried with the lock. It might seem dangerous that
|
69 if (card_in_cache == card) {
70 return true;
71 } else {
72 set(worker_id, region_idx, card);
73 return false;
74 }
75 }
76
77 static int at(uint worker_id, uint region_idx) {
78 return _cache[worker_id][region_idx];
79 }
80
81 static void set(uint worker_id, uint region_idx, int val) {
82 _cache[worker_id][region_idx] = val;
83 }
84
85 static void initialize(uint n_par_rs, uint max_num_regions);
86
87 static void invalidate(uint start_idx, size_t num_regions);
88
89 static void print(outputStream* out = tty) PRODUCT_RETURN;
90
91 static size_t static_mem_size() {
92 return _static_mem_size;
93 }
94 };
95
96 // The "_coarse_map" is a bitmap with one bit for each region, where set
97 // bits indicate that the corresponding region may contain some pointer
98 // into the owning region.
99
100 // The "_fine_grain_entries" array is an open hash table of PerRegionTables
101 // (PRTs), indicating regions for which we're keeping the RS as a set of
102 // cards. The strategy is to cap the size of the fine-grain table,
103 // deleting an entry and setting the corresponding coarse-grained bit when
104 // we would overflow this cap.
105
106 // We use a mixture of locking and lock-free techniques here. We allow
107 // threads to locate PRTs without locking, but threads attempting to alter
108 // a bucket list obtain a lock. This means that any failing attempt to
109 // find a PRT must be retried with the lock. It might seem dangerous that
|