Print this page
rev 3640 : 7200261: G1: Liveness counting inconsistencies during marking verification
Summary: The clipping code in the routine that sets the bits for a range of cards, in the liveness accounting verification code was incorrect. It set all the bits in the card bitmap from the given starting index which would lead to spurious marking verification failures.
Reviewed-by:
* * *
[mq]: code-review-comments

Split Close
Expand all
Collapse all
          --- old/src/share/vm/gc_implementation/g1/concurrentMark.cpp
          +++ new/src/share/vm/gc_implementation/g1/concurrentMark.cpp
↓ open down ↓ 1180 lines elided ↑ open up ↑
1181 1181    _remark_weak_ref_times.add((now - mark_work_end) * 1000.0);
1182 1182    _remark_times.add((now - start) * 1000.0);
1183 1183  
1184 1184    g1p->record_concurrent_mark_remark_end();
1185 1185  }
1186 1186  
1187 1187  // Base class of the closures that finalize and verify the
1188 1188  // liveness counting data.
1189 1189  class CMCountDataClosureBase: public HeapRegionClosure {
1190 1190  protected:
     1191 +  G1CollectedHeap* _g1h;
1191 1192    ConcurrentMark* _cm;
     1193 +  CardTableModRefBS* _ct_bs;
     1194 +
1192 1195    BitMap* _region_bm;
1193 1196    BitMap* _card_bm;
1194 1197  
1195      -  void set_card_bitmap_range(BitMap::idx_t start_idx, BitMap::idx_t last_idx) {
1196      -    assert(start_idx <= last_idx, "sanity");
1197      -
1198      -    // Set the inclusive bit range [start_idx, last_idx].
1199      -    // For small ranges (up to 8 cards) use a simple loop; otherwise
1200      -    // use par_at_put_range.
1201      -    if ((last_idx - start_idx) < 8) {
1202      -      for (BitMap::idx_t i = start_idx; i <= last_idx; i += 1) {
1203      -        _card_bm->par_set_bit(i);
1204      -      }
1205      -    } else {
1206      -      assert(last_idx < _card_bm->size(), "sanity");
1207      -      // Note BitMap::par_at_put_range() is exclusive.
1208      -      BitMap::idx_t max_idx = MAX2(last_idx+1, _card_bm->size());
1209      -      _card_bm->par_at_put_range(start_idx, max_idx, true);
1210      -    }
1211      -  }
1212      -
1213      -  // It takes a region that's not empty (i.e., it has at least one
     1198 +  // Takes a region that's not empty (i.e., it has at least one
1214 1199    // live object in it and sets its corresponding bit on the region
1215 1200    // bitmap to 1. If the region is "starts humongous" it will also set
1216 1201    // to 1 the bits on the region bitmap that correspond to its
1217 1202    // associated "continues humongous" regions.
1218 1203    void set_bit_for_region(HeapRegion* hr) {
1219 1204      assert(!hr->continuesHumongous(), "should have filtered those out");
1220 1205  
1221 1206      BitMap::idx_t index = (BitMap::idx_t) hr->hrs_index();
1222 1207      if (!hr->startsHumongous()) {
1223 1208        // Normal (non-humongous) case: just set the bit.
1224 1209        _region_bm->par_at_put(index, true);
1225 1210      } else {
1226 1211        // Starts humongous case: calculate how many regions are part of
1227 1212        // this humongous region and then set the bit range.
1228 1213        BitMap::idx_t end_index = (BitMap::idx_t) hr->last_hc_index();
1229 1214        _region_bm->par_at_put_range(index, end_index, true);
1230 1215      }
1231 1216    }
1232 1217  
1233 1218  public:
1234      -  CMCountDataClosureBase(ConcurrentMark *cm,
     1219 +  CMCountDataClosureBase(G1CollectedHeap* g1h,
1235 1220                           BitMap* region_bm, BitMap* card_bm):
1236      -    _cm(cm), _region_bm(region_bm), _card_bm(card_bm) { }
     1221 +    _g1h(g1h), _cm(g1h->concurrent_mark()),
     1222 +    _ct_bs((CardTableModRefBS*) (g1h->barrier_set())),
     1223 +    _region_bm(region_bm), _card_bm(card_bm) { }
1237 1224  };
1238 1225  
1239 1226  // Closure that calculates the # live objects per region. Used
1240 1227  // for verification purposes during the cleanup pause.
1241 1228  class CalcLiveObjectsClosure: public CMCountDataClosureBase {
1242 1229    CMBitMapRO* _bm;
1243 1230    size_t _region_marked_bytes;
1244 1231  
1245 1232  public:
1246      -  CalcLiveObjectsClosure(CMBitMapRO *bm, ConcurrentMark *cm,
     1233 +  CalcLiveObjectsClosure(CMBitMapRO *bm, G1CollectedHeap* g1h,
1247 1234                           BitMap* region_bm, BitMap* card_bm) :
1248      -    CMCountDataClosureBase(cm, region_bm, card_bm),
     1235 +    CMCountDataClosureBase(g1h, region_bm, card_bm),
1249 1236      _bm(bm), _region_marked_bytes(0) { }
1250 1237  
1251 1238    bool doHeapRegion(HeapRegion* hr) {
1252 1239  
1253 1240      if (hr->continuesHumongous()) {
1254 1241        // We will ignore these here and process them when their
1255 1242        // associated "starts humongous" region is processed (see
1256 1243        // set_bit_for_heap_region()). Note that we cannot rely on their
1257 1244        // associated "starts humongous" region to have their bit set to
1258 1245        // 1 since, due to the region chunking in the parallel region
1259 1246        // iteration, a "continues humongous" region might be visited
1260 1247        // before its associated "starts humongous".
1261 1248        return false;
1262 1249      }
1263 1250  
1264      -    HeapWord* nextTop = hr->next_top_at_mark_start();
1265      -    HeapWord* start   = hr->bottom();
     1251 +    HeapWord* ntams = hr->next_top_at_mark_start();
     1252 +    HeapWord* start = hr->bottom();
1266 1253  
1267      -    assert(start <= hr->end() && start <= nextTop && nextTop <= hr->end(),
     1254 +    assert(start <= hr->end() && start <= ntams && ntams <= hr->end(),
1268 1255             err_msg("Preconditions not met - "
1269      -                   "start: "PTR_FORMAT", nextTop: "PTR_FORMAT", end: "PTR_FORMAT,
1270      -                   start, nextTop, hr->end()));
     1256 +                   "start: "PTR_FORMAT", ntams: "PTR_FORMAT", end: "PTR_FORMAT,
     1257 +                   start, ntams, hr->end()));
1271 1258  
1272 1259      // Find the first marked object at or after "start".
1273      -    start = _bm->getNextMarkedWordAddress(start, nextTop);
     1260 +    start = _bm->getNextMarkedWordAddress(start, ntams);
1274 1261  
1275 1262      size_t marked_bytes = 0;
1276 1263  
1277      -    while (start < nextTop) {
     1264 +    while (start < ntams) {
1278 1265        oop obj = oop(start);
1279 1266        int obj_sz = obj->size();
1280      -      HeapWord* obj_last = start + obj_sz - 1;
     1267 +      HeapWord* obj_end = start + obj_sz;
1281 1268  
1282 1269        BitMap::idx_t start_idx = _cm->card_bitmap_index_for(start);
1283      -      BitMap::idx_t last_idx = _cm->card_bitmap_index_for(obj_last);
     1270 +      BitMap::idx_t end_idx = _cm->card_bitmap_index_for(obj_end);
     1271 +      
     1272 +      // Note: if we're looking at the last region in heap - obj_end
     1273 +      // could be actually outside the heap and end_idx correspond
     1274 +      // to a card that is also outside the heap.
     1275 +      if (_g1h->is_in_g1_reserved(obj_end) && !_ct_bs->is_card_aligned(obj_end)) {
     1276 +        // end of object is not card aligned - increment to cover
     1277 +        // all the cards spanned by the object
     1278 +        end_idx += 1;
     1279 +      }
1284 1280  
1285      -      // Set the bits in the card BM for this object (inclusive).
1286      -      set_card_bitmap_range(start_idx, last_idx);
     1281 +      // Set the bits in the card BM for the cards spanned by this object.
     1282 +      _cm->set_card_bitmap_range(_card_bm, start_idx, end_idx, true /* is_par */);
1287 1283  
1288 1284        // Add the size of this object to the number of marked bytes.
1289 1285        marked_bytes += (size_t)obj_sz * HeapWordSize;
1290 1286  
1291 1287        // Find the next marked object after this one.
1292      -      start = _bm->getNextMarkedWordAddress(obj_last + 1, nextTop);
     1288 +      start = _bm->getNextMarkedWordAddress(obj_end, ntams);
1293 1289      }
1294 1290  
1295 1291      // Mark the allocated-since-marking portion...
1296 1292      HeapWord* top = hr->top();
1297      -    if (nextTop < top) {
1298      -      BitMap::idx_t start_idx = _cm->card_bitmap_index_for(nextTop);
1299      -      BitMap::idx_t last_idx = _cm->card_bitmap_index_for(top - 1);
     1293 +    if (ntams < top) {
     1294 +      BitMap::idx_t start_idx = _cm->card_bitmap_index_for(ntams);
     1295 +      BitMap::idx_t end_idx = _cm->card_bitmap_index_for(top);
1300 1296  
1301      -      set_card_bitmap_range(start_idx, last_idx);
     1297 +      // Note: if we're looking at the last region in heap - top
     1298 +      // could actually be outside the heap and end_idx correspond
     1299 +      // to a card that is also outside the heap.
     1300 +      if (_g1h->is_in_g1_reserved(top) && !_ct_bs->is_card_aligned(top)) {
     1301 +        // end of object is not card aligned - increment to cover
     1302 +        // all the cards spanned by the object
     1303 +        end_idx += 1;
     1304 +      }
     1305 +      _cm->set_card_bitmap_range(_card_bm, start_idx, end_idx, true /* is_par */);
1302 1306  
1303 1307        // This definitely means the region has live objects.
1304 1308        set_bit_for_region(hr);
1305 1309      }
1306 1310  
1307 1311      // Update the live region bitmap.
1308 1312      if (marked_bytes > 0) {
1309 1313        set_bit_for_region(hr);
1310 1314      }
1311 1315  
↓ open down ↓ 6 lines elided ↑ open up ↑
1318 1322  
1319 1323    size_t region_marked_bytes() const { return _region_marked_bytes; }
1320 1324  };
1321 1325  
1322 1326  // Heap region closure used for verifying the counting data
1323 1327  // that was accumulated concurrently and aggregated during
1324 1328  // the remark pause. This closure is applied to the heap
1325 1329  // regions during the STW cleanup pause.
1326 1330  
1327 1331  class VerifyLiveObjectDataHRClosure: public HeapRegionClosure {
     1332 +  G1CollectedHeap* _g1h;
1328 1333    ConcurrentMark* _cm;
1329 1334    CalcLiveObjectsClosure _calc_cl;
1330 1335    BitMap* _region_bm;   // Region BM to be verified
1331 1336    BitMap* _card_bm;     // Card BM to be verified
1332 1337    bool _verbose;        // verbose output?
1333 1338  
1334 1339    BitMap* _exp_region_bm; // Expected Region BM values
1335 1340    BitMap* _exp_card_bm;   // Expected card BM values
1336 1341  
1337 1342    int _failures;
1338 1343  
1339 1344  public:
1340      -  VerifyLiveObjectDataHRClosure(ConcurrentMark* cm,
     1345 +  VerifyLiveObjectDataHRClosure(G1CollectedHeap* g1h,
1341 1346                                  BitMap* region_bm,
1342 1347                                  BitMap* card_bm,
1343 1348                                  BitMap* exp_region_bm,
1344 1349                                  BitMap* exp_card_bm,
1345 1350                                  bool verbose) :
1346      -    _cm(cm),
1347      -    _calc_cl(_cm->nextMarkBitMap(), _cm, exp_region_bm, exp_card_bm),
     1351 +    _g1h(g1h), _cm(g1h->concurrent_mark()), 
     1352 +    _calc_cl(_cm->nextMarkBitMap(), g1h, exp_region_bm, exp_card_bm),
1348 1353      _region_bm(region_bm), _card_bm(card_bm), _verbose(verbose),
1349 1354      _exp_region_bm(exp_region_bm), _exp_card_bm(exp_card_bm),
1350 1355      _failures(0) { }
1351 1356  
1352 1357    int failures() const { return _failures; }
1353 1358  
1354 1359    bool doHeapRegion(HeapRegion* hr) {
1355 1360      if (hr->continuesHumongous()) {
1356 1361        // We will ignore these here and process them when their
1357 1362        // associated "starts humongous" region is processed (see
↓ open down ↓ 126 lines elided ↑ open up ↑
1484 1489  
1485 1490      assert(_expected_card_bm->size() == _actual_card_bm->size(), "sanity");
1486 1491      assert(_expected_region_bm->size() == _actual_region_bm->size(), "sanity");
1487 1492  
1488 1493      _verbose = _cm->verbose_medium();
1489 1494    }
1490 1495  
1491 1496    void work(uint worker_id) {
1492 1497      assert(worker_id < _n_workers, "invariant");
1493 1498  
1494      -    VerifyLiveObjectDataHRClosure verify_cl(_cm,
     1499 +    VerifyLiveObjectDataHRClosure verify_cl(_g1h,
1495 1500                                              _actual_region_bm, _actual_card_bm,
1496 1501                                              _expected_region_bm,
1497 1502                                              _expected_card_bm,
1498 1503                                              _verbose);
1499 1504  
1500 1505      if (G1CollectedHeap::use_parallel_gc_threads()) {
1501 1506        _g1h->heap_region_par_iterate_chunked(&verify_cl,
1502 1507                                              worker_id,
1503 1508                                              _n_workers,
1504 1509                                              HeapRegion::VerifyCountClaimValue);
↓ open down ↓ 9 lines elided ↑ open up ↑
1514 1519  
1515 1520  // Closure that finalizes the liveness counting data.
1516 1521  // Used during the cleanup pause.
1517 1522  // Sets the bits corresponding to the interval [NTAMS, top]
1518 1523  // (which contains the implicitly live objects) in the
1519 1524  // card liveness bitmap. Also sets the bit for each region,
1520 1525  // containing live data, in the region liveness bitmap.
1521 1526  
1522 1527  class FinalCountDataUpdateClosure: public CMCountDataClosureBase {
1523 1528   public:
1524      -  FinalCountDataUpdateClosure(ConcurrentMark* cm,
     1529 +  FinalCountDataUpdateClosure(G1CollectedHeap* g1h,
1525 1530                                BitMap* region_bm,
1526 1531                                BitMap* card_bm) :
1527      -    CMCountDataClosureBase(cm, region_bm, card_bm) { }
     1532 +    CMCountDataClosureBase(g1h, region_bm, card_bm) { }
1528 1533  
1529 1534    bool doHeapRegion(HeapRegion* hr) {
1530 1535  
1531 1536      if (hr->continuesHumongous()) {
1532 1537        // We will ignore these here and process them when their
1533 1538        // associated "starts humongous" region is processed (see
1534 1539        // set_bit_for_heap_region()). Note that we cannot rely on their
1535 1540        // associated "starts humongous" region to have their bit set to
1536 1541        // 1 since, due to the region chunking in the parallel region
1537 1542        // iteration, a "continues humongous" region might be visited
↓ open down ↓ 3 lines elided ↑ open up ↑
1541 1546  
1542 1547      HeapWord* ntams = hr->next_top_at_mark_start();
1543 1548      HeapWord* top   = hr->top();
1544 1549  
1545 1550      assert(hr->bottom() <= ntams && ntams <= hr->end(), "Preconditions.");
1546 1551  
1547 1552      // Mark the allocated-since-marking portion...
1548 1553      if (ntams < top) {
1549 1554        // This definitely means the region has live objects.
1550 1555        set_bit_for_region(hr);
1551      -    }
1552      -
1553      -    // Now set the bits for [ntams, top]
1554      -    BitMap::idx_t start_idx = _cm->card_bitmap_index_for(ntams);
1555      -    // set_card_bitmap_range() expects the last_idx to be with
1556      -    // the range of the bit map (see assertion in set_card_bitmap_range()),
1557      -    // so limit it to that range with this application of MIN2.
1558      -    BitMap::idx_t last_idx = MIN2(_cm->card_bitmap_index_for(top),
1559      -                                  _card_bm->size()-1);
1560      -    if (start_idx < _card_bm->size()) {
1561      -    set_card_bitmap_range(start_idx, last_idx);
1562      -    } else {
1563      -      // To reach here start_idx must be beyond the end of
1564      -      // the bit map and last_idx must have been limited by
1565      -      // the MIN2().
1566      -      assert(start_idx == last_idx + 1,
1567      -        err_msg("Not beyond end start_idx " SIZE_FORMAT " last_idx "
1568      -                SIZE_FORMAT, start_idx, last_idx));
     1556 +      
     1557 +      // Now set the bits in the card bitmap for [ntams, top)
     1558 +      BitMap::idx_t start_idx = _cm->card_bitmap_index_for(ntams);
     1559 +      BitMap::idx_t end_idx = _cm->card_bitmap_index_for(top);
     1560 +      
     1561 +      // Note: if we're looking at the last region in heap - top
     1562 +      // could actually be outside the heap and end_idx correspond
     1563 +      // to a card that is also outside the heap.
     1564 +      if (_g1h->is_in_g1_reserved(top) && !_ct_bs->is_card_aligned(top)) {
     1565 +        // end of object is not card aligned - increment to cover
     1566 +        // all the cards spanned by the object
     1567 +        end_idx += 1;
     1568 +      }
     1569 +
     1570 +      assert(end_idx <= _card_bm->size(),
     1571 +             err_msg("oob: end_idx=  "SIZE_FORMAT", bitmap size= "SIZE_FORMAT,
     1572 +                     end_idx, _card_bm->size()));
     1573 +      assert(start_idx < _card_bm->size(),
     1574 +             err_msg("oob: start_idx=  "SIZE_FORMAT", bitmap size= "SIZE_FORMAT,
     1575 +                     start_idx, _card_bm->size()));
     1576 +      
     1577 +      _cm->set_card_bitmap_range(_card_bm, start_idx, end_idx, true /* is_par */);
1569 1578      }
1570 1579  
1571 1580      // Set the bit for the region if it contains live data
1572 1581      if (hr->next_marked_bytes() > 0) {
1573 1582        set_bit_for_region(hr);
1574 1583      }
1575 1584  
1576 1585      return false;
1577 1586    }
1578 1587  };
↓ open down ↓ 20 lines elided ↑ open up ↑
1599 1608          "Should have been previously set");
1600 1609        _n_workers = _g1h->workers()->active_workers();
1601 1610      } else {
1602 1611        _n_workers = 1;
1603 1612      }
1604 1613    }
1605 1614  
1606 1615    void work(uint worker_id) {
1607 1616      assert(worker_id < _n_workers, "invariant");
1608 1617  
1609      -    FinalCountDataUpdateClosure final_update_cl(_cm,
     1618 +    FinalCountDataUpdateClosure final_update_cl(_g1h,
1610 1619                                                  _actual_region_bm,
1611 1620                                                  _actual_card_bm);
1612 1621  
1613 1622      if (G1CollectedHeap::use_parallel_gc_threads()) {
1614 1623        _g1h->heap_region_par_iterate_chunked(&final_update_cl,
1615 1624                                              worker_id,
1616 1625                                              _n_workers,
1617 1626                                              HeapRegion::FinalCountClaimValue);
1618 1627      } else {
1619 1628        _g1h->heap_region_iterate(&final_update_cl);
↓ open down ↓ 1219 lines elided ↑ open up ↑
2839 2848  
2840 2849    for (int i = 0; i < (int)_max_task_num; ++i) {
2841 2850      OopTaskQueue* queue = _task_queues->queue(i);
2842 2851      queue->set_empty();
2843 2852    }
2844 2853  }
2845 2854  
2846 2855  // Aggregate the counting data that was constructed concurrently
2847 2856  // with marking.
2848 2857  class AggregateCountDataHRClosure: public HeapRegionClosure {
     2858 +  G1CollectedHeap* _g1h;
2849 2859    ConcurrentMark* _cm;
     2860 +  CardTableModRefBS* _ct_bs;
2850 2861    BitMap* _cm_card_bm;
2851 2862    size_t _max_task_num;
2852 2863  
2853 2864   public:
2854      -  AggregateCountDataHRClosure(ConcurrentMark *cm,
     2865 +  AggregateCountDataHRClosure(G1CollectedHeap* g1h,
2855 2866                                BitMap* cm_card_bm,
2856 2867                                size_t max_task_num) :
2857      -    _cm(cm), _cm_card_bm(cm_card_bm),
2858      -    _max_task_num(max_task_num) { }
2859      -
2860      -  bool is_card_aligned(HeapWord* p) {
2861      -    return ((uintptr_t(p) & (CardTableModRefBS::card_size - 1)) == 0);
2862      -  }
     2868 +    _g1h(g1h), _cm(g1h->concurrent_mark()),
     2869 +    _ct_bs((CardTableModRefBS*) (g1h->barrier_set())),
     2870 +    _cm_card_bm(cm_card_bm), _max_task_num(max_task_num) { }
2863 2871  
2864 2872    bool doHeapRegion(HeapRegion* hr) {
2865 2873      if (hr->continuesHumongous()) {
2866 2874        // We will ignore these here and process them when their
2867 2875        // associated "starts humongous" region is processed.
2868 2876        // Note that we cannot rely on their associated
2869 2877        // "starts humongous" region to have their bit set to 1
2870 2878        // since, due to the region chunking in the parallel region
2871 2879        // iteration, a "continues humongous" region might be visited
2872 2880        // before its associated "starts humongous".
↓ open down ↓ 10 lines elided ↑ open up ↑
2883 2891                     "top: "PTR_FORMAT", end: "PTR_FORMAT,
2884 2892                     start, limit, hr->top(), hr->end()));
2885 2893  
2886 2894      assert(hr->next_marked_bytes() == 0, "Precondition");
2887 2895  
2888 2896      if (start == limit) {
2889 2897        // NTAMS of this region has not been set so nothing to do.
2890 2898        return false;
2891 2899      }
2892 2900  
2893      -    assert(is_card_aligned(start), "sanity");
2894      -    assert(is_card_aligned(end), "sanity");
     2901 +    // 'start' should be in the heap.
     2902 +    assert(_g1h->is_in_g1_reserved(start) && _ct_bs->is_card_aligned(start), "sanity");
     2903 +    // 'end' *may* be outside the heap (if hr is the last region)
     2904 +    assert(!_g1h->is_in_g1_reserved(end) || _ct_bs->is_card_aligned(end), "sanity");
2895 2905  
2896 2906      BitMap::idx_t start_idx = _cm->card_bitmap_index_for(start);
2897 2907      BitMap::idx_t limit_idx = _cm->card_bitmap_index_for(limit);
2898 2908      BitMap::idx_t end_idx = _cm->card_bitmap_index_for(end);
2899 2909  
2900      -    // If ntams is not card aligned then we bump the index for
2901      -    // limit so that we get the card spanning ntams.
2902      -    if (!is_card_aligned(limit)) {
     2910 +    // If ntams is not card aligned then we bump card bitmap index
     2911 +    // for limit so that we get the all the cards spanned by
     2912 +    // the object ending at ntams.
     2913 +    // Note: if this is the last region in the heap then ntams
     2914 +    // *may* be outside the heap and limit_idx will correspond
     2915 +    // to a card that is also outside the heap.
     2916 +    if (_g1h->is_in_g1_reserved(limit) && !_ct_bs->is_card_aligned(limit)) {
2903 2917        limit_idx += 1;
2904 2918      }
2905 2919  
2906 2920      assert(limit_idx <= end_idx, "or else use atomics");
2907 2921  
2908 2922      // Aggregate the "stripe" in the count data associated with hr.
2909 2923      uint hrs_index = hr->hrs_index();
2910 2924      size_t marked_bytes = 0;
2911 2925  
2912 2926      for (int i = 0; (size_t)i < _max_task_num; i += 1) {
↓ open down ↓ 8 lines elided ↑ open up ↑
2921 2935        // into the global card bitmap.
2922 2936        BitMap::idx_t scan_idx = task_card_bm->get_next_one_offset(start_idx, limit_idx);
2923 2937  
2924 2938        while (scan_idx < limit_idx) {
2925 2939          assert(task_card_bm->at(scan_idx) == true, "should be");
2926 2940          _cm_card_bm->set_bit(scan_idx);
2927 2941          assert(_cm_card_bm->at(scan_idx) == true, "should be");
2928 2942  
2929 2943          // BitMap::get_next_one_offset() can handle the case when
2930 2944          // its left_offset parameter is greater than its right_offset
2931      -        // parameter. If does, however, have an early exit if
     2945 +        // parameter. It does, however, have an early exit if
2932 2946          // left_offset == right_offset. So let's limit the value
2933 2947          // passed in for left offset here.
2934 2948          BitMap::idx_t next_idx = MIN2(scan_idx + 1, limit_idx);
2935 2949          scan_idx = task_card_bm->get_next_one_offset(next_idx, limit_idx);
2936 2950        }
2937 2951      }
2938 2952  
2939 2953      // Update the marked bytes for this region.
2940 2954      hr->add_to_marked_bytes(marked_bytes);
2941 2955  
↓ open down ↓ 15 lines elided ↑ open up ↑
2957 2971                             ConcurrentMark* cm,
2958 2972                             BitMap* cm_card_bm,
2959 2973                             size_t max_task_num,
2960 2974                             int n_workers) :
2961 2975      AbstractGangTask("Count Aggregation"),
2962 2976      _g1h(g1h), _cm(cm), _cm_card_bm(cm_card_bm),
2963 2977      _max_task_num(max_task_num),
2964 2978      _active_workers(n_workers) { }
2965 2979  
2966 2980    void work(uint worker_id) {
2967      -    AggregateCountDataHRClosure cl(_cm, _cm_card_bm, _max_task_num);
     2981 +    AggregateCountDataHRClosure cl(_g1h, _cm_card_bm, _max_task_num);
2968 2982  
2969 2983      if (G1CollectedHeap::use_parallel_gc_threads()) {
2970 2984        _g1h->heap_region_par_iterate_chunked(&cl, worker_id,
2971 2985                                              _active_workers,
2972 2986                                              HeapRegion::AggregateCountClaimValue);
2973 2987      } else {
2974 2988        _g1h->heap_region_iterate(&cl);
2975 2989      }
2976 2990    }
2977 2991  };
↓ open down ↓ 1451 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX