707 bool card_processed =
708 r->oops_on_card_seq_iterate_careful<false>(dirty_region, &conc_refine_cl);
709
710 // If unable to process the card then we encountered an unparsable
711 // part of the heap (e.g. a partially allocated object) while
712 // processing a stale card. Despite the card being stale, redirty
713 // and re-enqueue, because we've already cleaned the card. Without
714 // this we could incorrectly discard a non-stale card.
715 if (!card_processed) {
716 // The card might have gotten re-dirtied and re-enqueued while we
717 // worked. (In fact, it's pretty likely.)
718 if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
719 *card_ptr = CardTableModRefBS::dirty_card_val();
720 MutexLockerEx x(Shared_DirtyCardQ_lock,
721 Mutex::_no_safepoint_check_flag);
722 DirtyCardQueue* sdcq =
723 JavaThread::dirty_card_queue_set().shared_dirty_card_queue();
724 sdcq->enqueue(card_ptr);
725 }
726 } else {
727 _num_conc_refined_cards++;
728 }
729 }
730
731 bool G1RemSet::refine_card_during_gc(jbyte* card_ptr,
732 G1ScanObjsDuringUpdateRSClosure* update_rs_cl) {
733 assert(_g1->is_gc_active(), "Only call during GC");
734
735 check_card_ptr(card_ptr, _ct_bs);
736
737 // If the card is no longer dirty, nothing to do. This covers cards that were already
738 // scanned as parts of the remembered sets.
739 if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
740 // No need to return that this card contains refs that point
741 // into the collection set.
742 return false;
743 }
744
745 // During GC we can immediately clean the card since we will not re-enqueue stale
746 // cards as we know they can be disregarded.
747 *card_ptr = CardTableModRefBS::clean_card_val();
|
707 bool card_processed =
708 r->oops_on_card_seq_iterate_careful<false>(dirty_region, &conc_refine_cl);
709
710 // If unable to process the card then we encountered an unparsable
711 // part of the heap (e.g. a partially allocated object) while
712 // processing a stale card. Despite the card being stale, redirty
713 // and re-enqueue, because we've already cleaned the card. Without
714 // this we could incorrectly discard a non-stale card.
715 if (!card_processed) {
716 // The card might have gotten re-dirtied and re-enqueued while we
717 // worked. (In fact, it's pretty likely.)
718 if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
719 *card_ptr = CardTableModRefBS::dirty_card_val();
720 MutexLockerEx x(Shared_DirtyCardQ_lock,
721 Mutex::_no_safepoint_check_flag);
722 DirtyCardQueue* sdcq =
723 JavaThread::dirty_card_queue_set().shared_dirty_card_queue();
724 sdcq->enqueue(card_ptr);
725 }
726 } else {
727 _num_conc_refined_cards++; // Unsynchronized update, only used for logging.
728 }
729 }
730
731 bool G1RemSet::refine_card_during_gc(jbyte* card_ptr,
732 G1ScanObjsDuringUpdateRSClosure* update_rs_cl) {
733 assert(_g1->is_gc_active(), "Only call during GC");
734
735 check_card_ptr(card_ptr, _ct_bs);
736
737 // If the card is no longer dirty, nothing to do. This covers cards that were already
738 // scanned as parts of the remembered sets.
739 if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
740 // No need to return that this card contains refs that point
741 // into the collection set.
742 return false;
743 }
744
745 // During GC we can immediately clean the card since we will not re-enqueue stale
746 // cards as we know they can be disregarded.
747 *card_ptr = CardTableModRefBS::clean_card_val();
|