Mercurial > hg > truffle
comparison src/share/vm/memory/cardTableModRefBS.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 | c48ad6ab8bdf |
children | fc2b798ab316 |
comparison
equal
deleted
inserted
replaced
3316:cd8e33b2a8ad | 3317:063382f9b575 |
---|---|
650 void CardTableModRefBS::verify() { | 650 void CardTableModRefBS::verify() { |
651 verify_guard(); | 651 verify_guard(); |
652 } | 652 } |
653 | 653 |
654 #ifndef PRODUCT | 654 #ifndef PRODUCT |
655 class GuaranteeNotModClosure: public MemRegionClosure { | 655 void CardTableModRefBS::verify_region(MemRegion mr, |
656 CardTableModRefBS* _ct; | 656 jbyte val, bool val_equals) { |
657 public: | 657 jbyte* start = byte_for(mr.start()); |
658 GuaranteeNotModClosure(CardTableModRefBS* ct) : _ct(ct) {} | 658 jbyte* end = byte_for(mr.last()); |
659 void do_MemRegion(MemRegion mr) { | 659 bool failures = false; |
660 jbyte* entry = _ct->byte_for(mr.start()); | 660 for (jbyte* curr = start; curr <= end; ++curr) { |
661 guarantee(*entry != CardTableModRefBS::clean_card, | 661 jbyte curr_val = *curr; |
662 "Dirty card in region that should be clean"); | 662 bool failed = (val_equals) ? (curr_val != val) : (curr_val == val); |
663 } | 663 if (failed) { |
664 }; | 664 if (!failures) { |
665 | 665 tty->cr(); |
666 void CardTableModRefBS::verify_clean_region(MemRegion mr) { | 666 tty->print_cr("== CT verification failed: ["PTR_FORMAT","PTR_FORMAT"]"); |
667 GuaranteeNotModClosure blk(this); | 667 tty->print_cr("== %sexpecting value: %d", |
668 non_clean_card_iterate_serial(mr, &blk); | 668 (val_equals) ? "" : "not ", val); |
669 } | 669 failures = true; |
670 | 670 } |
671 // To verify a MemRegion is entirely dirty this closure is passed to | 671 tty->print_cr("== card "PTR_FORMAT" ["PTR_FORMAT","PTR_FORMAT"], " |
672 // dirty_card_iterate. If the region is dirty do_MemRegion will be | 672 "val: %d", curr, addr_for(curr), |
673 // invoked only once with a MemRegion equal to the one being | 673 (HeapWord*) (((size_t) addr_for(curr)) + card_size), |
674 // verified. | 674 (int) curr_val); |
675 class GuaranteeDirtyClosure: public MemRegionClosure { | 675 } |
676 CardTableModRefBS* _ct; | 676 } |
677 MemRegion _mr; | 677 guarantee(!failures, "there should not have been any failures"); |
678 bool _result; | 678 } |
679 public: | 679 |
680 GuaranteeDirtyClosure(CardTableModRefBS* ct, MemRegion mr) | 680 void CardTableModRefBS::verify_not_dirty_region(MemRegion mr) { |
681 : _ct(ct), _mr(mr), _result(false) {} | 681 verify_region(mr, dirty_card, false /* val_equals */); |
682 void do_MemRegion(MemRegion mr) { | 682 } |
683 _result = _mr.equals(mr); | |
684 } | |
685 bool result() const { return _result; } | |
686 }; | |
687 | 683 |
688 void CardTableModRefBS::verify_dirty_region(MemRegion mr) { | 684 void CardTableModRefBS::verify_dirty_region(MemRegion mr) { |
689 GuaranteeDirtyClosure blk(this, mr); | 685 verify_region(mr, dirty_card, true /* val_equals */); |
690 dirty_card_iterate(mr, &blk); | |
691 guarantee(blk.result(), "Non-dirty cards in region that should be dirty"); | |
692 } | 686 } |
693 #endif | 687 #endif |
694 | 688 |
695 bool CardTableModRefBSForCTRS::card_will_be_scanned(jbyte cv) { | 689 bool CardTableModRefBSForCTRS::card_will_be_scanned(jbyte cv) { |
696 return | 690 return |