Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/heapRegion.cpp @ 3317:063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
Summary: We should only undirty cards after we decide that they are not on a young region, not before. The fix also includes improvements to the verify_dirty_region() method which print out which cards were not found dirty.
Reviewed-by: johnc, brutisso
author | tonyp |
---|---|
date | Fri, 29 Apr 2011 14:59:04 -0400 |
parents | abdfc822206f |
children | be4ca325525a c3f1170908be |
comparison
equal
deleted
inserted
replaced
3316:cd8e33b2a8ad | 3317:063382f9b575 |
---|---|
374 _offsets.resize(HeapRegion::GrainWords); | 374 _offsets.resize(HeapRegion::GrainWords); |
375 init_top_at_mark_start(); | 375 init_top_at_mark_start(); |
376 if (clear_space) clear(SpaceDecorator::Mangle); | 376 if (clear_space) clear(SpaceDecorator::Mangle); |
377 } | 377 } |
378 | 378 |
379 void HeapRegion::par_clear() { | |
380 assert(used() == 0, "the region should have been already cleared"); | |
381 assert(capacity() == (size_t) HeapRegion::GrainBytes, | |
382 "should be back to normal"); | |
383 HeapRegionRemSet* hrrs = rem_set(); | |
384 hrrs->clear(); | |
385 CardTableModRefBS* ct_bs = | |
386 (CardTableModRefBS*)G1CollectedHeap::heap()->barrier_set(); | |
387 ct_bs->clear(MemRegion(bottom(), end())); | |
388 } | |
389 | |
379 // <PREDICTION> | 390 // <PREDICTION> |
380 void HeapRegion::calc_gc_efficiency() { | 391 void HeapRegion::calc_gc_efficiency() { |
381 G1CollectedHeap* g1h = G1CollectedHeap::heap(); | 392 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
382 _gc_efficiency = (double) garbage_bytes() / | 393 _gc_efficiency = (double) garbage_bytes() / |
383 g1h->predict_region_elapsed_time_ms(this, false); | 394 g1h->predict_region_elapsed_time_ms(this, false); |
598 | 609 |
599 HeapWord* | 610 HeapWord* |
600 HeapRegion:: | 611 HeapRegion:: |
601 oops_on_card_seq_iterate_careful(MemRegion mr, | 612 oops_on_card_seq_iterate_careful(MemRegion mr, |
602 FilterOutOfRegionClosure* cl, | 613 FilterOutOfRegionClosure* cl, |
603 bool filter_young) { | 614 bool filter_young, |
615 jbyte* card_ptr) { | |
616 // Currently, we should only have to clean the card if filter_young | |
617 // is true and vice versa. | |
618 if (filter_young) { | |
619 assert(card_ptr != NULL, "pre-condition"); | |
620 } else { | |
621 assert(card_ptr == NULL, "pre-condition"); | |
622 } | |
604 G1CollectedHeap* g1h = G1CollectedHeap::heap(); | 623 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
605 | 624 |
606 // If we're within a stop-world GC, then we might look at a card in a | 625 // If we're within a stop-world GC, then we might look at a card in a |
607 // GC alloc region that extends onto a GC LAB, which may not be | 626 // GC alloc region that extends onto a GC LAB, which may not be |
608 // parseable. Stop such at the "saved_mark" of the region. | 627 // parseable. Stop such at the "saved_mark" of the region. |
623 if (is_young() && filter_young) { | 642 if (is_young() && filter_young) { |
624 return NULL; | 643 return NULL; |
625 } | 644 } |
626 | 645 |
627 assert(!is_young(), "check value of filter_young"); | 646 assert(!is_young(), "check value of filter_young"); |
647 | |
648 // We can only clean the card here, after we make the decision that | |
649 // the card is not young. And we only clean the card if we have been | |
650 // asked to (i.e., card_ptr != NULL). | |
651 if (card_ptr != NULL) { | |
652 *card_ptr = CardTableModRefBS::clean_card_val(); | |
653 // We must complete this write before we do any of the reads below. | |
654 OrderAccess::storeload(); | |
655 } | |
628 | 656 |
629 // We used to use "block_start_careful" here. But we're actually happy | 657 // We used to use "block_start_careful" here. But we're actually happy |
630 // to update the BOT while we do this... | 658 // to update the BOT while we do this... |
631 HeapWord* cur = block_start(mr.start()); | 659 HeapWord* cur = block_start(mr.start()); |
632 assert(cur <= mr.start(), "Postcondition"); | 660 assert(cur <= mr.start(), "Postcondition"); |