1416 _calc_cl(_cm->nextMarkBitMap(), g1h, exp_region_bm, exp_card_bm), 1417 _region_bm(region_bm), _card_bm(card_bm), 1418 _exp_region_bm(exp_region_bm), _exp_card_bm(exp_card_bm), 1419 _failures(0) { } 1420 1421 int failures() const { return _failures; } 1422 1423 bool doHeapRegion(HeapRegion* hr) { 1424 int failures = 0; 1425 1426 // Call the CalcLiveObjectsClosure to walk the marking bitmap for 1427 // this region and set the corresponding bits in the expected region 1428 // and card bitmaps. 1429 bool res = _calc_cl.doHeapRegion(hr); 1430 assert(res == false, "should be continuing"); 1431 1432 // Verify the marked bytes for this region. 1433 size_t exp_marked_bytes = _calc_cl.region_marked_bytes(); 1434 size_t act_marked_bytes = hr->next_marked_bytes(); 1435 1436 // We're not OK if expected marked bytes > actual marked bytes. It means 1437 // we have missed accounting some objects during the actual marking. 1438 // For start_humongous regions, the size of the whole object will be 1439 // in exp_marked_bytes, so this check does not apply in this case. 1440 if (exp_marked_bytes > act_marked_bytes && !hr->is_starts_humongous()) { 1441 failures += 1; 1442 } 1443 1444 // Verify the bit, for this region, in the actual and expected 1445 // (which was just calculated) region bit maps. 1446 // We're not OK if the bit in the calculated expected region 1447 // bitmap is set and the bit in the actual region bitmap is not. 1448 BitMap::idx_t index = (BitMap::idx_t) hr->hrm_index(); 1449 1450 bool expected = _exp_region_bm->at(index); 1451 bool actual = _region_bm->at(index); 1452 if (expected && !actual) { 1453 failures += 1; 1454 } 1455 1456 // Verify that the card bit maps for the cards spanned by the current 1457 // region match. We have an error if we have a set bit in the expected 1458 // bit map and the corresponding bit in the actual bitmap is not set. 1459 1460 BitMap::idx_t start_idx = _cm->card_bitmap_index_for(hr->bottom()); 1461 BitMap::idx_t end_idx = _cm->card_bitmap_index_for(hr->top()); | 1416 _calc_cl(_cm->nextMarkBitMap(), g1h, exp_region_bm, exp_card_bm), 1417 _region_bm(region_bm), _card_bm(card_bm), 1418 _exp_region_bm(exp_region_bm), _exp_card_bm(exp_card_bm), 1419 _failures(0) { } 1420 1421 int failures() const { return _failures; } 1422 1423 bool doHeapRegion(HeapRegion* hr) { 1424 int failures = 0; 1425 1426 // Call the CalcLiveObjectsClosure to walk the marking bitmap for 1427 // this region and set the corresponding bits in the expected region 1428 // and card bitmaps. 1429 bool res = _calc_cl.doHeapRegion(hr); 1430 assert(res == false, "should be continuing"); 1431 1432 // Verify the marked bytes for this region. 1433 size_t exp_marked_bytes = _calc_cl.region_marked_bytes(); 1434 size_t act_marked_bytes = hr->next_marked_bytes(); 1435 1436 if (exp_marked_bytes > act_marked_bytes) { 1437 if (hr->is_starts_humongous()) { 1438 // For start_humongous regions, the size of the whole object will be 1439 // in exp_marked_bytes. 1440 HeapRegion* region = hr; 1441 int num_regions; 1442 for (num_regions = 0; region != NULL; num_regions++) { 1443 region = _g1h->next_region_in_humongous(region); 1444 } 1445 if ((num_regions-1) * HeapRegion::GrainBytes >= exp_marked_bytes) { 1446 failures += 1; 1447 } else if (num_regions * HeapRegion::GrainBytes < exp_marked_bytes) { 1448 failures += 1; 1449 } 1450 } else { 1451 // We're not OK if expected marked bytes > actual marked bytes. It means 1452 // we have missed accounting some objects during the actual marking. 1453 failures += 1; 1454 } 1455 } 1456 1457 // Verify the bit, for this region, in the actual and expected 1458 // (which was just calculated) region bit maps. 1459 // We're not OK if the bit in the calculated expected region 1460 // bitmap is set and the bit in the actual region bitmap is not. 1461 BitMap::idx_t index = (BitMap::idx_t) hr->hrm_index(); 1462 1463 bool expected = _exp_region_bm->at(index); 1464 bool actual = _region_bm->at(index); 1465 if (expected && !actual) { 1466 failures += 1; 1467 } 1468 1469 // Verify that the card bit maps for the cards spanned by the current 1470 // region match. We have an error if we have a set bit in the expected 1471 // bit map and the corresponding bit in the actual bitmap is not set. 1472 1473 BitMap::idx_t start_idx = _cm->card_bitmap_index_for(hr->bottom()); 1474 BitMap::idx_t end_idx = _cm->card_bitmap_index_for(hr->top()); |