Print this page
rev 2722 : 7095194: G1: HeapRegion::GrainBytes, GrainWords, and CardsPerRegion should be size_t
Summary: Declare GrainBytes, GrainWords, and CardsPerRegion as size_t.
Reviewed-by:

Split Close
Expand all
Collapse all
          --- old/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp
          +++ new/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp
↓ open down ↓ 140 lines elided ↑ open up ↑
 141  141  
 142  142      HeapRegion* loc_hr = hr();
 143  143      // If the test below fails, then this table was reused concurrently
 144  144      // with this operation.  This is OK, since the old table was coarsened,
 145  145      // and adding a bit to the new table is never incorrect.
 146  146      if (loc_hr->is_in_reserved(from)) {
 147  147        size_t hw_offset = pointer_delta((HeapWord*)from, loc_hr->bottom());
 148  148        CardIdx_t from_card = (CardIdx_t)
 149  149            hw_offset >> (CardTableModRefBS::card_shift - LogHeapWordSize);
 150  150  
 151      -      assert(0 <= from_card && from_card < HeapRegion::CardsPerRegion,
      151 +      assert(0 <= from_card && (size_t)from_card < HeapRegion::CardsPerRegion,
 152  152               "Must be in range.");
 153  153        add_card_work(from_card, par);
 154  154      }
 155  155    }
 156  156  
 157  157  public:
 158  158  
 159  159    HeapRegion* hr() const { return _hr; }
 160  160  
 161  161  #if PRT_COUNT_OCCUPIED
↓ open down ↓ 470 lines elided ↑ open up ↑
 632  632    if (prt == NULL) {
 633  633      MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
 634  634      // Confirm that it's really not there...
 635  635      prt = find_region_table(ind, from_hr);
 636  636      if (prt == NULL) {
 637  637  
 638  638        uintptr_t from_hr_bot_card_index =
 639  639          uintptr_t(from_hr->bottom())
 640  640            >> CardTableModRefBS::card_shift;
 641  641        CardIdx_t card_index = from_card - from_hr_bot_card_index;
 642      -      assert(0 <= card_index && card_index < HeapRegion::CardsPerRegion,
      642 +      assert(0 <= card_index && (size_t)card_index < HeapRegion::CardsPerRegion,
 643  643               "Must be in range.");
 644  644        if (G1HRRSUseSparseTable &&
 645  645            _sparse_table.add_card(from_hrs_ind, card_index)) {
 646  646          if (G1RecordHRRSOops) {
 647  647            HeapRegionRemSet::record(hr(), from);
 648  648  #if HRRS_VERBOSE
 649  649            gclog_or_tty->print("   Added card " PTR_FORMAT " to region "
 650  650                                "[" PTR_FORMAT "...) for ref " PTR_FORMAT ".\n",
 651  651                                align_size_down(uintptr_t(from),
 652  652                                                CardTableModRefBS::card_size),
↓ open down ↓ 406 lines elided ↑ open up ↑
1059 1059    if (prt != NULL) {
1060 1060      return prt->contains_reference(from);
1061 1061  
1062 1062    } else {
1063 1063      uintptr_t from_card =
1064 1064        (uintptr_t(from) >> CardTableModRefBS::card_shift);
1065 1065      uintptr_t hr_bot_card_index =
1066 1066        uintptr_t(hr->bottom()) >> CardTableModRefBS::card_shift;
1067 1067      assert(from_card >= hr_bot_card_index, "Inv");
1068 1068      CardIdx_t card_index = from_card - hr_bot_card_index;
1069      -    assert(0 <= card_index && card_index < HeapRegion::CardsPerRegion,
     1069 +    assert(0 <= card_index && (size_t)card_index < HeapRegion::CardsPerRegion,
1070 1070             "Must be in range.");
1071 1071      return _sparse_table.contains_card(hr_ind, card_index);
1072 1072    }
1073 1073  
1074 1074  
1075 1075  }
1076 1076  
1077 1077  void
1078 1078  OtherRegionsTable::do_cleanup_work(HRRSCleanupTask* hrrs_cleanup_task) {
1079 1079    _sparse_table.do_cleanup_work(hrrs_cleanup_task);
↓ open down ↓ 104 lines elided ↑ open up ↑
1184 1184  
1185 1185  void HeapRegionRemSetIterator::initialize(const HeapRegionRemSet* hrrs) {
1186 1186    _hrrs = hrrs;
1187 1187    _coarse_map = &_hrrs->_other_regions._coarse_map;
1188 1188    _fine_grain_regions = _hrrs->_other_regions._fine_grain_regions;
1189 1189    _bosa = _hrrs->bosa();
1190 1190  
1191 1191    _is = Sparse;
1192 1192    // Set these values so that we increment to the first region.
1193 1193    _coarse_cur_region_index = -1;
1194      -  _coarse_cur_region_cur_card = (HeapRegion::CardsPerRegion-1);;
     1194 +  _coarse_cur_region_cur_card = (HeapRegion::CardsPerRegion-1);
1195 1195  
1196 1196    _cur_region_cur_card = 0;
1197 1197  
1198 1198    _fine_array_index = -1;
1199 1199    _fine_cur_prt = NULL;
1200 1200  
1201 1201    _n_yielded_coarse = 0;
1202 1202    _n_yielded_fine = 0;
1203 1203    _n_yielded_sparse = 0;
1204 1204  
↓ open down ↓ 58 lines elided ↑ open up ↑
1263 1263      _cur_region_cur_card = _fine_cur_prt->_bm.get_next_one_offset(0);
1264 1264    }
1265 1265    assert(fine_has_next(), "Or else we exited the loop via the return.");
1266 1266    card_index = _cur_region_card_offset + _cur_region_cur_card;
1267 1267    return true;
1268 1268  }
1269 1269  
1270 1270  bool HeapRegionRemSetIterator::fine_has_next() {
1271 1271    return
1272 1272      _fine_cur_prt != NULL &&
1273      -    _cur_region_cur_card < (size_t) HeapRegion::CardsPerRegion;
     1273 +    _cur_region_cur_card < HeapRegion::CardsPerRegion;
1274 1274  }
1275 1275  
1276 1276  bool HeapRegionRemSetIterator::has_next(size_t& card_index) {
1277 1277    switch (_is) {
1278 1278    case Sparse:
1279 1279      if (_sparse_iter.has_next(card_index)) {
1280 1280        _n_yielded_sparse++;
1281 1281        return true;
1282 1282      }
1283 1283      // Otherwise, deliberate fall-through
↓ open down ↓ 189 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX