753
754 void OtherRegionsTable::clear() {
755 // if there are no entries, skip this step
756 if (_first_all_fine_prts != NULL) {
757 guarantee(_first_all_fine_prts != NULL && _last_all_fine_prts != NULL, "just checking");
758 PerRegionTable::bulk_free(_first_all_fine_prts, _last_all_fine_prts);
759 memset(_fine_grain_regions, 0, _max_fine_entries * sizeof(_fine_grain_regions[0]));
760 } else {
761 guarantee(_first_all_fine_prts == NULL && _last_all_fine_prts == NULL, "just checking");
762 }
763
764 _first_all_fine_prts = _last_all_fine_prts = NULL;
765 _sparse_table.clear();
766 _coarse_map.clear();
767 _n_fine_entries = 0;
768 _n_coarse_entries = 0;
769
770 clear_fcc();
771 }
772
773 void OtherRegionsTable::clear_incoming_entry(HeapRegion* from_hr) {
774 MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag);
775 size_t hrs_ind = (size_t) from_hr->hrs_index();
776 size_t ind = hrs_ind & _mod_max_fine_entries_mask;
777 if (del_single_region_table(ind, from_hr)) {
778 assert(!_coarse_map.at(hrs_ind), "Inv");
779 } else {
780 _coarse_map.par_at_put(hrs_ind, 0);
781 }
782 // Check to see if any of the fcc entries come from here.
783 uint hr_ind = hr()->hrs_index();
784 for (uint tid = 0; tid < HeapRegionRemSet::num_par_rem_sets(); tid++) {
785 int fcc_ent = FromCardCache::at(tid, hr_ind);
786 if (fcc_ent != FromCardCache::InvalidCard) {
787 HeapWord* card_addr = (HeapWord*)
788 (uintptr_t(fcc_ent) << CardTableModRefBS::card_shift);
789 if (hr()->is_in_reserved(card_addr)) {
790 // Clear the from card cache.
791 FromCardCache::set(tid, hr_ind, FromCardCache::InvalidCard);
792 }
793 }
794 }
795 }
796
797 bool OtherRegionsTable::del_single_region_table(size_t ind,
798 HeapRegion* hr) {
799 assert(0 <= ind && ind < _max_fine_entries, "Preconditions.");
800 PerRegionTable** prev_addr = &_fine_grain_regions[ind];
801 PerRegionTable* prt = *prev_addr;
802 while (prt != NULL && prt->hr() != hr) {
803 prev_addr = prt->collision_list_next_addr();
804 prt = prt->collision_list_next();
805 }
806 if (prt != NULL) {
807 assert(prt->hr() == hr, "Loop postcondition.");
808 *prev_addr = prt->collision_list_next();
809 unlink_from_all(prt);
810 PerRegionTable::free(prt);
811 _n_fine_entries--;
812 return true;
813 } else {
814 return false;
815 }
816 }
|
753
754 void OtherRegionsTable::clear() {
755 // if there are no entries, skip this step
756 if (_first_all_fine_prts != NULL) {
757 guarantee(_first_all_fine_prts != NULL && _last_all_fine_prts != NULL, "just checking");
758 PerRegionTable::bulk_free(_first_all_fine_prts, _last_all_fine_prts);
759 memset(_fine_grain_regions, 0, _max_fine_entries * sizeof(_fine_grain_regions[0]));
760 } else {
761 guarantee(_first_all_fine_prts == NULL && _last_all_fine_prts == NULL, "just checking");
762 }
763
764 _first_all_fine_prts = _last_all_fine_prts = NULL;
765 _sparse_table.clear();
766 _coarse_map.clear();
767 _n_fine_entries = 0;
768 _n_coarse_entries = 0;
769
770 clear_fcc();
771 }
772
773 bool OtherRegionsTable::del_single_region_table(size_t ind,
774 HeapRegion* hr) {
775 assert(0 <= ind && ind < _max_fine_entries, "Preconditions.");
776 PerRegionTable** prev_addr = &_fine_grain_regions[ind];
777 PerRegionTable* prt = *prev_addr;
778 while (prt != NULL && prt->hr() != hr) {
779 prev_addr = prt->collision_list_next_addr();
780 prt = prt->collision_list_next();
781 }
782 if (prt != NULL) {
783 assert(prt->hr() == hr, "Loop postcondition.");
784 *prev_addr = prt->collision_list_next();
785 unlink_from_all(prt);
786 PerRegionTable::free(prt);
787 _n_fine_entries--;
788 return true;
789 } else {
790 return false;
791 }
792 }
|