Print this page
rev 3463 : 7114678: G1: various small fixes, code cleanup, and refactoring
Summary: Various cleanups as a prelude to introducing iterators for HeapRegions.
Reviewed-by: johnc
Contributed-by: tonyp

Split Close
Expand all
Collapse all
          --- old/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
          +++ new/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
↓ open down ↓ 27 lines elided ↑ open up ↑
  28   28  uint HeapRegionSetBase::_unrealistically_long_length = 0;
  29   29  HRSPhase HeapRegionSetBase::_phase = HRSPhaseNone;
  30   30  
  31   31  //////////////////// HeapRegionSetBase ////////////////////
  32   32  
  33   33  void HeapRegionSetBase::set_unrealistically_long_length(uint len) {
  34   34    guarantee(_unrealistically_long_length == 0, "should only be set once");
  35   35    _unrealistically_long_length = len;
  36   36  }
  37   37  
  38      -uint HeapRegionSetBase::calculate_region_num(HeapRegion* hr) {
  39      -  assert(hr->startsHumongous(), "pre-condition");
  40      -  assert(hr->capacity() % HeapRegion::GrainBytes == 0, "invariant");
  41      -  uint region_num = (uint) (hr->capacity() >> HeapRegion::LogOfHRGrainBytes);
  42      -  assert(region_num > 0, "sanity");
  43      -  return region_num;
  44      -}
  45      -
  46   38  void HeapRegionSetBase::fill_in_ext_msg(hrs_ext_msg* msg, const char* message) {
  47   39    msg->append("[%s] %s ln: %u rn: %u cy: "SIZE_FORMAT" ud: "SIZE_FORMAT,
  48   40                name(), message, length(), region_num(),
  49   41                total_capacity_bytes(), total_used_bytes());
  50   42    fill_in_ext_msg_extra(msg);
  51   43  }
  52   44  
  53   45  bool HeapRegionSetBase::verify_region(HeapRegion* hr,
  54   46                                    HeapRegionSetBase* expected_containing_set) {
  55   47    const char* error_message = NULL;
↓ open down ↓ 89 lines elided ↑ open up ↑
 145  137  
 146  138  void HeapRegionSetBase::verify_next_region(HeapRegion* hr) {
 147  139    // See comment in verify() about MT safety and verification.
 148  140    hrs_assert_mt_safety_ok(this);
 149  141    assert(_verify_in_progress,
 150  142           hrs_ext_msg(this, "verification should be in progress"));
 151  143  
 152  144    guarantee(verify_region(hr, this), hrs_ext_msg(this, "region verification"));
 153  145  
 154  146    _calc_length               += 1;
 155      -  if (!hr->isHumongous()) {
 156      -    _calc_region_num         += 1;
 157      -  } else {
 158      -    _calc_region_num         += calculate_region_num(hr);
 159      -  }
      147 +  _calc_region_num           += hr->region_num();
 160  148    _calc_total_capacity_bytes += hr->capacity();
 161  149    _calc_total_used_bytes     += hr->used();
 162  150  }
 163  151  
 164  152  void HeapRegionSetBase::verify_end() {
 165  153    // See comment in verify() about MT safety and verification.
 166  154    hrs_assert_mt_safety_ok(this);
 167  155    assert(_verify_in_progress,
 168  156           hrs_ext_msg(this, "verification should be in progress"));
 169  157  
↓ open down ↓ 313 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX