equal
deleted
inserted
replaced
111 } |
111 } |
112 } |
112 } |
113 |
113 |
114 public: |
114 public: |
115 |
115 |
116 HeapRegion* hr() const { |
116 HeapRegion* hr() const { return OrderAccess::load_acquire(&_hr); } |
117 return (HeapRegion*) OrderAccess::load_ptr_acquire(&_hr); |
|
118 } |
|
119 |
117 |
120 jint occupied() const { |
118 jint occupied() const { |
121 // Overkill, but if we ever need it... |
119 // Overkill, but if we ever need it... |
122 // guarantee(_occupied == _bm.count_one_bits(), "Check"); |
120 // guarantee(_occupied == _bm.count_one_bits(), "Check"); |
123 return _occupied; |
121 return _occupied; |
131 _collision_list_next = NULL; |
129 _collision_list_next = NULL; |
132 _occupied = 0; |
130 _occupied = 0; |
133 _bm.clear(); |
131 _bm.clear(); |
134 // Make sure that the bitmap clearing above has been finished before publishing |
132 // Make sure that the bitmap clearing above has been finished before publishing |
135 // this PRT to concurrent threads. |
133 // this PRT to concurrent threads. |
136 OrderAccess::release_store_ptr(&_hr, hr); |
134 OrderAccess::release_store(&_hr, hr); |
137 } |
135 } |
138 |
136 |
139 void add_reference(OopOrNarrowOopStar from) { |
137 void add_reference(OopOrNarrowOopStar from) { |
140 add_reference_work(from, /*parallel*/ true); |
138 add_reference_work(from, /*parallel*/ true); |
141 } |
139 } |
180 // linked together using their _next field. |
178 // linked together using their _next field. |
181 static void bulk_free(PerRegionTable* prt, PerRegionTable* last) { |
179 static void bulk_free(PerRegionTable* prt, PerRegionTable* last) { |
182 while (true) { |
180 while (true) { |
183 PerRegionTable* fl = _free_list; |
181 PerRegionTable* fl = _free_list; |
184 last->set_next(fl); |
182 last->set_next(fl); |
185 PerRegionTable* res = (PerRegionTable*) Atomic::cmpxchg_ptr(prt, &_free_list, fl); |
183 PerRegionTable* res = Atomic::cmpxchg(prt, &_free_list, fl); |
186 if (res == fl) { |
184 if (res == fl) { |
187 return; |
185 return; |
188 } |
186 } |
189 } |
187 } |
190 ShouldNotReachHere(); |
188 ShouldNotReachHere(); |
197 // Returns an initialized PerRegionTable instance. |
195 // Returns an initialized PerRegionTable instance. |
198 static PerRegionTable* alloc(HeapRegion* hr) { |
196 static PerRegionTable* alloc(HeapRegion* hr) { |
199 PerRegionTable* fl = _free_list; |
197 PerRegionTable* fl = _free_list; |
200 while (fl != NULL) { |
198 while (fl != NULL) { |
201 PerRegionTable* nxt = fl->next(); |
199 PerRegionTable* nxt = fl->next(); |
202 PerRegionTable* res = |
200 PerRegionTable* res = Atomic::cmpxchg(nxt, &_free_list, fl); |
203 (PerRegionTable*) |
|
204 Atomic::cmpxchg_ptr(nxt, &_free_list, fl); |
|
205 if (res == fl) { |
201 if (res == fl) { |
206 fl->init(hr, true); |
202 fl->init(hr, true); |
207 return fl; |
203 return fl; |
208 } else { |
204 } else { |
209 fl = _free_list; |
205 fl = _free_list; |
414 // parsing of the list, if any, may fail to see other entries), |
410 // parsing of the list, if any, may fail to see other entries), |
415 // the content of the prt must be visible (else for instance |
411 // the content of the prt must be visible (else for instance |
416 // some mark bits may not yet seem cleared or a 'later' update |
412 // some mark bits may not yet seem cleared or a 'later' update |
417 // performed by a concurrent thread could be undone when the |
413 // performed by a concurrent thread could be undone when the |
418 // zeroing becomes visible). This requires store ordering. |
414 // zeroing becomes visible). This requires store ordering. |
419 OrderAccess::release_store_ptr((volatile PerRegionTable*)&_fine_grain_regions[ind], prt); |
415 OrderAccess::release_store(&_fine_grain_regions[ind], prt); |
420 _n_fine_entries++; |
416 _n_fine_entries++; |
421 |
417 |
422 if (G1HRRSUseSparseTable) { |
418 if (G1HRRSUseSparseTable) { |
423 // Transfer from sparse to fine-grain. |
419 // Transfer from sparse to fine-grain. |
424 SparsePRTEntry *sprt_entry = _sparse_table.get_entry(from_hrm_ind); |
420 SparsePRTEntry *sprt_entry = _sparse_table.get_entry(from_hrm_ind); |