378 // And find the region containing it. |
378 // And find the region containing it. |
379 HeapRegion* r = _g1->heap_region_containing(start); |
379 HeapRegion* r = _g1->heap_region_containing(start); |
380 assert(r != NULL, "unexpected null"); |
380 assert(r != NULL, "unexpected null"); |
381 |
381 |
382 // Scan oops in the card looking for references into the collection set |
382 // Scan oops in the card looking for references into the collection set |
383 HeapWord* end = _ct_bs->addr_for(card_ptr + 1); |
383 // Don't use addr_for(card_ptr + 1) which can ask for |
|
384 // a card beyond the heap. This is not safe without a perm |
|
385 // gen. |
|
386 HeapWord* end = start + CardTableModRefBS::card_size_in_words; |
384 MemRegion scanRegion(start, end); |
387 MemRegion scanRegion(start, end); |
385 |
388 |
386 UpdateRSetImmediate update_rs_cl(_g1->g1_rem_set()); |
389 UpdateRSetImmediate update_rs_cl(_g1->g1_rem_set()); |
387 FilterIntoCSClosure update_rs_cset_oop_cl(NULL, _g1, &update_rs_cl); |
390 FilterIntoCSClosure update_rs_cset_oop_cl(NULL, _g1, &update_rs_cl); |
388 FilterOutOfRegionClosure filter_then_update_rs_cset_oop_cl(r, &update_rs_cset_oop_cl); |
391 FilterOutOfRegionClosure filter_then_update_rs_cset_oop_cl(r, &update_rs_cset_oop_cl); |
528 HeapWord* start = _ct_bs->addr_for(card_ptr); |
531 HeapWord* start = _ct_bs->addr_for(card_ptr); |
529 // And find the region containing it. |
532 // And find the region containing it. |
530 HeapRegion* r = _g1->heap_region_containing(start); |
533 HeapRegion* r = _g1->heap_region_containing(start); |
531 assert(r != NULL, "unexpected null"); |
534 assert(r != NULL, "unexpected null"); |
532 |
535 |
533 HeapWord* end = _ct_bs->addr_for(card_ptr + 1); |
536 // Don't use addr_for(card_ptr + 1) which can ask for |
|
537 // a card beyond the heap. This is not safe without a perm |
|
538 // gen at the upper end of the heap. |
|
539 HeapWord* end = start + CardTableModRefBS::card_size_in_words; |
534 MemRegion dirtyRegion(start, end); |
540 MemRegion dirtyRegion(start, end); |
535 |
541 |
536 #if CARD_REPEAT_HISTO |
542 #if CARD_REPEAT_HISTO |
537 init_ct_freq_table(_g1->max_capacity()); |
543 init_ct_freq_table(_g1->max_capacity()); |
538 ct_freq_note_card(_ct_bs->index_for(start)); |
544 ct_freq_note_card(_ct_bs->index_for(start)); |
620 // Construct the region representing the card. |
626 // Construct the region representing the card. |
621 HeapWord* start = _ct_bs->addr_for(card_ptr); |
627 HeapWord* start = _ct_bs->addr_for(card_ptr); |
622 // And find the region containing it. |
628 // And find the region containing it. |
623 HeapRegion* r = _g1->heap_region_containing(start); |
629 HeapRegion* r = _g1->heap_region_containing(start); |
624 if (r == NULL) { |
630 if (r == NULL) { |
625 guarantee(_g1->is_in_permanent(start), "Or else where?"); |
|
626 // Again no need to return that this card contains refs that |
631 // Again no need to return that this card contains refs that |
627 // point into the collection set. |
632 // point into the collection set. |
628 return false; // Not in the G1 heap (might be in perm, for example.) |
633 return false; // Not in the G1 heap (might be in perm, for example.) |
629 } |
634 } |
630 // Why do we have to check here whether a card is on a young region, |
635 // Why do we have to check here whether a card is on a young region, |
704 if (_cg1r->use_cache()) { |
709 if (_cg1r->use_cache()) { |
705 jbyte* res = _cg1r->cache_insert(card_ptr, &defer); |
710 jbyte* res = _cg1r->cache_insert(card_ptr, &defer); |
706 if (res != NULL && (res != card_ptr || defer)) { |
711 if (res != NULL && (res != card_ptr || defer)) { |
707 start = _ct_bs->addr_for(res); |
712 start = _ct_bs->addr_for(res); |
708 r = _g1->heap_region_containing(start); |
713 r = _g1->heap_region_containing(start); |
709 if (r == NULL) { |
714 if (r != NULL) { |
710 assert(_g1->is_in_permanent(start), "Or else where?"); |
|
711 } else { |
|
712 // Checking whether the region we got back from the cache |
715 // Checking whether the region we got back from the cache |
713 // is young here is inappropriate. The region could have been |
716 // is young here is inappropriate. The region could have been |
714 // freed, reallocated and tagged as young while in the cache. |
717 // freed, reallocated and tagged as young while in the cache. |
715 // Hence we could see its young type change at any time. |
718 // Hence we could see its young type change at any time. |
716 // |
719 // |