comparison src/share/vm/gc_implementation/g1/sparsePRT.cpp @ 1886:72a161e62cc4

6991377: G1: race between concurrent refinement and humongous object allocation Summary: There is a race between the concurrent refinement threads and the humongous object allocation that can cause the concurrent refinement threads to corrupt the part of the BOT that it is being initialized by the humongous object allocation operation. The solution is to do the humongous object allocation in careful steps to ensure that the concurrent refinement threads always have a consistent view over the BOT, region contents, and top. The fix includes some very minor tidying up in sparsePRT. Reviewed-by: jcoomes, johnc, ysr
author tonyp
date Sat, 16 Oct 2010 17:12:19 -0400
parents 9f4848ebbabd
children f95d63e2154a
comparison
equal deleted inserted replaced
1885:a5c514e74487 1886:72a161e62cc4
306 e->copy_cards(e2); 306 e->copy_cards(e2);
307 _occupied_cards += e2->num_valid_cards(); 307 _occupied_cards += e2->num_valid_cards();
308 assert(e2->num_valid_cards() > 0, "Postcondition."); 308 assert(e2->num_valid_cards() > 0, "Postcondition.");
309 } 309 }
310 310
311 CardIdx_t /* RSHashTable:: */ RSHashTableIter::find_first_card_in_list() { 311 CardIdx_t RSHashTableIter::find_first_card_in_list() {
312 CardIdx_t res; 312 CardIdx_t res;
313 while (_bl_ind != RSHashTable::NullEntry) { 313 while (_bl_ind != RSHashTable::NullEntry) {
314 res = _rsht->entry(_bl_ind)->card(0); 314 res = _rsht->entry(_bl_ind)->card(0);
315 if (res != SparsePRTEntry::NullEntry) { 315 if (res != SparsePRTEntry::NullEntry) {
316 return res; 316 return res;
320 } 320 }
321 // Otherwise, none found: 321 // Otherwise, none found:
322 return SparsePRTEntry::NullEntry; 322 return SparsePRTEntry::NullEntry;
323 } 323 }
324 324
325 size_t /* RSHashTable:: */ RSHashTableIter::compute_card_ind(CardIdx_t ci) { 325 size_t RSHashTableIter::compute_card_ind(CardIdx_t ci) {
326 return (_rsht->entry(_bl_ind)->r_ind() * HeapRegion::CardsPerRegion) + ci; 326 return (_rsht->entry(_bl_ind)->r_ind() * HeapRegion::CardsPerRegion) + ci;
327 } 327 }
328 328
329 bool /* RSHashTable:: */ RSHashTableIter::has_next(size_t& card_index) { 329 bool RSHashTableIter::has_next(size_t& card_index) {
330 _card_ind++; 330 _card_ind++;
331 CardIdx_t ci; 331 CardIdx_t ci;
332 if (_card_ind < SparsePRTEntry::cards_num() && 332 if (_card_ind < SparsePRTEntry::cards_num() &&
333 ((ci = _rsht->entry(_bl_ind)->card(_card_ind)) != 333 ((ci = _rsht->entry(_bl_ind)->card(_card_ind)) !=
334 SparsePRTEntry::NullEntry)) { 334 SparsePRTEntry::NullEntry)) {