Mercurial > hg > truffle
comparison src/share/vm/memory/cardTableModRefBS.hpp @ 3357:fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
Summary: Fixed process_chunk_boundaries(), used for parallel card scanning when using ParNew/CMS, so as to prevent double-scanning, or worse, non-scanning of imprecisely marked objects exceeding parallel chunk size. Made some sizing parameters for parallel card scanning diagnostic, disabled ParallelGCRetainPLAB, and elaborated and clarified some comments.
Reviewed-by: stefank, johnc
author | ysr |
---|---|
date | Tue, 10 May 2011 00:33:21 -0700 |
parents | 063382f9b575 |
children | 7d64aa23eb96 |
comparison
equal
deleted
inserted
replaced
3325:54a56bbaf95b | 3357:fc2b798ab316 |
---|---|
171 void non_clean_card_iterate_serial(MemRegion mr, MemRegionClosure* cl); | 171 void non_clean_card_iterate_serial(MemRegion mr, MemRegionClosure* cl); |
172 | 172 |
173 // A variant of the above that will operate in a parallel mode if | 173 // A variant of the above that will operate in a parallel mode if |
174 // worker threads are available, and clear the dirty cards as it | 174 // worker threads are available, and clear the dirty cards as it |
175 // processes them. | 175 // processes them. |
176 // ClearNoncleanCardWrapper cl must wrap the DirtyCardToOopClosure dcto_cl, | 176 // XXX ??? MemRegionClosure above vs OopsInGenClosure below XXX |
177 // which may itself be modified by the method. | 177 // XXX some new_dcto_cl's take OopClosure's, plus as above there are |
178 // some MemRegionClosures. Clean this up everywhere. XXX | |
178 void non_clean_card_iterate_possibly_parallel(Space* sp, MemRegion mr, | 179 void non_clean_card_iterate_possibly_parallel(Space* sp, MemRegion mr, |
179 DirtyCardToOopClosure* dcto_cl, | 180 OopsInGenClosure* cl, CardTableRS* ct); |
180 ClearNoncleanCardWrapper* cl); | |
181 | 181 |
182 private: | 182 private: |
183 // Work method used to implement non_clean_card_iterate_possibly_parallel() | 183 // Work method used to implement non_clean_card_iterate_possibly_parallel() |
184 // above in the parallel case. | 184 // above in the parallel case. |
185 void non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr, | 185 void non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr, |
186 DirtyCardToOopClosure* dcto_cl, | 186 OopsInGenClosure* cl, CardTableRS* ct, |
187 ClearNoncleanCardWrapper* cl, | |
188 int n_threads); | 187 int n_threads); |
189 | 188 |
190 protected: | 189 protected: |
191 // Dirty the bytes corresponding to "mr" (not all of which must be | 190 // Dirty the bytes corresponding to "mr" (not all of which must be |
192 // covered.) | 191 // covered.) |
195 // Clear (to clean_card) the bytes entirely contained within "mr" (not | 194 // Clear (to clean_card) the bytes entirely contained within "mr" (not |
196 // all of which must be covered.) | 195 // all of which must be covered.) |
197 void clear_MemRegion(MemRegion mr); | 196 void clear_MemRegion(MemRegion mr); |
198 | 197 |
199 // *** Support for parallel card scanning. | 198 // *** Support for parallel card scanning. |
200 | |
201 enum SomeConstantsForParallelism { | |
202 StridesPerThread = 2, | |
203 CardsPerStrideChunk = 256 | |
204 }; | |
205 | 199 |
206 // This is an array, one element per covered region of the card table. | 200 // This is an array, one element per covered region of the card table. |
207 // Each entry is itself an array, with one element per chunk in the | 201 // Each entry is itself an array, with one element per chunk in the |
208 // covered region. Each entry of these arrays is the lowest non-clean | 202 // covered region. Each entry of these arrays is the lowest non-clean |
209 // card of the corresponding chunk containing part of an object from the | 203 // card of the corresponding chunk containing part of an object from the |
233 | 227 |
234 // Returns the index of the chunk in a stride which | 228 // Returns the index of the chunk in a stride which |
235 // covers the given address. | 229 // covers the given address. |
236 uintptr_t addr_to_chunk_index(const void* addr) { | 230 uintptr_t addr_to_chunk_index(const void* addr) { |
237 uintptr_t card = (uintptr_t) byte_for(addr); | 231 uintptr_t card = (uintptr_t) byte_for(addr); |
238 return card / CardsPerStrideChunk; | 232 return card / ParGCCardsPerStrideChunk; |
239 } | 233 } |
240 | 234 |
241 // Apply cl, which must either itself apply dcto_cl or be dcto_cl, | 235 // Apply cl, which must either itself apply dcto_cl or be dcto_cl, |
242 // to the cards in the stride (of n_strides) within the given space. | 236 // to the cards in the stride (of n_strides) within the given space. |
243 void process_stride(Space* sp, | 237 void process_stride(Space* sp, |
244 MemRegion used, | 238 MemRegion used, |
245 jint stride, int n_strides, | 239 jint stride, int n_strides, |
246 DirtyCardToOopClosure* dcto_cl, | 240 OopsInGenClosure* cl, |
247 ClearNoncleanCardWrapper* cl, | 241 CardTableRS* ct, |
248 jbyte** lowest_non_clean, | 242 jbyte** lowest_non_clean, |
249 uintptr_t lowest_non_clean_base_chunk_index, | 243 uintptr_t lowest_non_clean_base_chunk_index, |
250 size_t lowest_non_clean_chunk_size); | 244 size_t lowest_non_clean_chunk_size); |
251 | 245 |
252 // Makes sure that chunk boundaries are handled appropriately, by | 246 // Makes sure that chunk boundaries are handled appropriately, by |
480 void verify_region(MemRegion mr, jbyte val, bool val_equals) PRODUCT_RETURN; | 474 void verify_region(MemRegion mr, jbyte val, bool val_equals) PRODUCT_RETURN; |
481 void verify_not_dirty_region(MemRegion mr) PRODUCT_RETURN; | 475 void verify_not_dirty_region(MemRegion mr) PRODUCT_RETURN; |
482 void verify_dirty_region(MemRegion mr) PRODUCT_RETURN; | 476 void verify_dirty_region(MemRegion mr) PRODUCT_RETURN; |
483 | 477 |
484 static size_t par_chunk_heapword_alignment() { | 478 static size_t par_chunk_heapword_alignment() { |
485 return CardsPerStrideChunk * card_size_in_words; | 479 return ParGCCardsPerStrideChunk * card_size_in_words; |
486 } | 480 } |
487 | 481 |
488 }; | 482 }; |
489 | 483 |
490 class CardTableRS; | 484 class CardTableRS; |