35 class G1BlockOffsetSharedArray; |
35 class G1BlockOffsetSharedArray; |
36 class HeapRegion; |
36 class HeapRegion; |
37 class HeapRegionRemSetIterator; |
37 class HeapRegionRemSetIterator; |
38 class PerRegionTable; |
38 class PerRegionTable; |
39 class SparsePRT; |
39 class SparsePRT; |
|
40 class nmethod; |
40 |
41 |
41 // Essentially a wrapper around SparsePRTCleanupTask. See |
42 // Essentially a wrapper around SparsePRTCleanupTask. See |
42 // sparsePRT.hpp for more details. |
43 // sparsePRT.hpp for more details. |
43 class HRRSCleanupTask : public SparsePRTCleanupTask { |
44 class HRRSCleanupTask : public SparsePRTCleanupTask { |
44 }; |
45 }; |
189 |
190 |
190 private: |
191 private: |
191 G1BlockOffsetSharedArray* _bosa; |
192 G1BlockOffsetSharedArray* _bosa; |
192 G1BlockOffsetSharedArray* bosa() const { return _bosa; } |
193 G1BlockOffsetSharedArray* bosa() const { return _bosa; } |
193 |
194 |
|
195 // A list of code blobs (nmethods) whose code contains pointers into |
|
196 // the region that owns this RSet. |
|
197 GrowableArray<nmethod*>* _strong_code_roots_list; |
|
198 |
194 OtherRegionsTable _other_regions; |
199 OtherRegionsTable _other_regions; |
195 |
200 |
196 enum ParIterState { Unclaimed, Claimed, Complete }; |
201 enum ParIterState { Unclaimed, Claimed, Complete }; |
197 volatile ParIterState _iter_state; |
202 volatile ParIterState _iter_state; |
198 volatile jlong _iter_claimed; |
203 volatile jlong _iter_claimed; |
280 bool verify_ready_for_par_iteration() { |
285 bool verify_ready_for_par_iteration() { |
281 return (_iter_state == Unclaimed) && (_iter_claimed == 0); |
286 return (_iter_state == Unclaimed) && (_iter_claimed == 0); |
282 } |
287 } |
283 |
288 |
284 // The actual # of bytes this hr_remset takes up. |
289 // The actual # of bytes this hr_remset takes up. |
|
290 // Note also includes the strong code root set. |
285 size_t mem_size() { |
291 size_t mem_size() { |
286 return _other_regions.mem_size() |
292 return _other_regions.mem_size() |
287 // This correction is necessary because the above includes the second |
293 // This correction is necessary because the above includes the second |
288 // part. |
294 // part. |
289 + sizeof(this) - sizeof(OtherRegionsTable); |
295 + (sizeof(this) - sizeof(OtherRegionsTable)) |
|
296 + strong_code_roots_mem_size(); |
290 } |
297 } |
291 |
298 |
292 // Returns the memory occupancy of all static data structures associated |
299 // Returns the memory occupancy of all static data structures associated |
293 // with remembered sets. |
300 // with remembered sets. |
294 static size_t static_mem_size() { |
301 static size_t static_mem_size() { |
302 } |
309 } |
303 |
310 |
304 bool contains_reference(OopOrNarrowOopStar from) const { |
311 bool contains_reference(OopOrNarrowOopStar from) const { |
305 return _other_regions.contains_reference(from); |
312 return _other_regions.contains_reference(from); |
306 } |
313 } |
|
314 |
|
315 // Routines for managing the list of code roots that point into |
|
316 // the heap region that owns this RSet. |
|
317 void add_strong_code_root(nmethod* nm); |
|
318 void remove_strong_code_root(nmethod* nm); |
|
319 |
|
320 // During a collection, migrate the successfully evacuated strong |
|
321 // code roots that referenced into the region that owns this RSet |
|
322 // to the RSets of the new regions that they now point into. |
|
323 // Unsuccessfully evacuated code roots are not migrated. |
|
324 void migrate_strong_code_roots(); |
|
325 |
|
326 // Applies blk->do_code_blob() to each of the entries in |
|
327 // the strong code roots list |
|
328 void strong_code_roots_do(CodeBlobClosure* blk) const; |
|
329 |
|
330 // Returns the number of elements in the strong code roots list |
|
331 int strong_code_roots_list_length() { |
|
332 return _strong_code_roots_list->length(); |
|
333 } |
|
334 |
|
335 // Returns true if the strong code roots contains the given |
|
336 // nmethod. |
|
337 bool strong_code_roots_list_contains(nmethod* nm) { |
|
338 return _strong_code_roots_list->contains(nm); |
|
339 } |
|
340 |
|
341 // Returns the amount of memory, in bytes, currently |
|
342 // consumed by the strong code roots. |
|
343 size_t strong_code_roots_mem_size(); |
|
344 |
307 void print() const; |
345 void print() const; |
308 |
346 |
309 // Called during a stop-world phase to perform any deferred cleanups. |
347 // Called during a stop-world phase to perform any deferred cleanups. |
310 static void cleanup(); |
348 static void cleanup(); |
311 |
349 |