comparison src/share/vm/gc_implementation/g1/g1RemSet.cpp @ 1666:5cbac8938c4c

6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307 Summary: During concurrent refinment, filter cards in young regions after it has been determined that the region has been allocated from and the young type of the region has been set. Reviewed-by: iveresov, tonyp, jcoomes
author johnc
date Mon, 19 Jul 2010 11:06:34 -0700
parents 215576b54709
children 2d160770d2e5
comparison
equal deleted inserted replaced
1665:a93a9eda13f7 1666:5cbac8938c4c
1 /* 1 /*
2 * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
674 // Undirty the card. 674 // Undirty the card.
675 *card_ptr = CardTableModRefBS::clean_card_val(); 675 *card_ptr = CardTableModRefBS::clean_card_val();
676 // We must complete this write before we do any of the reads below. 676 // We must complete this write before we do any of the reads below.
677 OrderAccess::storeload(); 677 OrderAccess::storeload();
678 // And process it, being careful of unallocated portions of TLAB's. 678 // And process it, being careful of unallocated portions of TLAB's.
679
680 // The region for the current card may be a young region. The
681 // current card may have been a card that was evicted from the
682 // card cache. When the card was inserted into the cache, we had
683 // determined that its region was non-young. While in the cache,
684 // the region may have been freed during a cleanup pause, reallocated
685 // and tagged as young.
686 //
687 // We wish to filter out cards for such a region but the current
688 // thread, if we're running conucrrently, may "see" the young type
689 // change at any time (so an earlier "is_young" check may pass or
690 // fail arbitrarily). We tell the iteration code to perform this
691 // filtering when it has been determined that there has been an actual
692 // allocation in this region and making it safe to check the young type.
693 bool filter_young = true;
694
679 HeapWord* stop_point = 695 HeapWord* stop_point =
680 r->oops_on_card_seq_iterate_careful(dirtyRegion, 696 r->oops_on_card_seq_iterate_careful(dirtyRegion,
681 &filter_then_update_rs_oop_cl); 697 &filter_then_update_rs_oop_cl,
698 filter_young);
699
682 // If stop_point is non-null, then we encountered an unallocated region 700 // If stop_point is non-null, then we encountered an unallocated region
683 // (perhaps the unfilled portion of a TLAB.) For now, we'll dirty the 701 // (perhaps the unfilled portion of a TLAB.) For now, we'll dirty the
684 // card and re-enqueue: if we put off the card until a GC pause, then the 702 // card and re-enqueue: if we put off the card until a GC pause, then the
685 // unallocated portion will be filled in. Alternatively, we might try 703 // unallocated portion will be filled in. Alternatively, we might try
686 // the full complexity of the technique used in "regular" precleaning. 704 // the full complexity of the technique used in "regular" precleaning.
787 start = _ct_bs->addr_for(res); 805 start = _ct_bs->addr_for(res);
788 r = _g1->heap_region_containing(start); 806 r = _g1->heap_region_containing(start);
789 if (r == NULL) { 807 if (r == NULL) {
790 assert(_g1->is_in_permanent(start), "Or else where?"); 808 assert(_g1->is_in_permanent(start), "Or else where?");
791 } else { 809 } else {
792 guarantee(!r->is_young(), "It was evicted in the current minor cycle."); 810 // Checking whether the region we got back from the cache
793 // Process card pointer we get back from the hot card cache 811 // is young here is inappropriate. The region could have been
812 // freed, reallocated and tagged as young while in the cache.
813 // Hence we could see its young type change at any time.
814 //
815 // Process card pointer we get back from the hot card cache. This
816 // will check whether the region containing the card is young
817 // _after_ checking that the region has been allocated from.
794 concurrentRefineOneCard_impl(res, worker_i); 818 concurrentRefineOneCard_impl(res, worker_i);
795 } 819 }
796 } 820 }
797 } 821 }
798 822