664 }
665 // Did that empty the table completely?
666 if (cur->occupied() == 0) {
667 *prev = nxt;
668 cur->set_collision_list_next(NULL);
669 _n_fine_entries--;
670 unlink_from_all(cur);
671 PerRegionTable::free(cur);
672 } else {
673 prev = cur->collision_list_next_addr();
674 }
675 }
676 cur = nxt;
677 }
678 }
679 // Since we may have deleted a from_card_cache entry from the RS, clear
680 // the FCC.
681 clear_fcc();
682 }
683
684 bool OtherRegionsTable::occupancy_less_or_equal_than(size_t occ) const {
685 guarantee(occ <= (size_t)G1RSetSparseRegionEntries,
686 err_msg("Requested maximum occupancy must be smaller or equal than "
687 SIZE_FORMAT" but is " SIZE_FORMAT, (size_t)G1RSetSparseRegionEntries, occ));
688 // The following statement is a simplification: although the predicate gives a
689 // value for the maximum total allowed remembered set entries we always only
690 // ever check the sparse remembered set for it.
691 // Getting the actual occupancy of even a single fine remembered set (a single
692 // coarse entry will almost always exceed the number the sparse remembered set can
693 // hold so we just check for zero here) is very expensive, so we do not do it.
694 return occ_coarse() == 0 && _first_all_fine_prts == NULL && occ_sparse() <= occ;
695 }
696
697 bool OtherRegionsTable::is_empty() const {
698 return occ_sparse() == 0 && occ_coarse() == 0 && _first_all_fine_prts == NULL;
699 }
700
701 size_t OtherRegionsTable::occupied() const {
702 size_t sum = occ_fine();
703 sum += occ_sparse();
704 sum += occ_coarse();
705 return sum;
706 }
707
708 size_t OtherRegionsTable::occ_fine() const {
709 size_t sum = 0;
710
711 size_t num = 0;
712 PerRegionTable * cur = _first_all_fine_prts;
713 while (cur != NULL) {
714 sum += cur->occupied();
|
664 }
665 // Did that empty the table completely?
666 if (cur->occupied() == 0) {
667 *prev = nxt;
668 cur->set_collision_list_next(NULL);
669 _n_fine_entries--;
670 unlink_from_all(cur);
671 PerRegionTable::free(cur);
672 } else {
673 prev = cur->collision_list_next_addr();
674 }
675 }
676 cur = nxt;
677 }
678 }
679 // Since we may have deleted a from_card_cache entry from the RS, clear
680 // the FCC.
681 clear_fcc();
682 }
683
684 bool OtherRegionsTable::occupancy_less_or_equal_than(size_t limit) const {
685 if (limit <= (size_t)G1RSetSparseRegionEntries) {
686 return occ_coarse() == 0 && _first_all_fine_prts == NULL && occ_sparse() <= limit;
687 } else {
688 // Current uses of this method may only use values less than G1RSetSparseRegionEntries
689 // for the limit. The solution, comparing against occupied() would be too slow
690 // at this time.
691 Unimplemented();
692 return false;
693 }
694 }
695
696 bool OtherRegionsTable::is_empty() const {
697 return occ_sparse() == 0 && occ_coarse() == 0 && _first_all_fine_prts == NULL;
698 }
699
700 size_t OtherRegionsTable::occupied() const {
701 size_t sum = occ_fine();
702 sum += occ_sparse();
703 sum += occ_coarse();
704 return sum;
705 }
706
707 size_t OtherRegionsTable::occ_fine() const {
708 size_t sum = 0;
709
710 size_t num = 0;
711 PerRegionTable * cur = _first_all_fine_prts;
712 while (cur != NULL) {
713 sum += cur->occupied();
|