832 (float)occ_sum/(float)coarsenings); |
832 (float)occ_sum/(float)coarsenings); |
833 } |
833 } |
834 #endif |
834 #endif |
835 |
835 |
836 // Set the corresponding coarse bit. |
836 // Set the corresponding coarse bit. |
837 int max_hrs_index = max->hr()->hrs_index(); |
837 size_t max_hrs_index = max->hr()->hrs_index(); |
838 if (!_coarse_map.at(max_hrs_index)) { |
838 if (!_coarse_map.at(max_hrs_index)) { |
839 _coarse_map.at_put(max_hrs_index, true); |
839 _coarse_map.at_put(max_hrs_index, true); |
840 _n_coarse_entries++; |
840 _n_coarse_entries++; |
841 #if 0 |
841 #if 0 |
842 gclog_or_tty->print("Coarsened entry in region [" PTR_FORMAT "...] " |
842 gclog_or_tty->print("Coarsened entry in region [" PTR_FORMAT "...] " |
858 // At present, this must be called stop-world single-threaded. |
858 // At present, this must be called stop-world single-threaded. |
859 void OtherRegionsTable::scrub(CardTableModRefBS* ctbs, |
859 void OtherRegionsTable::scrub(CardTableModRefBS* ctbs, |
860 BitMap* region_bm, BitMap* card_bm) { |
860 BitMap* region_bm, BitMap* card_bm) { |
861 // First eliminated garbage regions from the coarse map. |
861 // First eliminated garbage regions from the coarse map. |
862 if (G1RSScrubVerbose) |
862 if (G1RSScrubVerbose) |
863 gclog_or_tty->print_cr("Scrubbing region %d:", hr()->hrs_index()); |
863 gclog_or_tty->print_cr("Scrubbing region "SIZE_FORMAT":", |
|
864 hr()->hrs_index()); |
864 |
865 |
865 assert(_coarse_map.size() == region_bm->size(), "Precondition"); |
866 assert(_coarse_map.size() == region_bm->size(), "Precondition"); |
866 if (G1RSScrubVerbose) |
867 if (G1RSScrubVerbose) |
867 gclog_or_tty->print(" Coarse map: before = %d...", _n_coarse_entries); |
868 gclog_or_tty->print(" Coarse map: before = %d...", _n_coarse_entries); |
868 _coarse_map.set_intersection(*region_bm); |
869 _coarse_map.set_intersection(*region_bm); |
876 PosParPRT** prev = &_fine_grain_regions[i]; |
877 PosParPRT** prev = &_fine_grain_regions[i]; |
877 while (cur != NULL) { |
878 while (cur != NULL) { |
878 PosParPRT* nxt = cur->next(); |
879 PosParPRT* nxt = cur->next(); |
879 // If the entire region is dead, eliminate. |
880 // If the entire region is dead, eliminate. |
880 if (G1RSScrubVerbose) |
881 if (G1RSScrubVerbose) |
881 gclog_or_tty->print_cr(" For other region %d:", cur->hr()->hrs_index()); |
882 gclog_or_tty->print_cr(" For other region "SIZE_FORMAT":", |
|
883 cur->hr()->hrs_index()); |
882 if (!region_bm->at(cur->hr()->hrs_index())) { |
884 if (!region_bm->at(cur->hr()->hrs_index())) { |
883 *prev = nxt; |
885 *prev = nxt; |
884 cur->set_next(NULL); |
886 cur->set_next(NULL); |
885 _n_fine_entries--; |
887 _n_fine_entries--; |
886 if (G1RSScrubVerbose) |
888 if (G1RSScrubVerbose) |
992 clear_fcc(); |
994 clear_fcc(); |
993 } |
995 } |
994 |
996 |
995 void OtherRegionsTable::clear_incoming_entry(HeapRegion* from_hr) { |
997 void OtherRegionsTable::clear_incoming_entry(HeapRegion* from_hr) { |
996 MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag); |
998 MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag); |
997 size_t hrs_ind = (size_t)from_hr->hrs_index(); |
999 size_t hrs_ind = from_hr->hrs_index(); |
998 size_t ind = hrs_ind & _mod_max_fine_entries_mask; |
1000 size_t ind = hrs_ind & _mod_max_fine_entries_mask; |
999 if (del_single_region_table(ind, from_hr)) { |
1001 if (del_single_region_table(ind, from_hr)) { |
1000 assert(!_coarse_map.at(hrs_ind), "Inv"); |
1002 assert(!_coarse_map.at(hrs_ind), "Inv"); |
1001 } else { |
1003 } else { |
1002 _coarse_map.par_at_put(hrs_ind, 0); |
1004 _coarse_map.par_at_put(hrs_ind, 0); |
1003 } |
1005 } |
1004 // Check to see if any of the fcc entries come from here. |
1006 // Check to see if any of the fcc entries come from here. |
1005 int hr_ind = hr()->hrs_index(); |
1007 size_t hr_ind = hr()->hrs_index(); |
1006 for (int tid = 0; tid < HeapRegionRemSet::num_par_rem_sets(); tid++) { |
1008 for (int tid = 0; tid < HeapRegionRemSet::num_par_rem_sets(); tid++) { |
1007 int fcc_ent = _from_card_cache[tid][hr_ind]; |
1009 int fcc_ent = _from_card_cache[tid][hr_ind]; |
1008 if (fcc_ent != -1) { |
1010 if (fcc_ent != -1) { |
1009 HeapWord* card_addr = (HeapWord*) |
1011 HeapWord* card_addr = (HeapWord*) |
1010 (uintptr_t(fcc_ent) << CardTableModRefBS::card_shift); |
1012 (uintptr_t(fcc_ent) << CardTableModRefBS::card_shift); |