Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp @ 6188:7994a5a35fcf
6921087: G1: remove per-GC-thread expansion tables from the fine-grain remembered sets
Summary: Remove the per-thread expansion tables (PosParPRT) and associated expansion and compaction from the fine grain RSet entries. This code has been unused for a while.
Reviewed-by: johnc, brutisso
Contributed-by: Thomas Schatzl <thomas.schatzl@jku.at>
author | johnc |
---|---|
date | Mon, 25 Jun 2012 16:00:55 -0700 |
parents | 720b6a76dd9d |
children | 24b9c7f4cae6 |
comparison
equal
deleted
inserted
replaced
6161:1c280e5b8d31 | 6188:7994a5a35fcf |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
33 | 33 |
34 class G1CollectedHeap; | 34 class G1CollectedHeap; |
35 class G1BlockOffsetSharedArray; | 35 class G1BlockOffsetSharedArray; |
36 class HeapRegion; | 36 class HeapRegion; |
37 class HeapRegionRemSetIterator; | 37 class HeapRegionRemSetIterator; |
38 class PosParPRT; | 38 class PerRegionTable; |
39 class SparsePRT; | 39 class SparsePRT; |
40 | 40 |
41 // Essentially a wrapper around SparsePRTCleanupTask. See | 41 // Essentially a wrapper around SparsePRTCleanupTask. See |
42 // sparsePRT.hpp for more details. | 42 // sparsePRT.hpp for more details. |
43 class HRRSCleanupTask : public SparsePRTCleanupTask { | 43 class HRRSCleanupTask : public SparsePRTCleanupTask { |
77 // These are protected by "_m". | 77 // These are protected by "_m". |
78 BitMap _coarse_map; | 78 BitMap _coarse_map; |
79 size_t _n_coarse_entries; | 79 size_t _n_coarse_entries; |
80 static jint _n_coarsenings; | 80 static jint _n_coarsenings; |
81 | 81 |
82 PosParPRT** _fine_grain_regions; | 82 PerRegionTable** _fine_grain_regions; |
83 size_t _n_fine_entries; | 83 size_t _n_fine_entries; |
84 | 84 |
85 #define SAMPLE_FOR_EVICTION 1 | 85 // Used to sample a subset of the fine grain PRTs to determine which |
86 #if SAMPLE_FOR_EVICTION | 86 // PRT to evict and coarsen. |
87 size_t _fine_eviction_start; | 87 size_t _fine_eviction_start; |
88 static size_t _fine_eviction_stride; | 88 static size_t _fine_eviction_stride; |
89 static size_t _fine_eviction_sample_size; | 89 static size_t _fine_eviction_sample_size; |
90 #endif | |
91 | 90 |
92 SparsePRT _sparse_table; | 91 SparsePRT _sparse_table; |
93 | 92 |
94 // These are static after init. | 93 // These are static after init. |
95 static size_t _max_fine_entries; | 94 static size_t _max_fine_entries; |
96 static size_t _mod_max_fine_entries_mask; | 95 static size_t _mod_max_fine_entries_mask; |
97 | 96 |
98 // Requires "prt" to be the first element of the bucket list appropriate | 97 // Requires "prt" to be the first element of the bucket list appropriate |
99 // for "hr". If this list contains an entry for "hr", return it, | 98 // for "hr". If this list contains an entry for "hr", return it, |
100 // otherwise return "NULL". | 99 // otherwise return "NULL". |
101 PosParPRT* find_region_table(size_t ind, HeapRegion* hr) const; | 100 PerRegionTable* find_region_table(size_t ind, HeapRegion* hr) const; |
102 | 101 |
103 // Find, delete, and return a candidate PosParPRT, if any exists, | 102 // Find, delete, and return a candidate PerRegionTable, if any exists, |
104 // adding the deleted region to the coarse bitmap. Requires the caller | 103 // adding the deleted region to the coarse bitmap. Requires the caller |
105 // to hold _m, and the fine-grain table to be full. | 104 // to hold _m, and the fine-grain table to be full. |
106 PosParPRT* delete_region_table(); | 105 PerRegionTable* delete_region_table(); |
107 | 106 |
108 // If a PRT for "hr" is in the bucket list indicated by "ind" (which must | 107 // If a PRT for "hr" is in the bucket list indicated by "ind" (which must |
109 // be the correct index for "hr"), delete it and return true; else return | 108 // be the correct index for "hr"), delete it and return true; else return |
110 // false. | 109 // false. |
111 bool del_single_region_table(size_t ind, HeapRegion* hr); | 110 bool del_single_region_table(size_t ind, HeapRegion* hr); |
112 | 111 |
113 static jint _cache_probes; | |
114 static jint _cache_hits; | |
115 | |
116 // Indexed by thread X heap region, to minimize thread contention. | 112 // Indexed by thread X heap region, to minimize thread contention. |
117 static int** _from_card_cache; | 113 static int** _from_card_cache; |
118 static size_t _from_card_cache_max_regions; | 114 static size_t _from_card_cache_max_regions; |
119 static size_t _from_card_cache_mem_size; | 115 static size_t _from_card_cache_mem_size; |
120 | 116 |
124 HeapRegion* hr() const { return _hr; } | 120 HeapRegion* hr() const { return _hr; } |
125 | 121 |
126 // For now. Could "expand" some tables in the future, so that this made | 122 // For now. Could "expand" some tables in the future, so that this made |
127 // sense. | 123 // sense. |
128 void add_reference(OopOrNarrowOopStar from, int tid); | 124 void add_reference(OopOrNarrowOopStar from, int tid); |
129 | |
130 void add_reference(OopOrNarrowOopStar from) { | |
131 return add_reference(from, 0); | |
132 } | |
133 | 125 |
134 // Removes any entries shown by the given bitmaps to contain only dead | 126 // Removes any entries shown by the given bitmaps to contain only dead |
135 // objects. | 127 // objects. |
136 void scrub(CardTableModRefBS* ctbs, BitMap* region_bm, BitMap* card_bm); | 128 void scrub(CardTableModRefBS* ctbs, BitMap* region_bm, BitMap* card_bm); |
137 | 129 |
231 return _other_regions.occ_sparse(); | 223 return _other_regions.occ_sparse(); |
232 } | 224 } |
233 | 225 |
234 static jint n_coarsenings() { return OtherRegionsTable::n_coarsenings(); } | 226 static jint n_coarsenings() { return OtherRegionsTable::n_coarsenings(); } |
235 | 227 |
236 /* Used in the sequential case. Returns "true" iff this addition causes | 228 // Used in the sequential case. |
237 the size limit to be reached. */ | |
238 void add_reference(OopOrNarrowOopStar from) { | 229 void add_reference(OopOrNarrowOopStar from) { |
239 _other_regions.add_reference(from); | 230 _other_regions.add_reference(from, 0); |
240 } | 231 } |
241 | 232 |
242 /* Used in the parallel case. Returns "true" iff this addition causes | 233 // Used in the parallel case. |
243 the size limit to be reached. */ | |
244 void add_reference(OopOrNarrowOopStar from, int tid) { | 234 void add_reference(OopOrNarrowOopStar from, int tid) { |
245 _other_regions.add_reference(from, tid); | 235 _other_regions.add_reference(from, tid); |
246 } | 236 } |
247 | 237 |
248 // Removes any entries shown by the given bitmaps to contain only dead | 238 // Removes any entries shown by the given bitmaps to contain only dead |
250 void scrub(CardTableModRefBS* ctbs, BitMap* region_bm, BitMap* card_bm); | 240 void scrub(CardTableModRefBS* ctbs, BitMap* region_bm, BitMap* card_bm); |
251 | 241 |
252 // The region is being reclaimed; clear its remset, and any mention of | 242 // The region is being reclaimed; clear its remset, and any mention of |
253 // entries for this region in other remsets. | 243 // entries for this region in other remsets. |
254 void clear(); | 244 void clear(); |
255 | |
256 // Forget any entries due to pointers from "from_hr". | |
257 void clear_incoming_entry(HeapRegion* from_hr) { | |
258 _other_regions.clear_incoming_entry(from_hr); | |
259 } | |
260 | |
261 #if 0 | |
262 virtual void cleanup() = 0; | |
263 #endif | |
264 | 245 |
265 // Attempt to claim the region. Returns true iff this call caused an | 246 // Attempt to claim the region. Returns true iff this call caused an |
266 // atomic transition from Unclaimed to Claimed. | 247 // atomic transition from Unclaimed to Claimed. |
267 bool claim_iter(); | 248 bool claim_iter(); |
268 // Sets the iteration state to "complete". | 249 // Sets the iteration state to "complete". |
288 } | 269 } |
289 | 270 |
290 // Initialize the given iterator to iterate over this rem set. | 271 // Initialize the given iterator to iterate over this rem set. |
291 void init_iterator(HeapRegionRemSetIterator* iter) const; | 272 void init_iterator(HeapRegionRemSetIterator* iter) const; |
292 | 273 |
293 #if 0 | |
294 // Apply the "do_card" method to the start address of every card in the | |
295 // rem set. Returns false if some application of the closure aborted. | |
296 virtual bool card_iterate(CardClosure* iter) = 0; | |
297 #endif | |
298 | |
299 // The actual # of bytes this hr_remset takes up. | 274 // The actual # of bytes this hr_remset takes up. |
300 size_t mem_size() { | 275 size_t mem_size() { |
301 return _other_regions.mem_size() | 276 return _other_regions.mem_size() |
302 // This correction is necessary because the above includes the second | 277 // This correction is necessary because the above includes the second |
303 // part. | 278 // part. |
320 return _other_regions.contains_reference(from); | 295 return _other_regions.contains_reference(from); |
321 } | 296 } |
322 void print() const; | 297 void print() const; |
323 | 298 |
324 // Called during a stop-world phase to perform any deferred cleanups. | 299 // Called during a stop-world phase to perform any deferred cleanups. |
325 // The second version may be called by parallel threads after then finish | |
326 // collection work. | |
327 static void cleanup(); | 300 static void cleanup(); |
328 static void par_cleanup(); | |
329 | 301 |
330 // Declare the heap size (in # of regions) to the HeapRegionRemSet(s). | 302 // Declare the heap size (in # of regions) to the HeapRegionRemSet(s). |
331 // (Uses it to initialize from_card_cache). | 303 // (Uses it to initialize from_card_cache). |
332 static void init_heap(uint max_regions) { | 304 static void init_heap(uint max_regions) { |
333 OtherRegionsTable::init_from_card_cache((size_t) max_regions); | 305 OtherRegionsTable::init_from_card_cache((size_t) max_regions); |
365 // The region over which we're iterating. | 337 // The region over which we're iterating. |
366 const HeapRegionRemSet* _hrrs; | 338 const HeapRegionRemSet* _hrrs; |
367 | 339 |
368 // Local caching of HRRS fields. | 340 // Local caching of HRRS fields. |
369 const BitMap* _coarse_map; | 341 const BitMap* _coarse_map; |
370 PosParPRT** _fine_grain_regions; | 342 PerRegionTable** _fine_grain_regions; |
371 | 343 |
372 G1BlockOffsetSharedArray* _bosa; | 344 G1BlockOffsetSharedArray* _bosa; |
373 G1CollectedHeap* _g1h; | 345 G1CollectedHeap* _g1h; |
374 | 346 |
375 // The number yielded since initialization. | 347 // The number yielded since initialization. |
402 | 374 |
403 // Fine table iteration fields: | 375 // Fine table iteration fields: |
404 | 376 |
405 // Index of bucket-list we're working on. | 377 // Index of bucket-list we're working on. |
406 int _fine_array_index; | 378 int _fine_array_index; |
379 | |
407 // Per Region Table we're doing within current bucket list. | 380 // Per Region Table we're doing within current bucket list. |
408 PosParPRT* _fine_cur_prt; | 381 PerRegionTable* _fine_cur_prt; |
409 | 382 |
410 /* SparsePRT::*/ SparsePRTIter _sparse_iter; | 383 /* SparsePRT::*/ SparsePRTIter _sparse_iter; |
411 | 384 |
412 void fine_find_next_non_null_prt(); | 385 void fine_find_next_non_null_prt(); |
413 | 386 |
433 size_t n_yielded() { | 406 size_t n_yielded() { |
434 return n_yielded_fine() + n_yielded_coarse() + n_yielded_sparse(); | 407 return n_yielded_fine() + n_yielded_coarse() + n_yielded_sparse(); |
435 } | 408 } |
436 }; | 409 }; |
437 | 410 |
438 #if 0 | |
439 class CardClosure: public Closure { | |
440 public: | |
441 virtual void do_card(HeapWord* card_start) = 0; | |
442 }; | |
443 | |
444 #endif | |
445 | |
446 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONREMSET_HPP | 411 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONREMSET_HPP |