212
213 // Mem size in bytes.
214 size_t mem_size() const {
215 return sizeof(PerRegionTable) + _bm.size_in_words() * HeapWordSize;
216 }
217
218 // Requires "from" to be in "hr()".
219 bool contains_reference(OopOrNarrowOopStar from) const {
220 assert(hr()->is_in_reserved(from), "Precondition.");
221 size_t card_ind = pointer_delta(from, hr()->bottom(),
222 G1CardTable::card_size);
223 return _bm.at(card_ind);
224 }
225
226 // Bulk-free the PRTs from prt to last, assumes that they are
227 // linked together using their _next field.
228 static void bulk_free(PerRegionTable* prt, PerRegionTable* last) {
229 while (true) {
230 PerRegionTable* fl = _free_list;
231 last->set_next(fl);
232 PerRegionTable* res = Atomic::cmpxchg(prt, &_free_list, fl);
233 if (res == fl) {
234 return;
235 }
236 }
237 ShouldNotReachHere();
238 }
239
240 static void free(PerRegionTable* prt) {
241 bulk_free(prt, prt);
242 }
243
244 // Returns an initialized PerRegionTable instance.
245 static PerRegionTable* alloc(HeapRegion* hr);
246
247 PerRegionTable* next() const { return _next; }
248 void set_next(PerRegionTable* next) { _next = next; }
249 PerRegionTable* prev() const { return _prev; }
250 void set_prev(PerRegionTable* prev) { _prev = prev; }
251
252 // Accessor and Modification routines for the pointer for the
|
212
213 // Mem size in bytes.
214 size_t mem_size() const {
215 return sizeof(PerRegionTable) + _bm.size_in_words() * HeapWordSize;
216 }
217
218 // Requires "from" to be in "hr()".
219 bool contains_reference(OopOrNarrowOopStar from) const {
220 assert(hr()->is_in_reserved(from), "Precondition.");
221 size_t card_ind = pointer_delta(from, hr()->bottom(),
222 G1CardTable::card_size);
223 return _bm.at(card_ind);
224 }
225
226 // Bulk-free the PRTs from prt to last, assumes that they are
227 // linked together using their _next field.
228 static void bulk_free(PerRegionTable* prt, PerRegionTable* last) {
229 while (true) {
230 PerRegionTable* fl = _free_list;
231 last->set_next(fl);
232 PerRegionTable* res = Atomic::cmpxchg(&_free_list, fl, prt);
233 if (res == fl) {
234 return;
235 }
236 }
237 ShouldNotReachHere();
238 }
239
240 static void free(PerRegionTable* prt) {
241 bulk_free(prt, prt);
242 }
243
244 // Returns an initialized PerRegionTable instance.
245 static PerRegionTable* alloc(HeapRegion* hr);
246
247 PerRegionTable* next() const { return _next; }
248 void set_next(PerRegionTable* next) { _next = next; }
249 PerRegionTable* prev() const { return _prev; }
250 void set_prev(PerRegionTable* prev) { _prev = prev; }
251
252 // Accessor and Modification routines for the pointer for the
|