1.1 --- a/src/share/vm/gc_implementation/g1/heapRegion.cpp Fri Apr 29 12:40:49 2011 -0400 1.2 +++ b/src/share/vm/gc_implementation/g1/heapRegion.cpp Fri Apr 29 14:59:04 2011 -0400 1.3 @@ -376,6 +376,17 @@ 1.4 if (clear_space) clear(SpaceDecorator::Mangle); 1.5 } 1.6 1.7 +void HeapRegion::par_clear() { 1.8 + assert(used() == 0, "the region should have been already cleared"); 1.9 + assert(capacity() == (size_t) HeapRegion::GrainBytes, 1.10 + "should be back to normal"); 1.11 + HeapRegionRemSet* hrrs = rem_set(); 1.12 + hrrs->clear(); 1.13 + CardTableModRefBS* ct_bs = 1.14 + (CardTableModRefBS*)G1CollectedHeap::heap()->barrier_set(); 1.15 + ct_bs->clear(MemRegion(bottom(), end())); 1.16 +} 1.17 + 1.18 // <PREDICTION> 1.19 void HeapRegion::calc_gc_efficiency() { 1.20 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 1.21 @@ -600,7 +611,15 @@ 1.22 HeapRegion:: 1.23 oops_on_card_seq_iterate_careful(MemRegion mr, 1.24 FilterOutOfRegionClosure* cl, 1.25 - bool filter_young) { 1.26 + bool filter_young, 1.27 + jbyte* card_ptr) { 1.28 + // Currently, we should only have to clean the card if filter_young 1.29 + // is true and vice versa. 1.30 + if (filter_young) { 1.31 + assert(card_ptr != NULL, "pre-condition"); 1.32 + } else { 1.33 + assert(card_ptr == NULL, "pre-condition"); 1.34 + } 1.35 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 1.36 1.37 // If we're within a stop-world GC, then we might look at a card in a 1.38 @@ -626,6 +645,15 @@ 1.39 1.40 assert(!is_young(), "check value of filter_young"); 1.41 1.42 + // We can only clean the card here, after we make the decision that 1.43 + // the card is not young. And we only clean the card if we have been 1.44 + // asked to (i.e., card_ptr != NULL). 1.45 + if (card_ptr != NULL) { 1.46 + *card_ptr = CardTableModRefBS::clean_card_val(); 1.47 + // We must complete this write before we do any of the reads below. 1.48 + OrderAccess::storeload(); 1.49 + } 1.50 + 1.51 // We used to use "block_start_careful" here. But we're actually happy 1.52 // to update the BOT while we do this... 1.53 HeapWord* cur = block_start(mr.start());