Merge

Fri, 20 Apr 2012 11:41:49 -0700

author
johnc
date
Fri, 20 Apr 2012 11:41:49 -0700
changeset 3715
f3f101a5e59b
parent 3709
0105f367a14c
parent 3714
f7a8920427a6
child 3716
dff6e3459210

Merge

     1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSeq.java	Tue Mar 06 12:36:59 2012 +0100
     1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSeq.java	Fri Apr 20 11:41:49 2012 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -42,7 +42,7 @@
    1.11  public class HeapRegionSeq extends VMObject {
    1.12      // HeapRegion** _regions;
    1.13      static private AddressField regionsField;
    1.14 -    // size_t _length;
    1.15 +    // uint _length;
    1.16      static private CIntegerField lengthField;
    1.17  
    1.18      static {
     2.1 --- a/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetBase.java	Tue Mar 06 12:36:59 2012 +0100
     2.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetBase.java	Fri Apr 20 11:41:49 2012 -0700
     2.3 @@ -40,9 +40,9 @@
     2.4  // Mirror class for HeapRegionSetBase. Represents a group of regions.
     2.5  
     2.6  public class HeapRegionSetBase extends VMObject {
     2.7 -    // size_t _length;
     2.8 +    // uint _length;
     2.9      static private CIntegerField lengthField;
    2.10 -    // size_t _region_num;
    2.11 +    // uint _region_num;
    2.12      static private CIntegerField regionNumField;
    2.13      // size_t _total_used_bytes;
    2.14      static private CIntegerField totalUsedBytesField;
     3.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Tue Mar 06 12:36:59 2012 +0100
     3.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Fri Apr 20 11:41:49 2012 -0700
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -2444,7 +2444,7 @@
    3.11    virtual void do_oop(narrowOop* p) { VerifyAllOopsClosure::do_oop_work(p); }
    3.12  };
    3.13  
    3.14 -void CompactibleFreeListSpace::verify(bool ignored) const {
    3.15 +void CompactibleFreeListSpace::verify() const {
    3.16    assert_lock_strong(&_freelistLock);
    3.17    verify_objects_initialized();
    3.18    MemRegion span = _collector->_span;
     4.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Tue Mar 06 12:36:59 2012 +0100
     4.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Fri Apr 20 11:41:49 2012 -0700
     4.3 @@ -1,5 +1,5 @@
     4.4  /*
     4.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
     4.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
     4.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8   *
     4.9   * This code is free software; you can redistribute it and/or modify it
    4.10 @@ -492,7 +492,7 @@
    4.11    void print()                            const;
    4.12    void print_on(outputStream* st)         const;
    4.13    void prepare_for_verify();
    4.14 -  void verify(bool allow_dirty)           const;
    4.15 +  void verify()                           const;
    4.16    void verifyFreeLists()                  const PRODUCT_RETURN;
    4.17    void verifyIndexedFreeLists()           const;
    4.18    void verifyIndexedFreeList(size_t size) const;
     5.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Tue Mar 06 12:36:59 2012 +0100
     5.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Apr 20 11:41:49 2012 -0700
     5.3 @@ -3109,21 +3109,21 @@
     5.4  }
     5.5  
     5.6  void
     5.7 -ConcurrentMarkSweepGeneration::verify(bool allow_dirty /* ignored */) {
     5.8 +ConcurrentMarkSweepGeneration::verify() {
     5.9    // Locks are normally acquired/released in gc_prologue/gc_epilogue, but those
    5.10    // are not called when the heap is verified during universe initialization and
    5.11    // at vm shutdown.
    5.12    if (freelistLock()->owned_by_self()) {
    5.13 -    cmsSpace()->verify(false /* ignored */);
    5.14 +    cmsSpace()->verify();
    5.15    } else {
    5.16      MutexLockerEx fll(freelistLock(), Mutex::_no_safepoint_check_flag);
    5.17 -    cmsSpace()->verify(false /* ignored */);
    5.18 -  }
    5.19 -}
    5.20 -
    5.21 -void CMSCollector::verify(bool allow_dirty /* ignored */) {
    5.22 -  _cmsGen->verify(allow_dirty);
    5.23 -  _permGen->verify(allow_dirty);
    5.24 +    cmsSpace()->verify();
    5.25 +  }
    5.26 +}
    5.27 +
    5.28 +void CMSCollector::verify() {
    5.29 +  _cmsGen->verify();
    5.30 +  _permGen->verify();
    5.31  }
    5.32  
    5.33  #ifndef PRODUCT
     6.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Tue Mar 06 12:36:59 2012 +0100
     6.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Fri Apr 20 11:41:49 2012 -0700
     6.3 @@ -1,5 +1,5 @@
     6.4  /*
     6.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
     6.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
     6.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8   *
     6.9   * This code is free software; you can redistribute it and/or modify it
    6.10 @@ -988,7 +988,7 @@
    6.11    CMSGCAdaptivePolicyCounters* gc_adaptive_policy_counters();
    6.12  
    6.13    // debugging
    6.14 -  void verify(bool);
    6.15 +  void verify();
    6.16    bool verify_after_remark();
    6.17    void verify_ok_to_terminate() const PRODUCT_RETURN;
    6.18    void verify_work_stacks_empty() const PRODUCT_RETURN;
    6.19 @@ -1279,7 +1279,7 @@
    6.20  
    6.21    // Debugging
    6.22    void prepare_for_verify();
    6.23 -  void verify(bool allow_dirty);
    6.24 +  void verify();
    6.25    void print_statistics()               PRODUCT_RETURN;
    6.26  
    6.27    // Performance Counters support
     7.1 --- a/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp	Tue Mar 06 12:36:59 2012 +0100
     7.2 +++ b/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp	Fri Apr 20 11:41:49 2012 -0700
     7.3 @@ -29,102 +29,6 @@
     7.4  #include "gc_implementation/g1/g1ErgoVerbose.hpp"
     7.5  #include "memory/space.inline.hpp"
     7.6  
     7.7 -CSetChooserCache::CSetChooserCache() {
     7.8 -  for (int i = 0; i < CacheLength; ++i)
     7.9 -    _cache[i] = NULL;
    7.10 -  clear();
    7.11 -}
    7.12 -
    7.13 -void CSetChooserCache::clear() {
    7.14 -  _occupancy = 0;
    7.15 -  _first = 0;
    7.16 -  for (int i = 0; i < CacheLength; ++i) {
    7.17 -    HeapRegion *hr = _cache[i];
    7.18 -    if (hr != NULL)
    7.19 -      hr->set_sort_index(-1);
    7.20 -    _cache[i] = NULL;
    7.21 -  }
    7.22 -}
    7.23 -
    7.24 -#ifndef PRODUCT
    7.25 -bool CSetChooserCache::verify() {
    7.26 -  guarantee(false, "CSetChooserCache::verify(): don't call this any more");
    7.27 -
    7.28 -  int index = _first;
    7.29 -  HeapRegion *prev = NULL;
    7.30 -  for (int i = 0; i < _occupancy; ++i) {
    7.31 -    guarantee(_cache[index] != NULL, "cache entry should not be empty");
    7.32 -    HeapRegion *hr = _cache[index];
    7.33 -    guarantee(!hr->is_young(), "should not be young!");
    7.34 -    if (prev != NULL) {
    7.35 -      guarantee(prev->gc_efficiency() >= hr->gc_efficiency(),
    7.36 -                "cache should be correctly ordered");
    7.37 -    }
    7.38 -    guarantee(hr->sort_index() == get_sort_index(index),
    7.39 -              "sort index should be correct");
    7.40 -    index = trim_index(index + 1);
    7.41 -    prev = hr;
    7.42 -  }
    7.43 -
    7.44 -  for (int i = 0; i < (CacheLength - _occupancy); ++i) {
    7.45 -    guarantee(_cache[index] == NULL, "cache entry should be empty");
    7.46 -    index = trim_index(index + 1);
    7.47 -  }
    7.48 -
    7.49 -  guarantee(index == _first, "we should have reached where we started from");
    7.50 -  return true;
    7.51 -}
    7.52 -#endif // PRODUCT
    7.53 -
    7.54 -void CSetChooserCache::insert(HeapRegion *hr) {
    7.55 -  guarantee(false, "CSetChooserCache::insert(): don't call this any more");
    7.56 -
    7.57 -  assert(!is_full(), "cache should not be empty");
    7.58 -  hr->calc_gc_efficiency();
    7.59 -
    7.60 -  int empty_index;
    7.61 -  if (_occupancy == 0) {
    7.62 -    empty_index = _first;
    7.63 -  } else {
    7.64 -    empty_index = trim_index(_first + _occupancy);
    7.65 -    assert(_cache[empty_index] == NULL, "last slot should be empty");
    7.66 -    int last_index = trim_index(empty_index - 1);
    7.67 -    HeapRegion *last = _cache[last_index];
    7.68 -    assert(last != NULL,"as the cache is not empty, last should not be empty");
    7.69 -    while (empty_index != _first &&
    7.70 -           last->gc_efficiency() < hr->gc_efficiency()) {
    7.71 -      _cache[empty_index] = last;
    7.72 -      last->set_sort_index(get_sort_index(empty_index));
    7.73 -      empty_index = last_index;
    7.74 -      last_index = trim_index(last_index - 1);
    7.75 -      last = _cache[last_index];
    7.76 -    }
    7.77 -  }
    7.78 -  _cache[empty_index] = hr;
    7.79 -  hr->set_sort_index(get_sort_index(empty_index));
    7.80 -
    7.81 -  ++_occupancy;
    7.82 -  assert(verify(), "cache should be consistent");
    7.83 -}
    7.84 -
    7.85 -HeapRegion *CSetChooserCache::remove_first() {
    7.86 -  guarantee(false, "CSetChooserCache::remove_first(): "
    7.87 -                   "don't call this any more");
    7.88 -
    7.89 -  if (_occupancy > 0) {
    7.90 -    assert(_cache[_first] != NULL, "cache should have at least one region");
    7.91 -    HeapRegion *ret = _cache[_first];
    7.92 -    _cache[_first] = NULL;
    7.93 -    ret->set_sort_index(-1);
    7.94 -    --_occupancy;
    7.95 -    _first = trim_index(_first + 1);
    7.96 -    assert(verify(), "cache should be consistent");
    7.97 -    return ret;
    7.98 -  } else {
    7.99 -    return NULL;
   7.100 -  }
   7.101 -}
   7.102 -
   7.103  // Even though we don't use the GC efficiency in our heuristics as
   7.104  // much as we used to, we still order according to GC efficiency. This
   7.105  // will cause regions with a lot of live objects and large RSets to
   7.106 @@ -134,7 +38,7 @@
   7.107  // the ones we'll skip are ones with both large RSets and a lot of
   7.108  // live objects, not the ones with just a lot of live objects if we
   7.109  // ordered according to the amount of reclaimable bytes per region.
   7.110 -static int orderRegions(HeapRegion* hr1, HeapRegion* hr2) {
   7.111 +static int order_regions(HeapRegion* hr1, HeapRegion* hr2) {
   7.112    if (hr1 == NULL) {
   7.113      if (hr2 == NULL) {
   7.114        return 0;
   7.115 @@ -156,8 +60,8 @@
   7.116    }
   7.117  }
   7.118  
   7.119 -static int orderRegions(HeapRegion** hr1p, HeapRegion** hr2p) {
   7.120 -  return orderRegions(*hr1p, *hr2p);
   7.121 +static int order_regions(HeapRegion** hr1p, HeapRegion** hr2p) {
   7.122 +  return order_regions(*hr1p, *hr2p);
   7.123  }
   7.124  
   7.125  CollectionSetChooser::CollectionSetChooser() :
   7.126 @@ -175,105 +79,74 @@
   7.127    //
   7.128    // Note: containing object is allocated on C heap since it is CHeapObj.
   7.129    //
   7.130 -  _markedRegions((ResourceObj::set_allocation_type((address)&_markedRegions,
   7.131 +  _regions((ResourceObj::set_allocation_type((address) &_regions,
   7.132                                               ResourceObj::C_HEAP),
   7.133                    100), true /* C_Heap */),
   7.134 -    _curr_index(0), _length(0),
   7.135 -    _regionLiveThresholdBytes(0), _remainingReclaimableBytes(0),
   7.136 -    _first_par_unreserved_idx(0) {
   7.137 -  _regionLiveThresholdBytes =
   7.138 +    _curr_index(0), _length(0), _first_par_unreserved_idx(0),
   7.139 +    _region_live_threshold_bytes(0), _remaining_reclaimable_bytes(0) {
   7.140 +  _region_live_threshold_bytes =
   7.141      HeapRegion::GrainBytes * (size_t) G1OldCSetRegionLiveThresholdPercent / 100;
   7.142  }
   7.143  
   7.144  #ifndef PRODUCT
   7.145 -bool CollectionSetChooser::verify() {
   7.146 -  guarantee(_length >= 0, err_msg("_length: %d", _length));
   7.147 -  guarantee(0 <= _curr_index && _curr_index <= _length,
   7.148 -            err_msg("_curr_index: %d _length: %d", _curr_index, _length));
   7.149 -  int index = 0;
   7.150 +void CollectionSetChooser::verify() {
   7.151 +  guarantee(_length <= regions_length(),
   7.152 +         err_msg("_length: %u regions length: %u", _length, regions_length()));
   7.153 +  guarantee(_curr_index <= _length,
   7.154 +            err_msg("_curr_index: %u _length: %u", _curr_index, _length));
   7.155 +  uint index = 0;
   7.156    size_t sum_of_reclaimable_bytes = 0;
   7.157    while (index < _curr_index) {
   7.158 -    guarantee(_markedRegions.at(index) == NULL,
   7.159 +    guarantee(regions_at(index) == NULL,
   7.160                "all entries before _curr_index should be NULL");
   7.161      index += 1;
   7.162    }
   7.163    HeapRegion *prev = NULL;
   7.164    while (index < _length) {
   7.165 -    HeapRegion *curr = _markedRegions.at(index++);
   7.166 -    guarantee(curr != NULL, "Regions in _markedRegions array cannot be NULL");
   7.167 -    int si = curr->sort_index();
   7.168 +    HeapRegion *curr = regions_at(index++);
   7.169 +    guarantee(curr != NULL, "Regions in _regions array cannot be NULL");
   7.170      guarantee(!curr->is_young(), "should not be young!");
   7.171      guarantee(!curr->isHumongous(), "should not be humongous!");
   7.172 -    guarantee(si > -1 && si == (index-1), "sort index invariant");
   7.173      if (prev != NULL) {
   7.174 -      guarantee(orderRegions(prev, curr) != 1,
   7.175 +      guarantee(order_regions(prev, curr) != 1,
   7.176                  err_msg("GC eff prev: %1.4f GC eff curr: %1.4f",
   7.177                          prev->gc_efficiency(), curr->gc_efficiency()));
   7.178      }
   7.179      sum_of_reclaimable_bytes += curr->reclaimable_bytes();
   7.180      prev = curr;
   7.181    }
   7.182 -  guarantee(sum_of_reclaimable_bytes == _remainingReclaimableBytes,
   7.183 +  guarantee(sum_of_reclaimable_bytes == _remaining_reclaimable_bytes,
   7.184              err_msg("reclaimable bytes inconsistent, "
   7.185                      "remaining: "SIZE_FORMAT" sum: "SIZE_FORMAT,
   7.186 -                    _remainingReclaimableBytes, sum_of_reclaimable_bytes));
   7.187 -  return true;
   7.188 +                    _remaining_reclaimable_bytes, sum_of_reclaimable_bytes));
   7.189  }
   7.190 -#endif
   7.191 +#endif // !PRODUCT
   7.192  
   7.193 -void CollectionSetChooser::fillCache() {
   7.194 -  guarantee(false, "fillCache: don't call this any more");
   7.195 -
   7.196 -  while (!_cache.is_full() && (_curr_index < _length)) {
   7.197 -    HeapRegion* hr = _markedRegions.at(_curr_index);
   7.198 -    assert(hr != NULL,
   7.199 -           err_msg("Unexpected NULL hr in _markedRegions at index %d",
   7.200 -                   _curr_index));
   7.201 -    _curr_index += 1;
   7.202 -    assert(!hr->is_young(), "should not be young!");
   7.203 -    assert(hr->sort_index() == _curr_index-1, "sort_index invariant");
   7.204 -    _markedRegions.at_put(hr->sort_index(), NULL);
   7.205 -    _cache.insert(hr);
   7.206 -    assert(!_cache.is_empty(), "cache should not be empty");
   7.207 -  }
   7.208 -  assert(verify(), "cache should be consistent");
   7.209 -}
   7.210 -
   7.211 -void CollectionSetChooser::sortMarkedHeapRegions() {
   7.212 +void CollectionSetChooser::sort_regions() {
   7.213    // First trim any unused portion of the top in the parallel case.
   7.214    if (_first_par_unreserved_idx > 0) {
   7.215 -    if (G1PrintParCleanupStats) {
   7.216 -      gclog_or_tty->print("     Truncating _markedRegions from %d to %d.\n",
   7.217 -                          _markedRegions.length(), _first_par_unreserved_idx);
   7.218 -    }
   7.219 -    assert(_first_par_unreserved_idx <= _markedRegions.length(),
   7.220 +    assert(_first_par_unreserved_idx <= regions_length(),
   7.221             "Or we didn't reserved enough length");
   7.222 -    _markedRegions.trunc_to(_first_par_unreserved_idx);
   7.223 +    regions_trunc_to(_first_par_unreserved_idx);
   7.224    }
   7.225 -  _markedRegions.sort(orderRegions);
   7.226 -  assert(_length <= _markedRegions.length(), "Requirement");
   7.227 -  assert(_length == 0 || _markedRegions.at(_length - 1) != NULL,
   7.228 -         "Testing _length");
   7.229 -  assert(_length == _markedRegions.length() ||
   7.230 -                        _markedRegions.at(_length) == NULL, "Testing _length");
   7.231 -  if (G1PrintParCleanupStats) {
   7.232 -    gclog_or_tty->print_cr("     Sorted %d marked regions.", _length);
   7.233 +  _regions.sort(order_regions);
   7.234 +  assert(_length <= regions_length(), "Requirement");
   7.235 +#ifdef ASSERT
   7.236 +  for (uint i = 0; i < _length; i++) {
   7.237 +    assert(regions_at(i) != NULL, "Should be true by sorting!");
   7.238    }
   7.239 -  for (int i = 0; i < _length; i++) {
   7.240 -    assert(_markedRegions.at(i) != NULL, "Should be true by sorting!");
   7.241 -    _markedRegions.at(i)->set_sort_index(i);
   7.242 -  }
   7.243 +#endif // ASSERT
   7.244    if (G1PrintRegionLivenessInfo) {
   7.245      G1PrintRegionLivenessInfoClosure cl(gclog_or_tty, "Post-Sorting");
   7.246 -    for (int i = 0; i < _length; ++i) {
   7.247 -      HeapRegion* r = _markedRegions.at(i);
   7.248 +    for (uint i = 0; i < _length; ++i) {
   7.249 +      HeapRegion* r = regions_at(i);
   7.250        cl.doHeapRegion(r);
   7.251      }
   7.252    }
   7.253 -  assert(verify(), "CSet chooser verification");
   7.254 +  verify();
   7.255  }
   7.256  
   7.257 -size_t CollectionSetChooser::calcMinOldCSetLength() {
   7.258 +uint CollectionSetChooser::calc_min_old_cset_length() {
   7.259    // The min old CSet region bound is based on the maximum desired
   7.260    // number of mixed GCs after a cycle. I.e., even if some old regions
   7.261    // look expensive, we should add them to the CSet anyway to make
   7.262 @@ -291,10 +164,10 @@
   7.263    if (result * gc_num < region_num) {
   7.264      result += 1;
   7.265    }
   7.266 -  return result;
   7.267 +  return (uint) result;
   7.268  }
   7.269  
   7.270 -size_t CollectionSetChooser::calcMaxOldCSetLength() {
   7.271 +uint CollectionSetChooser::calc_max_old_cset_length() {
   7.272    // The max old CSet region bound is based on the threshold expressed
   7.273    // as a percentage of the heap size. I.e., it should bound the
   7.274    // number of old regions added to the CSet irrespective of how many
   7.275 @@ -308,23 +181,23 @@
   7.276    if (100 * result < region_num * perc) {
   7.277      result += 1;
   7.278    }
   7.279 -  return result;
   7.280 +  return (uint) result;
   7.281  }
   7.282  
   7.283 -void CollectionSetChooser::addMarkedHeapRegion(HeapRegion* hr) {
   7.284 +void CollectionSetChooser::add_region(HeapRegion* hr) {
   7.285    assert(!hr->isHumongous(),
   7.286           "Humongous regions shouldn't be added to the collection set");
   7.287    assert(!hr->is_young(), "should not be young!");
   7.288 -  _markedRegions.append(hr);
   7.289 +  _regions.append(hr);
   7.290    _length++;
   7.291 -  _remainingReclaimableBytes += hr->reclaimable_bytes();
   7.292 +  _remaining_reclaimable_bytes += hr->reclaimable_bytes();
   7.293    hr->calc_gc_efficiency();
   7.294  }
   7.295  
   7.296 -void CollectionSetChooser::prepareForAddMarkedHeapRegionsPar(size_t n_regions,
   7.297 -                                                             size_t chunkSize) {
   7.298 +void CollectionSetChooser::prepare_for_par_region_addition(uint n_regions,
   7.299 +                                                           uint chunk_size) {
   7.300    _first_par_unreserved_idx = 0;
   7.301 -  int n_threads = ParallelGCThreads;
   7.302 +  uint n_threads = (uint) ParallelGCThreads;
   7.303    if (UseDynamicNumberOfGCThreads) {
   7.304      assert(G1CollectedHeap::heap()->workers()->active_workers() > 0,
   7.305        "Should have been set earlier");
   7.306 @@ -335,57 +208,46 @@
   7.307      n_threads = MAX2(G1CollectedHeap::heap()->workers()->active_workers(),
   7.308                       1U);
   7.309    }
   7.310 -  size_t max_waste = n_threads * chunkSize;
   7.311 -  // it should be aligned with respect to chunkSize
   7.312 -  size_t aligned_n_regions =
   7.313 -                     (n_regions + (chunkSize - 1)) / chunkSize * chunkSize;
   7.314 -  assert( aligned_n_regions % chunkSize == 0, "should be aligned" );
   7.315 -  _markedRegions.at_put_grow((int)(aligned_n_regions + max_waste - 1), NULL);
   7.316 +  uint max_waste = n_threads * chunk_size;
   7.317 +  // it should be aligned with respect to chunk_size
   7.318 +  uint aligned_n_regions = (n_regions + chunk_size - 1) / chunk_size * chunk_size;
   7.319 +  assert(aligned_n_regions % chunk_size == 0, "should be aligned");
   7.320 +  regions_at_put_grow(aligned_n_regions + max_waste - 1, NULL);
   7.321  }
   7.322  
   7.323 -jint CollectionSetChooser::getParMarkedHeapRegionChunk(jint n_regions) {
   7.324 -  // Don't do this assert because this can be called at a point
   7.325 -  // where the loop up stream will not execute again but might
   7.326 -  // try to claim more chunks (loop test has not been done yet).
   7.327 -  // assert(_markedRegions.length() > _first_par_unreserved_idx,
   7.328 -  //  "Striding beyond the marked regions");
   7.329 -  jint res = Atomic::add(n_regions, &_first_par_unreserved_idx);
   7.330 -  assert(_markedRegions.length() > res + n_regions - 1,
   7.331 +uint CollectionSetChooser::claim_array_chunk(uint chunk_size) {
   7.332 +  uint res = (uint) Atomic::add((jint) chunk_size,
   7.333 +                                (volatile jint*) &_first_par_unreserved_idx);
   7.334 +  assert(regions_length() > res + chunk_size - 1,
   7.335           "Should already have been expanded");
   7.336 -  return res - n_regions;
   7.337 +  return res - chunk_size;
   7.338  }
   7.339  
   7.340 -void CollectionSetChooser::setMarkedHeapRegion(jint index, HeapRegion* hr) {
   7.341 -  assert(_markedRegions.at(index) == NULL, "precondition");
   7.342 +void CollectionSetChooser::set_region(uint index, HeapRegion* hr) {
   7.343 +  assert(regions_at(index) == NULL, "precondition");
   7.344    assert(!hr->is_young(), "should not be young!");
   7.345 -  _markedRegions.at_put(index, hr);
   7.346 +  regions_at_put(index, hr);
   7.347    hr->calc_gc_efficiency();
   7.348  }
   7.349  
   7.350 -void CollectionSetChooser::updateTotals(jint region_num,
   7.351 -                                        size_t reclaimable_bytes) {
   7.352 +void CollectionSetChooser::update_totals(uint region_num,
   7.353 +                                         size_t reclaimable_bytes) {
   7.354    // Only take the lock if we actually need to update the totals.
   7.355    if (region_num > 0) {
   7.356      assert(reclaimable_bytes > 0, "invariant");
   7.357      // We could have just used atomics instead of taking the
   7.358      // lock. However, we currently don't have an atomic add for size_t.
   7.359      MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
   7.360 -    _length += (int) region_num;
   7.361 -    _remainingReclaimableBytes += reclaimable_bytes;
   7.362 +    _length += region_num;
   7.363 +    _remaining_reclaimable_bytes += reclaimable_bytes;
   7.364    } else {
   7.365      assert(reclaimable_bytes == 0, "invariant");
   7.366    }
   7.367  }
   7.368  
   7.369 -void CollectionSetChooser::clearMarkedHeapRegions() {
   7.370 -  for (int i = 0; i < _markedRegions.length(); i++) {
   7.371 -    HeapRegion* r = _markedRegions.at(i);
   7.372 -    if (r != NULL) {
   7.373 -      r->set_sort_index(-1);
   7.374 -    }
   7.375 -  }
   7.376 -  _markedRegions.clear();
   7.377 +void CollectionSetChooser::clear() {
   7.378 +  _regions.clear();
   7.379    _curr_index = 0;
   7.380    _length = 0;
   7.381 -  _remainingReclaimableBytes = 0;
   7.382 +  _remaining_reclaimable_bytes = 0;
   7.383  };
     8.1 --- a/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp	Tue Mar 06 12:36:59 2012 +0100
     8.2 +++ b/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp	Fri Apr 20 11:41:49 2012 -0700
     8.3 @@ -28,77 +28,42 @@
     8.4  #include "gc_implementation/g1/heapRegion.hpp"
     8.5  #include "utilities/growableArray.hpp"
     8.6  
     8.7 -class CSetChooserCache VALUE_OBJ_CLASS_SPEC {
     8.8 -private:
     8.9 -  enum {
    8.10 -    CacheLength = 16
    8.11 -  } PrivateConstants;
    8.12 -
    8.13 -  HeapRegion*  _cache[CacheLength];
    8.14 -  int          _occupancy; // number of regions in cache
    8.15 -  int          _first;     // (index of) "first" region in the cache
    8.16 -
    8.17 -  // adding CacheLength to deal with negative values
    8.18 -  inline int trim_index(int index) {
    8.19 -    return (index + CacheLength) % CacheLength;
    8.20 -  }
    8.21 -
    8.22 -  inline int get_sort_index(int index) {
    8.23 -    return -index-2;
    8.24 -  }
    8.25 -  inline int get_index(int sort_index) {
    8.26 -    return -sort_index-2;
    8.27 -  }
    8.28 -
    8.29 -public:
    8.30 -  CSetChooserCache(void);
    8.31 -
    8.32 -  inline int occupancy(void) { return _occupancy; }
    8.33 -  inline bool is_full()      { return _occupancy == CacheLength; }
    8.34 -  inline bool is_empty()     { return _occupancy == 0; }
    8.35 -
    8.36 -  void clear(void);
    8.37 -  void insert(HeapRegion *hr);
    8.38 -  HeapRegion *remove_first(void);
    8.39 -  inline HeapRegion *get_first(void) {
    8.40 -    return _cache[_first];
    8.41 -  }
    8.42 -
    8.43 -#ifndef PRODUCT
    8.44 -  bool verify (void);
    8.45 -  bool region_in_cache(HeapRegion *hr) {
    8.46 -    int sort_index = hr->sort_index();
    8.47 -    if (sort_index < -1) {
    8.48 -      int index = get_index(sort_index);
    8.49 -      guarantee(index < CacheLength, "should be within bounds");
    8.50 -      return _cache[index] == hr;
    8.51 -    } else
    8.52 -      return 0;
    8.53 -  }
    8.54 -#endif // PRODUCT
    8.55 -};
    8.56 -
    8.57  class CollectionSetChooser: public CHeapObj {
    8.58  
    8.59 -  GrowableArray<HeapRegion*> _markedRegions;
    8.60 +  GrowableArray<HeapRegion*> _regions;
    8.61 +
    8.62 +  // Unfortunately, GrowableArray uses ints for length and indexes. To
    8.63 +  // avoid excessive casting in the rest of the class the following
    8.64 +  // wrapper methods are provided that use uints.
    8.65 +
    8.66 +  uint regions_length()          { return (uint) _regions.length(); }
    8.67 +  HeapRegion* regions_at(uint i) { return _regions.at((int) i);     }
    8.68 +  void regions_at_put(uint i, HeapRegion* hr) {
    8.69 +    _regions.at_put((int) i, hr);
    8.70 +  }
    8.71 +  void regions_at_put_grow(uint i, HeapRegion* hr) {
    8.72 +    _regions.at_put_grow((int) i, hr);
    8.73 +  }
    8.74 +  void regions_trunc_to(uint i)  { _regions.trunc_to((uint) i); }
    8.75  
    8.76    // The index of the next candidate old region to be considered for
    8.77    // addition to the CSet.
    8.78 -  int _curr_index;
    8.79 +  uint _curr_index;
    8.80  
    8.81    // The number of candidate old regions added to the CSet chooser.
    8.82 -  int _length;
    8.83 +  uint _length;
    8.84  
    8.85 -  CSetChooserCache _cache;
    8.86 -  jint _first_par_unreserved_idx;
    8.87 +  // Keeps track of the start of the next array chunk to be claimed by
    8.88 +  // parallel GC workers.
    8.89 +  uint _first_par_unreserved_idx;
    8.90  
    8.91    // If a region has more live bytes than this threshold, it will not
    8.92    // be added to the CSet chooser and will not be a candidate for
    8.93    // collection.
    8.94 -  size_t _regionLiveThresholdBytes;
    8.95 +  size_t _region_live_threshold_bytes;
    8.96  
    8.97    // The sum of reclaimable bytes over all the regions in the CSet chooser.
    8.98 -  size_t _remainingReclaimableBytes;
    8.99 +  size_t _remaining_reclaimable_bytes;
   8.100  
   8.101  public:
   8.102  
   8.103 @@ -107,9 +72,9 @@
   8.104    HeapRegion* peek() {
   8.105      HeapRegion* res = NULL;
   8.106      if (_curr_index < _length) {
   8.107 -      res = _markedRegions.at(_curr_index);
   8.108 +      res = regions_at(_curr_index);
   8.109        assert(res != NULL,
   8.110 -             err_msg("Unexpected NULL hr in _markedRegions at index %d",
   8.111 +             err_msg("Unexpected NULL hr in _regions at index %u",
   8.112                       _curr_index));
   8.113      }
   8.114      return res;
   8.115 @@ -121,90 +86,71 @@
   8.116    void remove_and_move_to_next(HeapRegion* hr) {
   8.117      assert(hr != NULL, "pre-condition");
   8.118      assert(_curr_index < _length, "pre-condition");
   8.119 -    assert(_markedRegions.at(_curr_index) == hr, "pre-condition");
   8.120 -    hr->set_sort_index(-1);
   8.121 -    _markedRegions.at_put(_curr_index, NULL);
   8.122 -    assert(hr->reclaimable_bytes() <= _remainingReclaimableBytes,
   8.123 +    assert(regions_at(_curr_index) == hr, "pre-condition");
   8.124 +    regions_at_put(_curr_index, NULL);
   8.125 +    assert(hr->reclaimable_bytes() <= _remaining_reclaimable_bytes,
   8.126             err_msg("remaining reclaimable bytes inconsistent "
   8.127                     "from region: "SIZE_FORMAT" remaining: "SIZE_FORMAT,
   8.128 -                   hr->reclaimable_bytes(), _remainingReclaimableBytes));
   8.129 -    _remainingReclaimableBytes -= hr->reclaimable_bytes();
   8.130 +                   hr->reclaimable_bytes(), _remaining_reclaimable_bytes));
   8.131 +    _remaining_reclaimable_bytes -= hr->reclaimable_bytes();
   8.132      _curr_index += 1;
   8.133    }
   8.134  
   8.135    CollectionSetChooser();
   8.136  
   8.137 -  void sortMarkedHeapRegions();
   8.138 -  void fillCache();
   8.139 +  void sort_regions();
   8.140  
   8.141    // Determine whether to add the given region to the CSet chooser or
   8.142    // not. Currently, we skip humongous regions (we never add them to
   8.143    // the CSet, we only reclaim them during cleanup) and regions whose
   8.144    // live bytes are over the threshold.
   8.145 -  bool shouldAdd(HeapRegion* hr) {
   8.146 +  bool should_add(HeapRegion* hr) {
   8.147      assert(hr->is_marked(), "pre-condition");
   8.148      assert(!hr->is_young(), "should never consider young regions");
   8.149      return !hr->isHumongous() &&
   8.150 -            hr->live_bytes() < _regionLiveThresholdBytes;
   8.151 +            hr->live_bytes() < _region_live_threshold_bytes;
   8.152    }
   8.153  
   8.154    // Calculate the minimum number of old regions we'll add to the CSet
   8.155    // during a mixed GC.
   8.156 -  size_t calcMinOldCSetLength();
   8.157 +  uint calc_min_old_cset_length();
   8.158  
   8.159    // Calculate the maximum number of old regions we'll add to the CSet
   8.160    // during a mixed GC.
   8.161 -  size_t calcMaxOldCSetLength();
   8.162 +  uint calc_max_old_cset_length();
   8.163  
   8.164    // Serial version.
   8.165 -  void addMarkedHeapRegion(HeapRegion *hr);
   8.166 +  void add_region(HeapRegion *hr);
   8.167  
   8.168 -  // Must be called before calls to getParMarkedHeapRegionChunk.
   8.169 -  // "n_regions" is the number of regions, "chunkSize" the chunk size.
   8.170 -  void prepareForAddMarkedHeapRegionsPar(size_t n_regions, size_t chunkSize);
   8.171 -  // Returns the first index in a contiguous chunk of "n_regions" indexes
   8.172 +  // Must be called before calls to claim_array_chunk().
   8.173 +  // n_regions is the number of regions, chunk_size the chunk size.
   8.174 +  void prepare_for_par_region_addition(uint n_regions, uint chunk_size);
   8.175 +  // Returns the first index in a contiguous chunk of chunk_size indexes
   8.176    // that the calling thread has reserved.  These must be set by the
   8.177 -  // calling thread using "setMarkedHeapRegion" (to NULL if necessary).
   8.178 -  jint getParMarkedHeapRegionChunk(jint n_regions);
   8.179 +  // calling thread using set_region() (to NULL if necessary).
   8.180 +  uint claim_array_chunk(uint chunk_size);
   8.181    // Set the marked array entry at index to hr.  Careful to claim the index
   8.182    // first if in parallel.
   8.183 -  void setMarkedHeapRegion(jint index, HeapRegion* hr);
   8.184 +  void set_region(uint index, HeapRegion* hr);
   8.185    // Atomically increment the number of added regions by region_num
   8.186    // and the amount of reclaimable bytes by reclaimable_bytes.
   8.187 -  void updateTotals(jint region_num, size_t reclaimable_bytes);
   8.188 +  void update_totals(uint region_num, size_t reclaimable_bytes);
   8.189  
   8.190 -  void clearMarkedHeapRegions();
   8.191 +  void clear();
   8.192  
   8.193    // Return the number of candidate regions that remain to be collected.
   8.194 -  size_t remainingRegions() { return _length - _curr_index; }
   8.195 +  uint remaining_regions() { return _length - _curr_index; }
   8.196  
   8.197    // Determine whether the CSet chooser has more candidate regions or not.
   8.198 -  bool isEmpty() { return remainingRegions() == 0; }
   8.199 +  bool is_empty() { return remaining_regions() == 0; }
   8.200  
   8.201    // Return the reclaimable bytes that remain to be collected on
   8.202    // all the candidate regions in the CSet chooser.
   8.203 -  size_t remainingReclaimableBytes () { return _remainingReclaimableBytes; }
   8.204 +  size_t remaining_reclaimable_bytes() { return _remaining_reclaimable_bytes; }
   8.205  
   8.206 -  // Returns true if the used portion of "_markedRegions" is properly
   8.207 +  // Returns true if the used portion of "_regions" is properly
   8.208    // sorted, otherwise asserts false.
   8.209 -#ifndef PRODUCT
   8.210 -  bool verify(void);
   8.211 -  bool regionProperlyOrdered(HeapRegion* r) {
   8.212 -    int si = r->sort_index();
   8.213 -    if (si > -1) {
   8.214 -      guarantee(_curr_index <= si && si < _length,
   8.215 -                err_msg("curr: %d sort index: %d: length: %d",
   8.216 -                        _curr_index, si, _length));
   8.217 -      guarantee(_markedRegions.at(si) == r,
   8.218 -                err_msg("sort index: %d at: "PTR_FORMAT" r: "PTR_FORMAT,
   8.219 -                        si, _markedRegions.at(si), r));
   8.220 -    } else {
   8.221 -      guarantee(si == -1, err_msg("sort index: %d", si));
   8.222 -    }
   8.223 -    return true;
   8.224 -  }
   8.225 -#endif
   8.226 -
   8.227 +  void verify() PRODUCT_RETURN;
   8.228  };
   8.229  
   8.230  #endif // SHARE_VM_GC_IMPLEMENTATION_G1_COLLECTIONSETCHOOSER_HPP
     9.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Tue Mar 06 12:36:59 2012 +0100
     9.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Apr 20 11:41:49 2012 -0700
     9.3 @@ -29,6 +29,7 @@
     9.4  #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
     9.5  #include "gc_implementation/g1/g1CollectorPolicy.hpp"
     9.6  #include "gc_implementation/g1/g1ErgoVerbose.hpp"
     9.7 +#include "gc_implementation/g1/g1Log.hpp"
     9.8  #include "gc_implementation/g1/g1OopClosures.inline.hpp"
     9.9  #include "gc_implementation/g1/g1RemSet.hpp"
    9.10  #include "gc_implementation/g1/heapRegion.inline.hpp"
    9.11 @@ -402,8 +403,7 @@
    9.12    return MAX2((n_par_threads + 2) / 4, 1U);
    9.13  }
    9.14  
    9.15 -ConcurrentMark::ConcurrentMark(ReservedSpace rs,
    9.16 -                               int max_regions) :
    9.17 +ConcurrentMark::ConcurrentMark(ReservedSpace rs, uint max_regions) :
    9.18    _markBitMap1(rs, MinObjAlignment - 1),
    9.19    _markBitMap2(rs, MinObjAlignment - 1),
    9.20  
    9.21 @@ -414,7 +414,7 @@
    9.22    _cleanup_sleep_factor(0.0),
    9.23    _cleanup_task_overhead(1.0),
    9.24    _cleanup_list("Cleanup List"),
    9.25 -  _region_bm(max_regions, false /* in_resource_area*/),
    9.26 +  _region_bm((BitMap::idx_t) max_regions, false /* in_resource_area*/),
    9.27    _card_bm((rs.size() + CardTableModRefBS::card_size - 1) >>
    9.28             CardTableModRefBS::card_shift,
    9.29             false /* in_resource_area*/),
    9.30 @@ -496,7 +496,7 @@
    9.31      _task_queues->register_queue(i, task_queue);
    9.32  
    9.33      _count_card_bitmaps[i] = BitMap(card_bm_size, false);
    9.34 -    _count_marked_bytes[i] = NEW_C_HEAP_ARRAY(size_t, max_regions);
    9.35 +    _count_marked_bytes[i] = NEW_C_HEAP_ARRAY(size_t, (size_t) max_regions);
    9.36  
    9.37      _tasks[i] = new CMTask(i, this,
    9.38                             _count_marked_bytes[i],
    9.39 @@ -846,7 +846,7 @@
    9.40      clear_marking_state(concurrent() /* clear_overflow */);
    9.41      force_overflow()->update();
    9.42  
    9.43 -    if (PrintGC) {
    9.44 +    if (G1Log::fine()) {
    9.45        gclog_or_tty->date_stamp(PrintGCDateStamps);
    9.46        gclog_or_tty->stamp(PrintGCTimeStamps);
    9.47        gclog_or_tty->print_cr("[GC concurrent-mark-reset-for-overflow]");
    9.48 @@ -1119,8 +1119,7 @@
    9.49      HandleMark hm;  // handle scope
    9.50      gclog_or_tty->print(" VerifyDuringGC:(before)");
    9.51      Universe::heap()->prepare_for_verify();
    9.52 -    Universe::verify(/* allow dirty */ true,
    9.53 -                     /* silent      */ false,
    9.54 +    Universe::verify(/* silent      */ false,
    9.55                       /* option      */ VerifyOption_G1UsePrevMarking);
    9.56    }
    9.57  
    9.58 @@ -1159,8 +1158,7 @@
    9.59        HandleMark hm;  // handle scope
    9.60        gclog_or_tty->print(" VerifyDuringGC:(after)");
    9.61        Universe::heap()->prepare_for_verify();
    9.62 -      Universe::verify(/* allow dirty */ true,
    9.63 -                       /* silent      */ false,
    9.64 +      Universe::verify(/* silent      */ false,
    9.65                         /* option      */ VerifyOption_G1UseNextMarking);
    9.66      }
    9.67      assert(!restart_for_overflow(), "sanity");
    9.68 @@ -1194,11 +1192,6 @@
    9.69    BitMap* _region_bm;
    9.70    BitMap* _card_bm;
    9.71  
    9.72 -  // Debugging
    9.73 -  size_t _tot_words_done;
    9.74 -  size_t _tot_live;
    9.75 -  size_t _tot_used;
    9.76 -
    9.77    size_t _region_marked_bytes;
    9.78  
    9.79    intptr_t _bottom_card_num;
    9.80 @@ -1217,9 +1210,7 @@
    9.81    CalcLiveObjectsClosure(CMBitMapRO *bm, ConcurrentMark *cm,
    9.82                           BitMap* region_bm, BitMap* card_bm) :
    9.83      _bm(bm), _cm(cm), _region_bm(region_bm), _card_bm(card_bm),
    9.84 -    _region_marked_bytes(0), _tot_words_done(0),
    9.85 -    _tot_live(0), _tot_used(0),
    9.86 -    _bottom_card_num(cm->heap_bottom_card_num()) { }
    9.87 +    _region_marked_bytes(0), _bottom_card_num(cm->heap_bottom_card_num()) { }
    9.88  
    9.89    // It takes a region that's not empty (i.e., it has at least one
    9.90    // live object in it and sets its corresponding bit on the region
    9.91 @@ -1229,18 +1220,17 @@
    9.92    void set_bit_for_region(HeapRegion* hr) {
    9.93      assert(!hr->continuesHumongous(), "should have filtered those out");
    9.94  
    9.95 -    size_t index = hr->hrs_index();
    9.96 +    BitMap::idx_t index = (BitMap::idx_t) hr->hrs_index();
    9.97      if (!hr->startsHumongous()) {
    9.98        // Normal (non-humongous) case: just set the bit.
    9.99 -      _region_bm->par_at_put((BitMap::idx_t) index, true);
   9.100 +      _region_bm->par_at_put(index, true);
   9.101      } else {
   9.102        // Starts humongous case: calculate how many regions are part of
   9.103        // this humongous region and then set the bit range.
   9.104        G1CollectedHeap* g1h = G1CollectedHeap::heap();
   9.105        HeapRegion *last_hr = g1h->heap_region_containing_raw(hr->end() - 1);
   9.106 -      size_t end_index = last_hr->hrs_index() + 1;
   9.107 -      _region_bm->par_at_put_range((BitMap::idx_t) index,
   9.108 -                                   (BitMap::idx_t) end_index, true);
   9.109 +      BitMap::idx_t end_index = (BitMap::idx_t) last_hr->hrs_index() + 1;
   9.110 +      _region_bm->par_at_put_range(index, end_index, true);
   9.111      }
   9.112    }
   9.113  
   9.114 @@ -1265,9 +1255,6 @@
   9.115                     "start: "PTR_FORMAT", nextTop: "PTR_FORMAT", end: "PTR_FORMAT,
   9.116                     start, nextTop, hr->end()));
   9.117  
   9.118 -    // Record the number of word's we'll examine.
   9.119 -    size_t words_done = (nextTop - start);
   9.120 -
   9.121      // Find the first marked object at or after "start".
   9.122      start = _bm->getNextMarkedWordAddress(start, nextTop);
   9.123  
   9.124 @@ -1346,19 +1333,10 @@
   9.125      // it can be queried by a calling verificiation routine
   9.126      _region_marked_bytes = marked_bytes;
   9.127  
   9.128 -    _tot_live += hr->next_live_bytes();
   9.129 -    _tot_used += hr->used();
   9.130 -    _tot_words_done = words_done;
   9.131 -
   9.132      return false;
   9.133    }
   9.134  
   9.135    size_t region_marked_bytes() const { return _region_marked_bytes; }
   9.136 -
   9.137 -  // Debugging
   9.138 -  size_t tot_words_done() const      { return _tot_words_done; }
   9.139 -  size_t tot_live() const            { return _tot_live; }
   9.140 -  size_t tot_used() const            { return _tot_used; }
   9.141  };
   9.142  
   9.143  // Heap region closure used for verifying the counting data
   9.144 @@ -1419,7 +1397,7 @@
   9.145      // Verify that _top_at_conc_count == ntams
   9.146      if (hr->top_at_conc_mark_count() != hr->next_top_at_mark_start()) {
   9.147        if (_verbose) {
   9.148 -        gclog_or_tty->print_cr("Region " SIZE_FORMAT ": top at conc count incorrect: "
   9.149 +        gclog_or_tty->print_cr("Region %u: top at conc count incorrect: "
   9.150                                 "expected " PTR_FORMAT ", actual: " PTR_FORMAT,
   9.151                                 hr->hrs_index(), hr->next_top_at_mark_start(),
   9.152                                 hr->top_at_conc_mark_count());
   9.153 @@ -1435,7 +1413,7 @@
   9.154      // we have missed accounting some objects during the actual marking.
   9.155      if (exp_marked_bytes > act_marked_bytes) {
   9.156        if (_verbose) {
   9.157 -        gclog_or_tty->print_cr("Region " SIZE_FORMAT ": marked bytes mismatch: "
   9.158 +        gclog_or_tty->print_cr("Region %u: marked bytes mismatch: "
   9.159                                 "expected: " SIZE_FORMAT ", actual: " SIZE_FORMAT,
   9.160                                 hr->hrs_index(), exp_marked_bytes, act_marked_bytes);
   9.161        }
   9.162 @@ -1446,15 +1424,16 @@
   9.163      // (which was just calculated) region bit maps.
   9.164      // We're not OK if the bit in the calculated expected region
   9.165      // bitmap is set and the bit in the actual region bitmap is not.
   9.166 -    BitMap::idx_t index = (BitMap::idx_t)hr->hrs_index();
   9.167 +    BitMap::idx_t index = (BitMap::idx_t) hr->hrs_index();
   9.168  
   9.169      bool expected = _exp_region_bm->at(index);
   9.170      bool actual = _region_bm->at(index);
   9.171      if (expected && !actual) {
   9.172        if (_verbose) {
   9.173 -        gclog_or_tty->print_cr("Region " SIZE_FORMAT ": region bitmap mismatch: "
   9.174 -                               "expected: %d, actual: %d",
   9.175 -                               hr->hrs_index(), expected, actual);
   9.176 +        gclog_or_tty->print_cr("Region %u: region bitmap mismatch: "
   9.177 +                               "expected: %s, actual: %s",
   9.178 +                               hr->hrs_index(),
   9.179 +                               BOOL_TO_STR(expected), BOOL_TO_STR(actual));
   9.180        }
   9.181        failures += 1;
   9.182      }
   9.183 @@ -1472,9 +1451,10 @@
   9.184  
   9.185        if (expected && !actual) {
   9.186          if (_verbose) {
   9.187 -          gclog_or_tty->print_cr("Region " SIZE_FORMAT ": card bitmap mismatch at " SIZE_FORMAT ": "
   9.188 -                                 "expected: %d, actual: %d",
   9.189 -                                 hr->hrs_index(), i, expected, actual);
   9.190 +          gclog_or_tty->print_cr("Region %u: card bitmap mismatch at " SIZE_FORMAT ": "
   9.191 +                                 "expected: %s, actual: %s",
   9.192 +                                 hr->hrs_index(), i,
   9.193 +                                 BOOL_TO_STR(expected), BOOL_TO_STR(actual));
   9.194          }
   9.195          failures += 1;
   9.196        }
   9.197 @@ -1575,10 +1555,6 @@
   9.198    BitMap* _region_bm;
   9.199    BitMap* _card_bm;
   9.200  
   9.201 -  size_t _total_live_bytes;
   9.202 -  size_t _total_used_bytes;
   9.203 -  size_t _total_words_done;
   9.204 -
   9.205    void set_card_bitmap_range(BitMap::idx_t start_idx, BitMap::idx_t last_idx) {
   9.206      assert(start_idx <= last_idx, "sanity");
   9.207  
   9.208 @@ -1604,18 +1580,17 @@
   9.209    void set_bit_for_region(HeapRegion* hr) {
   9.210      assert(!hr->continuesHumongous(), "should have filtered those out");
   9.211  
   9.212 -    size_t index = hr->hrs_index();
   9.213 +    BitMap::idx_t index = (BitMap::idx_t) hr->hrs_index();
   9.214      if (!hr->startsHumongous()) {
   9.215        // Normal (non-humongous) case: just set the bit.
   9.216 -      _region_bm->par_set_bit((BitMap::idx_t) index);
   9.217 +      _region_bm->par_set_bit(index);
   9.218      } else {
   9.219        // Starts humongous case: calculate how many regions are part of
   9.220        // this humongous region and then set the bit range.
   9.221        G1CollectedHeap* g1h = G1CollectedHeap::heap();
   9.222        HeapRegion *last_hr = g1h->heap_region_containing_raw(hr->end() - 1);
   9.223 -      size_t end_index = last_hr->hrs_index() + 1;
   9.224 -      _region_bm->par_at_put_range((BitMap::idx_t) index,
   9.225 -                                   (BitMap::idx_t) end_index, true);
   9.226 +      BitMap::idx_t end_index = (BitMap::idx_t) last_hr->hrs_index() + 1;
   9.227 +      _region_bm->par_at_put_range(index, end_index, true);
   9.228      }
   9.229    }
   9.230  
   9.231 @@ -1623,8 +1598,7 @@
   9.232    FinalCountDataUpdateClosure(ConcurrentMark* cm,
   9.233                                BitMap* region_bm,
   9.234                                BitMap* card_bm) :
   9.235 -    _cm(cm), _region_bm(region_bm), _card_bm(card_bm),
   9.236 -    _total_words_done(0), _total_live_bytes(0), _total_used_bytes(0) { }
   9.237 +    _cm(cm), _region_bm(region_bm), _card_bm(card_bm) { }
   9.238  
   9.239    bool doHeapRegion(HeapRegion* hr) {
   9.240  
   9.241 @@ -1646,8 +1620,6 @@
   9.242      assert(hr->bottom() <= start && start <= hr->end() &&
   9.243             hr->bottom() <= ntams && ntams <= hr->end(), "Preconditions.");
   9.244  
   9.245 -    size_t words_done = ntams - hr->bottom();
   9.246 -
   9.247      if (start < ntams) {
   9.248        // Region was changed between remark and cleanup pauses
   9.249        // We need to add (ntams - start) to the marked bytes
   9.250 @@ -1678,16 +1650,8 @@
   9.251        set_bit_for_region(hr);
   9.252      }
   9.253  
   9.254 -    _total_words_done += words_done;
   9.255 -    _total_used_bytes += hr->used();
   9.256 -    _total_live_bytes += hr->next_marked_bytes();
   9.257 -
   9.258      return false;
   9.259    }
   9.260 -
   9.261 -  size_t total_words_done() const { return _total_words_done; }
   9.262 -  size_t total_live_bytes() const { return _total_live_bytes; }
   9.263 -  size_t total_used_bytes() const { return _total_used_bytes; }
   9.264  };
   9.265  
   9.266  class G1ParFinalCountTask: public AbstractGangTask {
   9.267 @@ -1699,9 +1663,6 @@
   9.268  
   9.269    uint    _n_workers;
   9.270  
   9.271 -  size_t *_live_bytes;
   9.272 -  size_t *_used_bytes;
   9.273 -
   9.274  public:
   9.275    G1ParFinalCountTask(G1CollectedHeap* g1h, BitMap* region_bm, BitMap* card_bm)
   9.276      : AbstractGangTask("G1 final counting"),
   9.277 @@ -1709,8 +1670,7 @@
   9.278        _actual_region_bm(region_bm), _actual_card_bm(card_bm),
   9.279        _n_workers(0) {
   9.280      // Use the value already set as the number of active threads
   9.281 -    // in the call to run_task().  Needed for the allocation of
   9.282 -    // _live_bytes and _used_bytes.
   9.283 +    // in the call to run_task().
   9.284      if (G1CollectedHeap::use_parallel_gc_threads()) {
   9.285        assert( _g1h->workers()->active_workers() > 0,
   9.286          "Should have been previously set");
   9.287 @@ -1718,14 +1678,6 @@
   9.288      } else {
   9.289        _n_workers = 1;
   9.290      }
   9.291 -
   9.292 -    _live_bytes = NEW_C_HEAP_ARRAY(size_t, _n_workers);
   9.293 -    _used_bytes = NEW_C_HEAP_ARRAY(size_t, _n_workers);
   9.294 -  }
   9.295 -
   9.296 -  ~G1ParFinalCountTask() {
   9.297 -    FREE_C_HEAP_ARRAY(size_t, _live_bytes);
   9.298 -    FREE_C_HEAP_ARRAY(size_t, _used_bytes);
   9.299    }
   9.300  
   9.301    void work(uint worker_id) {
   9.302 @@ -1743,23 +1695,6 @@
   9.303      } else {
   9.304        _g1h->heap_region_iterate(&final_update_cl);
   9.305      }
   9.306 -
   9.307 -    _live_bytes[worker_id] = final_update_cl.total_live_bytes();
   9.308 -    _used_bytes[worker_id] = final_update_cl.total_used_bytes();
   9.309 -  }
   9.310 -
   9.311 -  size_t live_bytes()  {
   9.312 -    size_t live_bytes = 0;
   9.313 -    for (uint i = 0; i < _n_workers; ++i)
   9.314 -      live_bytes += _live_bytes[i];
   9.315 -    return live_bytes;
   9.316 -  }
   9.317 -
   9.318 -  size_t used_bytes()  {
   9.319 -    size_t used_bytes = 0;
   9.320 -    for (uint i = 0; i < _n_workers; ++i)
   9.321 -      used_bytes += _used_bytes[i];
   9.322 -    return used_bytes;
   9.323    }
   9.324  };
   9.325  
   9.326 @@ -1769,7 +1704,7 @@
   9.327    G1CollectedHeap* _g1;
   9.328    int _worker_num;
   9.329    size_t _max_live_bytes;
   9.330 -  size_t _regions_claimed;
   9.331 +  uint _regions_claimed;
   9.332    size_t _freed_bytes;
   9.333    FreeRegionList* _local_cleanup_list;
   9.334    OldRegionSet* _old_proxy_set;
   9.335 @@ -1822,7 +1757,7 @@
   9.336    }
   9.337  
   9.338    size_t max_live_bytes() { return _max_live_bytes; }
   9.339 -  size_t regions_claimed() { return _regions_claimed; }
   9.340 +  uint regions_claimed() { return _regions_claimed; }
   9.341    double claimed_region_time_sec() { return _claimed_region_time; }
   9.342    double max_region_time_sec() { return _max_region_time; }
   9.343  };
   9.344 @@ -1894,15 +1829,6 @@
   9.345  
   9.346        HeapRegionRemSet::finish_cleanup_task(&hrrs_cleanup_task);
   9.347      }
   9.348 -    double end = os::elapsedTime();
   9.349 -    if (G1PrintParCleanupStats) {
   9.350 -      gclog_or_tty->print("     Worker thread %d [%8.3f..%8.3f = %8.3f ms] "
   9.351 -                          "claimed %u regions (tot = %8.3f ms, max = %8.3f ms).\n",
   9.352 -                          worker_id, start, end, (end-start)*1000.0,
   9.353 -                          g1_note_end.regions_claimed(),
   9.354 -                          g1_note_end.claimed_region_time_sec()*1000.0,
   9.355 -                          g1_note_end.max_region_time_sec()*1000.0);
   9.356 -    }
   9.357    }
   9.358    size_t max_live_bytes() { return _max_live_bytes; }
   9.359    size_t freed_bytes() { return _freed_bytes; }
   9.360 @@ -1949,8 +1875,7 @@
   9.361      HandleMark hm;  // handle scope
   9.362      gclog_or_tty->print(" VerifyDuringGC:(before)");
   9.363      Universe::heap()->prepare_for_verify();
   9.364 -    Universe::verify(/* allow dirty */ true,
   9.365 -                     /* silent      */ false,
   9.366 +    Universe::verify(/* silent      */ false,
   9.367                       /* option      */ VerifyOption_G1UsePrevMarking);
   9.368    }
   9.369  
   9.370 @@ -2014,29 +1939,11 @@
   9.371      guarantee(g1_par_verify_task.failures() == 0, "Unexpected accounting failures");
   9.372    }
   9.373  
   9.374 -  size_t known_garbage_bytes =
   9.375 -    g1_par_count_task.used_bytes() - g1_par_count_task.live_bytes();
   9.376 -  g1p->set_known_garbage_bytes(known_garbage_bytes);
   9.377 -
   9.378    size_t start_used_bytes = g1h->used();
   9.379    g1h->set_marking_complete();
   9.380  
   9.381 -  ergo_verbose4(ErgoConcCycles,
   9.382 -           "finish cleanup",
   9.383 -           ergo_format_byte("occupancy")
   9.384 -           ergo_format_byte("capacity")
   9.385 -           ergo_format_byte_perc("known garbage"),
   9.386 -           start_used_bytes, g1h->capacity(),
   9.387 -           known_garbage_bytes,
   9.388 -           ((double) known_garbage_bytes / (double) g1h->capacity()) * 100.0);
   9.389 -
   9.390    double count_end = os::elapsedTime();
   9.391    double this_final_counting_time = (count_end - start);
   9.392 -  if (G1PrintParCleanupStats) {
   9.393 -    gclog_or_tty->print_cr("Cleanup:");
   9.394 -    gclog_or_tty->print_cr("  Finalize counting: %8.3f ms",
   9.395 -                           this_final_counting_time*1000.0);
   9.396 -  }
   9.397    _total_counting_time += this_final_counting_time;
   9.398  
   9.399    if (G1PrintRegionLivenessInfo) {
   9.400 @@ -2050,7 +1957,6 @@
   9.401    g1h->reset_gc_time_stamp();
   9.402  
   9.403    // Note end of marking in all heap regions.
   9.404 -  double note_end_start = os::elapsedTime();
   9.405    G1ParNoteEndTask g1_par_note_end_task(g1h, &_cleanup_list);
   9.406    if (G1CollectedHeap::use_parallel_gc_threads()) {
   9.407      g1h->set_par_threads((int)n_workers);
   9.408 @@ -2069,11 +1975,6 @@
   9.409      // regions that there will be more free regions coming soon.
   9.410      g1h->set_free_regions_coming();
   9.411    }
   9.412 -  double note_end_end = os::elapsedTime();
   9.413 -  if (G1PrintParCleanupStats) {
   9.414 -    gclog_or_tty->print_cr("  note end of marking: %8.3f ms.",
   9.415 -                           (note_end_end - note_end_start)*1000.0);
   9.416 -  }
   9.417  
   9.418    // call below, since it affects the metric by which we sort the heap
   9.419    // regions.
   9.420 @@ -2105,16 +2006,13 @@
   9.421    double end = os::elapsedTime();
   9.422    _cleanup_times.add((end - start) * 1000.0);
   9.423  
   9.424 -  if (PrintGC || PrintGCDetails) {
   9.425 +  if (G1Log::fine()) {
   9.426      g1h->print_size_transition(gclog_or_tty,
   9.427                                 start_used_bytes,
   9.428                                 g1h->used(),
   9.429                                 g1h->capacity());
   9.430    }
   9.431  
   9.432 -  size_t cleaned_up_bytes = start_used_bytes - g1h->used();
   9.433 -  g1p->decrease_known_garbage_bytes(cleaned_up_bytes);
   9.434 -
   9.435    // Clean up will have freed any regions completely full of garbage.
   9.436    // Update the soft reference policy with the new heap occupancy.
   9.437    Universe::update_heap_info_at_gc();
   9.438 @@ -2131,8 +2029,7 @@
   9.439      HandleMark hm;  // handle scope
   9.440      gclog_or_tty->print(" VerifyDuringGC:(after)");
   9.441      Universe::heap()->prepare_for_verify();
   9.442 -    Universe::verify(/* allow dirty */ true,
   9.443 -                     /* silent      */ false,
   9.444 +    Universe::verify(/* silent      */ false,
   9.445                       /* option      */ VerifyOption_G1UsePrevMarking);
   9.446    }
   9.447  
   9.448 @@ -2149,7 +2046,7 @@
   9.449  
   9.450    if (G1ConcRegionFreeingVerbose) {
   9.451      gclog_or_tty->print_cr("G1ConcRegionFreeing [complete cleanup] : "
   9.452 -                           "cleanup list has "SIZE_FORMAT" entries",
   9.453 +                           "cleanup list has %u entries",
   9.454                             _cleanup_list.length());
   9.455    }
   9.456  
   9.457 @@ -2171,9 +2068,8 @@
   9.458          _cleanup_list.is_empty()) {
   9.459        if (G1ConcRegionFreeingVerbose) {
   9.460          gclog_or_tty->print_cr("G1ConcRegionFreeing [complete cleanup] : "
   9.461 -                               "appending "SIZE_FORMAT" entries to the "
   9.462 -                               "secondary_free_list, clean list still has "
   9.463 -                               SIZE_FORMAT" entries",
   9.464 +                               "appending %u entries to the secondary_free_list, "
   9.465 +                               "cleanup list still has %u entries",
   9.466                                 tmp_free_list.length(),
   9.467                                 _cleanup_list.length());
   9.468        }
   9.469 @@ -2446,11 +2342,10 @@
   9.470    // Inner scope to exclude the cleaning of the string and symbol
   9.471    // tables from the displayed time.
   9.472    {
   9.473 -    bool verbose = PrintGC && PrintGCDetails;
   9.474 -    if (verbose) {
   9.475 +    if (G1Log::finer()) {
   9.476        gclog_or_tty->put(' ');
   9.477      }
   9.478 -    TraceTime t("GC ref-proc", verbose, false, gclog_or_tty);
   9.479 +    TraceTime t("GC ref-proc", G1Log::finer(), false, gclog_or_tty);
   9.480  
   9.481      ReferenceProcessor* rp = g1h->ref_processor_cm();
   9.482  
   9.483 @@ -3144,7 +3039,7 @@
   9.484      assert(limit_idx <= end_idx, "or else use atomics");
   9.485  
   9.486      // Aggregate the "stripe" in the count data associated with hr.
   9.487 -    size_t hrs_index = hr->hrs_index();
   9.488 +    uint hrs_index = hr->hrs_index();
   9.489      size_t marked_bytes = 0;
   9.490  
   9.491      for (int i = 0; (size_t)i < _max_task_num; i += 1) {
   9.492 @@ -3252,7 +3147,7 @@
   9.493    // of the final counting task.
   9.494    _region_bm.clear();
   9.495  
   9.496 -  size_t max_regions = _g1h->max_regions();
   9.497 +  uint max_regions = _g1h->max_regions();
   9.498    assert(_max_task_num != 0, "unitialized");
   9.499  
   9.500    for (int i = 0; (size_t) i < _max_task_num; i += 1) {
   9.501 @@ -3262,7 +3157,7 @@
   9.502      assert(task_card_bm->size() == _card_bm.size(), "size mismatch");
   9.503      assert(marked_bytes_array != NULL, "uninitialized");
   9.504  
   9.505 -    memset(marked_bytes_array, 0, (max_regions * sizeof(size_t)));
   9.506 +    memset(marked_bytes_array, 0, (size_t) max_regions * sizeof(size_t));
   9.507      task_card_bm->clear();
   9.508    }
   9.509  }
    10.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Tue Mar 06 12:36:59 2012 +0100
    10.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Fri Apr 20 11:41:49 2012 -0700
    10.3 @@ -636,7 +636,7 @@
    10.4      return _task_queues->steal(task_num, hash_seed, obj);
    10.5    }
    10.6  
    10.7 -  ConcurrentMark(ReservedSpace rs, int max_regions);
    10.8 +  ConcurrentMark(ReservedSpace rs, uint max_regions);
    10.9    ~ConcurrentMark();
   10.10  
   10.11    ConcurrentMarkThread* cmThread() { return _cmThread; }
    11.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Tue Mar 06 12:36:59 2012 +0100
    11.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Fri Apr 20 11:41:49 2012 -0700
    11.3 @@ -49,7 +49,7 @@
    11.4    HeapWord* start = mr.start();
    11.5    HeapWord* last = mr.last();
    11.6    size_t region_size_bytes = mr.byte_size();
    11.7 -  size_t index = hr->hrs_index();
    11.8 +  uint index = hr->hrs_index();
    11.9  
   11.10    assert(!hr->continuesHumongous(), "should not be HC region");
   11.11    assert(hr == g1h->heap_region_containing(start), "sanity");
    12.1 --- a/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Tue Mar 06 12:36:59 2012 +0100
    12.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Fri Apr 20 11:41:49 2012 -0700
    12.3 @@ -26,6 +26,7 @@
    12.4  #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
    12.5  #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
    12.6  #include "gc_implementation/g1/g1CollectorPolicy.hpp"
    12.7 +#include "gc_implementation/g1/g1Log.hpp"
    12.8  #include "gc_implementation/g1/g1MMUTracker.hpp"
    12.9  #include "gc_implementation/g1/vm_operations_g1.hpp"
   12.10  #include "memory/resourceArea.hpp"
   12.11 @@ -104,7 +105,7 @@
   12.12  
   12.13        double scan_start = os::elapsedTime();
   12.14        if (!cm()->has_aborted()) {
   12.15 -        if (PrintGC) {
   12.16 +        if (G1Log::fine()) {
   12.17            gclog_or_tty->date_stamp(PrintGCDateStamps);
   12.18            gclog_or_tty->stamp(PrintGCTimeStamps);
   12.19            gclog_or_tty->print_cr("[GC concurrent-root-region-scan-start]");
   12.20 @@ -113,7 +114,7 @@
   12.21          _cm->scanRootRegions();
   12.22  
   12.23          double scan_end = os::elapsedTime();
   12.24 -        if (PrintGC) {
   12.25 +        if (G1Log::fine()) {
   12.26            gclog_or_tty->date_stamp(PrintGCDateStamps);
   12.27            gclog_or_tty->stamp(PrintGCTimeStamps);
   12.28            gclog_or_tty->print_cr("[GC concurrent-root-region-scan-end, %1.7lf]",
   12.29 @@ -122,7 +123,7 @@
   12.30        }
   12.31  
   12.32        double mark_start_sec = os::elapsedTime();
   12.33 -      if (PrintGC) {
   12.34 +      if (G1Log::fine()) {
   12.35          gclog_or_tty->date_stamp(PrintGCDateStamps);
   12.36          gclog_or_tty->stamp(PrintGCTimeStamps);
   12.37          gclog_or_tty->print_cr("[GC concurrent-mark-start]");
   12.38 @@ -146,7 +147,7 @@
   12.39              os::sleep(current_thread, sleep_time_ms, false);
   12.40            }
   12.41  
   12.42 -          if (PrintGC) {
   12.43 +          if (G1Log::fine()) {
   12.44              gclog_or_tty->date_stamp(PrintGCDateStamps);
   12.45              gclog_or_tty->stamp(PrintGCTimeStamps);
   12.46              gclog_or_tty->print_cr("[GC concurrent-mark-end, %1.7lf sec]",
   12.47 @@ -165,7 +166,7 @@
   12.48          }
   12.49  
   12.50          if (cm()->restart_for_overflow()) {
   12.51 -          if (PrintGC) {
   12.52 +          if (G1Log::fine()) {
   12.53              gclog_or_tty->date_stamp(PrintGCDateStamps);
   12.54              gclog_or_tty->stamp(PrintGCTimeStamps);
   12.55              gclog_or_tty->print_cr("[GC concurrent-mark-restart-for-overflow]");
   12.56 @@ -211,7 +212,7 @@
   12.57          // reclaimed by cleanup.
   12.58  
   12.59          double cleanup_start_sec = os::elapsedTime();
   12.60 -        if (PrintGC) {
   12.61 +        if (G1Log::fine()) {
   12.62            gclog_or_tty->date_stamp(PrintGCDateStamps);
   12.63            gclog_or_tty->stamp(PrintGCTimeStamps);
   12.64            gclog_or_tty->print_cr("[GC concurrent-cleanup-start]");
   12.65 @@ -232,7 +233,7 @@
   12.66          g1h->reset_free_regions_coming();
   12.67  
   12.68          double cleanup_end_sec = os::elapsedTime();
   12.69 -        if (PrintGC) {
   12.70 +        if (G1Log::fine()) {
   12.71            gclog_or_tty->date_stamp(PrintGCDateStamps);
   12.72            gclog_or_tty->stamp(PrintGCTimeStamps);
   12.73            gclog_or_tty->print_cr("[GC concurrent-cleanup-end, %1.7lf]",
   12.74 @@ -273,7 +274,7 @@
   12.75        _sts.leave();
   12.76  
   12.77        if (cm()->has_aborted()) {
   12.78 -        if (PrintGC) {
   12.79 +        if (G1Log::fine()) {
   12.80            gclog_or_tty->date_stamp(PrintGCDateStamps);
   12.81            gclog_or_tty->stamp(PrintGCTimeStamps);
   12.82            gclog_or_tty->print_cr("[GC concurrent-mark-abort]");
    13.1 --- a/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp	Tue Mar 06 12:36:59 2012 +0100
    13.2 +++ b/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp	Fri Apr 20 11:41:49 2012 -0700
    13.3 @@ -1,5 +1,5 @@
    13.4  /*
    13.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    13.6 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    13.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.8   *
    13.9   * This code is free software; you can redistribute it and/or modify it
   13.10 @@ -140,7 +140,7 @@
   13.11  }
   13.12  
   13.13  void G1AllocRegion::fill_in_ext_msg(ar_ext_msg* msg, const char* message) {
   13.14 -  msg->append("[%s] %s c: "SIZE_FORMAT" b: %s r: "PTR_FORMAT" u: "SIZE_FORMAT,
   13.15 +  msg->append("[%s] %s c: %u b: %s r: "PTR_FORMAT" u: "SIZE_FORMAT,
   13.16                _name, message, _count, BOOL_TO_STR(_bot_updates),
   13.17                _alloc_region, _used_bytes_before);
   13.18  }
   13.19 @@ -215,7 +215,7 @@
   13.20        jio_snprintf(rest_buffer, buffer_length, "");
   13.21      }
   13.22  
   13.23 -    tty->print_cr("[%s] "SIZE_FORMAT" %s : %s %s",
   13.24 +    tty->print_cr("[%s] %u %s : %s %s",
   13.25                    _name, _count, hr_buffer, str, rest_buffer);
   13.26    }
   13.27  }
    14.1 --- a/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp	Tue Mar 06 12:36:59 2012 +0100
    14.2 +++ b/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp	Fri Apr 20 11:41:49 2012 -0700
    14.3 @@ -1,5 +1,5 @@
    14.4  /*
    14.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    14.6 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    14.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.8   *
    14.9   * This code is free software; you can redistribute it and/or modify it
   14.10 @@ -64,7 +64,7 @@
   14.11    // the region that is re-used using the set() method. This count can
   14.12    // be used in any heuristics that might want to bound how many
   14.13    // distinct regions this object can used during an active interval.
   14.14 -  size_t _count;
   14.15 +  uint _count;
   14.16  
   14.17    // When we set up a new active region we save its used bytes in this
   14.18    // field so that, when we retire it, we can calculate how much space
   14.19 @@ -136,7 +136,7 @@
   14.20      return (_alloc_region == _dummy_region) ? NULL : _alloc_region;
   14.21    }
   14.22  
   14.23 -  size_t count() { return _count; }
   14.24 +  uint count() { return _count; }
   14.25  
   14.26    // The following two are the building blocks for the allocation method.
   14.27  
    15.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Tue Mar 06 12:36:59 2012 +0100
    15.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Apr 20 11:41:49 2012 -0700
    15.3 @@ -33,6 +33,7 @@
    15.4  #include "gc_implementation/g1/g1CollectorPolicy.hpp"
    15.5  #include "gc_implementation/g1/g1ErgoVerbose.hpp"
    15.6  #include "gc_implementation/g1/g1EvacFailure.hpp"
    15.7 +#include "gc_implementation/g1/g1Log.hpp"
    15.8  #include "gc_implementation/g1/g1MarkSweep.hpp"
    15.9  #include "gc_implementation/g1/g1OopClosures.inline.hpp"
   15.10  #include "gc_implementation/g1/g1RemSet.inline.hpp"
   15.11 @@ -233,7 +234,7 @@
   15.12  bool YoungList::check_list_well_formed() {
   15.13    bool ret = true;
   15.14  
   15.15 -  size_t length = 0;
   15.16 +  uint length = 0;
   15.17    HeapRegion* curr = _head;
   15.18    HeapRegion* last = NULL;
   15.19    while (curr != NULL) {
   15.20 @@ -252,7 +253,7 @@
   15.21  
   15.22    if (!ret) {
   15.23      gclog_or_tty->print_cr("### YOUNG LIST seems not well formed!");
   15.24 -    gclog_or_tty->print_cr("###   list has %d entries, _length is %d",
   15.25 +    gclog_or_tty->print_cr("###   list has %u entries, _length is %u",
   15.26                             length, _length);
   15.27    }
   15.28  
   15.29 @@ -263,7 +264,7 @@
   15.30    bool ret = true;
   15.31  
   15.32    if (_length != 0) {
   15.33 -    gclog_or_tty->print_cr("### YOUNG LIST should have 0 length, not %d",
   15.34 +    gclog_or_tty->print_cr("### YOUNG LIST should have 0 length, not %u",
   15.35                    _length);
   15.36      ret = false;
   15.37    }
   15.38 @@ -336,8 +337,7 @@
   15.39      _g1h->g1_policy()->add_region_to_incremental_cset_rhs(curr);
   15.40      young_index_in_cset += 1;
   15.41    }
   15.42 -  assert((size_t) young_index_in_cset == _survivor_length,
   15.43 -         "post-condition");
   15.44 +  assert((uint) young_index_in_cset == _survivor_length, "post-condition");
   15.45    _g1h->g1_policy()->note_stop_adding_survivor_regions();
   15.46  
   15.47    _head   = _survivor_head;
   15.48 @@ -532,7 +532,7 @@
   15.49      if (!_secondary_free_list.is_empty()) {
   15.50        if (G1ConcRegionFreeingVerbose) {
   15.51          gclog_or_tty->print_cr("G1ConcRegionFreeing [region alloc] : "
   15.52 -                               "secondary_free_list has "SIZE_FORMAT" entries",
   15.53 +                               "secondary_free_list has %u entries",
   15.54                                 _secondary_free_list.length());
   15.55        }
   15.56        // It looks as if there are free regions available on the
   15.57 @@ -618,12 +618,12 @@
   15.58    return res;
   15.59  }
   15.60  
   15.61 -size_t G1CollectedHeap::humongous_obj_allocate_find_first(size_t num_regions,
   15.62 -                                                          size_t word_size) {
   15.63 +uint G1CollectedHeap::humongous_obj_allocate_find_first(uint num_regions,
   15.64 +                                                        size_t word_size) {
   15.65    assert(isHumongous(word_size), "word_size should be humongous");
   15.66    assert(num_regions * HeapRegion::GrainWords >= word_size, "pre-condition");
   15.67  
   15.68 -  size_t first = G1_NULL_HRS_INDEX;
   15.69 +  uint first = G1_NULL_HRS_INDEX;
   15.70    if (num_regions == 1) {
   15.71      // Only one region to allocate, no need to go through the slower
   15.72      // path. The caller will attempt the expasion if this fails, so
   15.73 @@ -649,7 +649,7 @@
   15.74      if (free_regions() >= num_regions) {
   15.75        first = _hrs.find_contiguous(num_regions);
   15.76        if (first != G1_NULL_HRS_INDEX) {
   15.77 -        for (size_t i = first; i < first + num_regions; ++i) {
   15.78 +        for (uint i = first; i < first + num_regions; ++i) {
   15.79            HeapRegion* hr = region_at(i);
   15.80            assert(hr->is_empty(), "sanity");
   15.81            assert(is_on_master_free_list(hr), "sanity");
   15.82 @@ -663,15 +663,15 @@
   15.83  }
   15.84  
   15.85  HeapWord*
   15.86 -G1CollectedHeap::humongous_obj_allocate_initialize_regions(size_t first,
   15.87 -                                                           size_t num_regions,
   15.88 +G1CollectedHeap::humongous_obj_allocate_initialize_regions(uint first,
   15.89 +                                                           uint num_regions,
   15.90                                                             size_t word_size) {
   15.91    assert(first != G1_NULL_HRS_INDEX, "pre-condition");
   15.92    assert(isHumongous(word_size), "word_size should be humongous");
   15.93    assert(num_regions * HeapRegion::GrainWords >= word_size, "pre-condition");
   15.94  
   15.95    // Index of last region in the series + 1.
   15.96 -  size_t last = first + num_regions;
   15.97 +  uint last = first + num_regions;
   15.98  
   15.99    // We need to initialize the region(s) we just discovered. This is
  15.100    // a bit tricky given that it can happen concurrently with
  15.101 @@ -682,7 +682,7 @@
  15.102    // a specific order.
  15.103  
  15.104    // The word size sum of all the regions we will allocate.
  15.105 -  size_t word_size_sum = num_regions * HeapRegion::GrainWords;
  15.106 +  size_t word_size_sum = (size_t) num_regions * HeapRegion::GrainWords;
  15.107    assert(word_size <= word_size_sum, "sanity");
  15.108  
  15.109    // This will be the "starts humongous" region.
  15.110 @@ -721,7 +721,7 @@
  15.111    // Then, if there are any, we will set up the "continues
  15.112    // humongous" regions.
  15.113    HeapRegion* hr = NULL;
  15.114 -  for (size_t i = first + 1; i < last; ++i) {
  15.115 +  for (uint i = first + 1; i < last; ++i) {
  15.116      hr = region_at(i);
  15.117      hr->set_continuesHumongous(first_hr);
  15.118    }
  15.119 @@ -767,7 +767,7 @@
  15.120    // last one) is actually used when we will free up the humongous
  15.121    // region in free_humongous_region().
  15.122    hr = NULL;
  15.123 -  for (size_t i = first + 1; i < last; ++i) {
  15.124 +  for (uint i = first + 1; i < last; ++i) {
  15.125      hr = region_at(i);
  15.126      if ((i + 1) == last) {
  15.127        // last continues humongous region
  15.128 @@ -803,14 +803,14 @@
  15.129  
  15.130    verify_region_sets_optional();
  15.131  
  15.132 -  size_t num_regions =
  15.133 -         round_to(word_size, HeapRegion::GrainWords) / HeapRegion::GrainWords;
  15.134 -  size_t x_size = expansion_regions();
  15.135 -  size_t fs = _hrs.free_suffix();
  15.136 -  size_t first = humongous_obj_allocate_find_first(num_regions, word_size);
  15.137 +  size_t word_size_rounded = round_to(word_size, HeapRegion::GrainWords);
  15.138 +  uint num_regions = (uint) (word_size_rounded / HeapRegion::GrainWords);
  15.139 +  uint x_num = expansion_regions();
  15.140 +  uint fs = _hrs.free_suffix();
  15.141 +  uint first = humongous_obj_allocate_find_first(num_regions, word_size);
  15.142    if (first == G1_NULL_HRS_INDEX) {
  15.143      // The only thing we can do now is attempt expansion.
  15.144 -    if (fs + x_size >= num_regions) {
  15.145 +    if (fs + x_num >= num_regions) {
  15.146        // If the number of regions we're trying to allocate for this
  15.147        // object is at most the number of regions in the free suffix,
  15.148        // then the call to humongous_obj_allocate_find_first() above
  15.149 @@ -1255,10 +1255,10 @@
  15.150      // Timing
  15.151      bool system_gc = (gc_cause() == GCCause::_java_lang_system_gc);
  15.152      assert(!system_gc || explicit_gc, "invariant");
  15.153 -    gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
  15.154 -    TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
  15.155 +    gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
  15.156 +    TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
  15.157      TraceTime t(system_gc ? "Full GC (System.gc())" : "Full GC",
  15.158 -                PrintGC, true, gclog_or_tty);
  15.159 +                G1Log::fine(), true, gclog_or_tty);
  15.160  
  15.161      TraceCollectorStats tcs(g1mm()->full_collection_counters());
  15.162      TraceMemoryManagerStats tms(true /* fullGC */, gc_cause());
  15.163 @@ -1290,8 +1290,7 @@
  15.164        HandleMark hm;  // Discard invalid handles created during verification
  15.165        gclog_or_tty->print(" VerifyBeforeGC:");
  15.166        prepare_for_verify();
  15.167 -      Universe::verify(/* allow dirty */ true,
  15.168 -                       /* silent      */ false,
  15.169 +      Universe::verify(/* silent      */ false,
  15.170                         /* option      */ VerifyOption_G1UsePrevMarking);
  15.171  
  15.172      }
  15.173 @@ -1365,8 +1364,7 @@
  15.174        HandleMark hm;  // Discard invalid handles created during verification
  15.175        gclog_or_tty->print(" VerifyAfterGC:");
  15.176        prepare_for_verify();
  15.177 -      Universe::verify(/* allow dirty */ false,
  15.178 -                       /* silent      */ false,
  15.179 +      Universe::verify(/* silent      */ false,
  15.180                         /* option      */ VerifyOption_G1UsePrevMarking);
  15.181  
  15.182      }
  15.183 @@ -1444,7 +1442,7 @@
  15.184        heap_region_iterate(&rebuild_rs);
  15.185      }
  15.186  
  15.187 -    if (PrintGC) {
  15.188 +    if (G1Log::fine()) {
  15.189        print_size_transition(gclog_or_tty, g1h_prev_used, used(), capacity());
  15.190      }
  15.191  
  15.192 @@ -1782,7 +1780,7 @@
  15.193      ReservedSpace::page_align_size_down(shrink_bytes);
  15.194    aligned_shrink_bytes = align_size_down(aligned_shrink_bytes,
  15.195                                           HeapRegion::GrainBytes);
  15.196 -  size_t num_regions_deleted = 0;
  15.197 +  uint num_regions_deleted = 0;
  15.198    MemRegion mr = _hrs.shrink_by(aligned_shrink_bytes, &num_regions_deleted);
  15.199    HeapWord* old_end = (HeapWord*) _g1_storage.high();
  15.200    assert(mr.end() == old_end, "post-condition");
  15.201 @@ -1917,6 +1915,8 @@
  15.202    CollectedHeap::pre_initialize();
  15.203    os::enable_vtime();
  15.204  
  15.205 +  G1Log::init();
  15.206 +
  15.207    // Necessary to satisfy locking discipline assertions.
  15.208  
  15.209    MutexLocker x(Heap_lock);
  15.210 @@ -2003,7 +2003,7 @@
  15.211    _reserved.set_start((HeapWord*)heap_rs.base());
  15.212    _reserved.set_end((HeapWord*)(heap_rs.base() + heap_rs.size()));
  15.213  
  15.214 -  _expansion_regions = max_byte_size/HeapRegion::GrainBytes;
  15.215 +  _expansion_regions = (uint) (max_byte_size / HeapRegion::GrainBytes);
  15.216  
  15.217    // Create the gen rem set (and barrier set) for the entire reserved region.
  15.218    _rem_set = collector_policy()->create_rem_set(_reserved, 2);
  15.219 @@ -2040,7 +2040,7 @@
  15.220  
  15.221    // 6843694 - ensure that the maximum region index can fit
  15.222    // in the remembered set structures.
  15.223 -  const size_t max_region_idx = ((size_t)1 << (sizeof(RegionIdx_t)*BitsPerByte-1)) - 1;
  15.224 +  const uint max_region_idx = (1U << (sizeof(RegionIdx_t)*BitsPerByte-1)) - 1;
  15.225    guarantee((max_regions() - 1) <= max_region_idx, "too many regions");
  15.226  
  15.227    size_t max_cards_per_region = ((size_t)1 << (sizeof(CardIdx_t)*BitsPerByte-1)) - 1;
  15.228 @@ -2056,13 +2056,14 @@
  15.229    _g1h = this;
  15.230  
  15.231     _in_cset_fast_test_length = max_regions();
  15.232 -   _in_cset_fast_test_base = NEW_C_HEAP_ARRAY(bool, _in_cset_fast_test_length);
  15.233 +   _in_cset_fast_test_base =
  15.234 +                   NEW_C_HEAP_ARRAY(bool, (size_t) _in_cset_fast_test_length);
  15.235  
  15.236     // We're biasing _in_cset_fast_test to avoid subtracting the
  15.237     // beginning of the heap every time we want to index; basically
  15.238     // it's the same with what we do with the card table.
  15.239     _in_cset_fast_test = _in_cset_fast_test_base -
  15.240 -                ((size_t) _g1_reserved.start() >> HeapRegion::LogOfHRGrainBytes);
  15.241 +               ((uintx) _g1_reserved.start() >> HeapRegion::LogOfHRGrainBytes);
  15.242  
  15.243     // Clear the _cset_fast_test bitmap in anticipation of adding
  15.244     // regions to the incremental collection set for the first
  15.245 @@ -2071,7 +2072,7 @@
  15.246  
  15.247    // Create the ConcurrentMark data structure and thread.
  15.248    // (Must do this late, so that "max_regions" is defined.)
  15.249 -  _cm       = new ConcurrentMark(heap_rs, (int) max_regions());
  15.250 +  _cm       = new ConcurrentMark(heap_rs, max_regions());
  15.251    _cmThread = _cm->cmThread();
  15.252  
  15.253    // Initialize the from_card cache structure of HeapRegionRemSet.
  15.254 @@ -2580,7 +2581,7 @@
  15.255                                                   uint worker,
  15.256                                                   uint no_of_par_workers,
  15.257                                                   jint claim_value) {
  15.258 -  const size_t regions = n_regions();
  15.259 +  const uint regions = n_regions();
  15.260    const uint max_workers = (G1CollectedHeap::use_parallel_gc_threads() ?
  15.261                               no_of_par_workers :
  15.262                               1);
  15.263 @@ -2588,11 +2589,11 @@
  15.264           no_of_par_workers == workers()->total_workers(),
  15.265           "Non dynamic should use fixed number of workers");
  15.266    // try to spread out the starting points of the workers
  15.267 -  const size_t start_index = regions / max_workers * (size_t) worker;
  15.268 +  const uint start_index = regions / max_workers * worker;
  15.269  
  15.270    // each worker will actually look at all regions
  15.271 -  for (size_t count = 0; count < regions; ++count) {
  15.272 -    const size_t index = (start_index + count) % regions;
  15.273 +  for (uint count = 0; count < regions; ++count) {
  15.274 +    const uint index = (start_index + count) % regions;
  15.275      assert(0 <= index && index < regions, "sanity");
  15.276      HeapRegion* r = region_at(index);
  15.277      // we'll ignore "continues humongous" regions (we'll process them
  15.278 @@ -2614,7 +2615,7 @@
  15.279          // result, we might end up processing them twice. So, we'll do
  15.280          // them first (notice: most closures will ignore them anyway) and
  15.281          // then we'll do the "starts humongous" region.
  15.282 -        for (size_t ch_index = index + 1; ch_index < regions; ++ch_index) {
  15.283 +        for (uint ch_index = index + 1; ch_index < regions; ++ch_index) {
  15.284            HeapRegion* chr = region_at(ch_index);
  15.285  
  15.286            // if the region has already been claimed or it's not
  15.287 @@ -2682,8 +2683,9 @@
  15.288  class CheckClaimValuesClosure : public HeapRegionClosure {
  15.289  private:
  15.290    jint _claim_value;
  15.291 -  size_t _failures;
  15.292 +  uint _failures;
  15.293    HeapRegion* _sh_region;
  15.294 +
  15.295  public:
  15.296    CheckClaimValuesClosure(jint claim_value) :
  15.297      _claim_value(claim_value), _failures(0), _sh_region(NULL) { }
  15.298 @@ -2711,9 +2713,7 @@
  15.299      }
  15.300      return false;
  15.301    }
  15.302 -  size_t failures() {
  15.303 -    return _failures;
  15.304 -  }
  15.305 +  uint failures() { return _failures; }
  15.306  };
  15.307  
  15.308  bool G1CollectedHeap::check_heap_region_claim_values(jint claim_value) {
  15.309 @@ -2723,17 +2723,15 @@
  15.310  }
  15.311  
  15.312  class CheckClaimValuesInCSetHRClosure: public HeapRegionClosure {
  15.313 -  jint   _claim_value;
  15.314 -  size_t _failures;
  15.315 +private:
  15.316 +  jint _claim_value;
  15.317 +  uint _failures;
  15.318  
  15.319  public:
  15.320    CheckClaimValuesInCSetHRClosure(jint claim_value) :
  15.321 -    _claim_value(claim_value),
  15.322 -    _failures(0) { }
  15.323 -
  15.324 -  size_t failures() {
  15.325 -    return _failures;
  15.326 -  }
  15.327 +    _claim_value(claim_value), _failures(0) { }
  15.328 +
  15.329 +  uint failures() { return _failures; }
  15.330  
  15.331    bool doHeapRegion(HeapRegion* hr) {
  15.332      assert(hr->in_collection_set(), "how?");
  15.333 @@ -2800,14 +2798,14 @@
  15.334  
  15.335    result = g1_policy()->collection_set();
  15.336    if (G1CollectedHeap::use_parallel_gc_threads()) {
  15.337 -    size_t cs_size = g1_policy()->cset_region_length();
  15.338 +    uint cs_size = g1_policy()->cset_region_length();
  15.339      uint active_workers = workers()->active_workers();
  15.340      assert(UseDynamicNumberOfGCThreads ||
  15.341               active_workers == workers()->total_workers(),
  15.342               "Unless dynamic should use total workers");
  15.343  
  15.344 -    size_t end_ind   = (cs_size * worker_i) / active_workers;
  15.345 -    size_t start_ind = 0;
  15.346 +    uint end_ind   = (cs_size * worker_i) / active_workers;
  15.347 +    uint start_ind = 0;
  15.348  
  15.349      if (worker_i > 0 &&
  15.350          _worker_cset_start_region_time_stamp[worker_i - 1] == gc_time_stamp) {
  15.351 @@ -2817,7 +2815,7 @@
  15.352        result = _worker_cset_start_region[worker_i - 1];
  15.353      }
  15.354  
  15.355 -    for (size_t i = start_ind; i < end_ind; i++) {
  15.356 +    for (uint i = start_ind; i < end_ind; i++) {
  15.357        result = result->next_in_collection_set();
  15.358      }
  15.359    }
  15.360 @@ -3033,7 +3031,6 @@
  15.361  
  15.362  class VerifyRegionClosure: public HeapRegionClosure {
  15.363  private:
  15.364 -  bool         _allow_dirty;
  15.365    bool         _par;
  15.366    VerifyOption _vo;
  15.367    bool         _failures;
  15.368 @@ -3041,9 +3038,8 @@
  15.369    // _vo == UsePrevMarking -> use "prev" marking information,
  15.370    // _vo == UseNextMarking -> use "next" marking information,
  15.371    // _vo == UseMarkWord    -> use mark word from object header.
  15.372 -  VerifyRegionClosure(bool allow_dirty, bool par, VerifyOption vo)
  15.373 -    : _allow_dirty(allow_dirty),
  15.374 -      _par(par),
  15.375 +  VerifyRegionClosure(bool par, VerifyOption vo)
  15.376 +    : _par(par),
  15.377        _vo(vo),
  15.378        _failures(false) {}
  15.379  
  15.380 @@ -3056,7 +3052,7 @@
  15.381                "Should be unclaimed at verify points.");
  15.382      if (!r->continuesHumongous()) {
  15.383        bool failures = false;
  15.384 -      r->verify(_allow_dirty, _vo, &failures);
  15.385 +      r->verify(_vo, &failures);
  15.386        if (failures) {
  15.387          _failures = true;
  15.388        } else {
  15.389 @@ -3124,7 +3120,6 @@
  15.390  class G1ParVerifyTask: public AbstractGangTask {
  15.391  private:
  15.392    G1CollectedHeap* _g1h;
  15.393 -  bool             _allow_dirty;
  15.394    VerifyOption     _vo;
  15.395    bool             _failures;
  15.396  
  15.397 @@ -3132,10 +3127,9 @@
  15.398    // _vo == UsePrevMarking -> use "prev" marking information,
  15.399    // _vo == UseNextMarking -> use "next" marking information,
  15.400    // _vo == UseMarkWord    -> use mark word from object header.
  15.401 -  G1ParVerifyTask(G1CollectedHeap* g1h, bool allow_dirty, VerifyOption vo) :
  15.402 +  G1ParVerifyTask(G1CollectedHeap* g1h, VerifyOption vo) :
  15.403      AbstractGangTask("Parallel verify task"),
  15.404      _g1h(g1h),
  15.405 -    _allow_dirty(allow_dirty),
  15.406      _vo(vo),
  15.407      _failures(false) { }
  15.408  
  15.409 @@ -3145,7 +3139,7 @@
  15.410  
  15.411    void work(uint worker_id) {
  15.412      HandleMark hm;
  15.413 -    VerifyRegionClosure blk(_allow_dirty, true, _vo);
  15.414 +    VerifyRegionClosure blk(true, _vo);
  15.415      _g1h->heap_region_par_iterate_chunked(&blk, worker_id,
  15.416                                            _g1h->workers()->active_workers(),
  15.417                                            HeapRegion::ParVerifyClaimValue);
  15.418 @@ -3155,12 +3149,11 @@
  15.419    }
  15.420  };
  15.421  
  15.422 -void G1CollectedHeap::verify(bool allow_dirty, bool silent) {
  15.423 -  verify(allow_dirty, silent, VerifyOption_G1UsePrevMarking);
  15.424 -}
  15.425 -
  15.426 -void G1CollectedHeap::verify(bool allow_dirty,
  15.427 -                             bool silent,
  15.428 +void G1CollectedHeap::verify(bool silent) {
  15.429 +  verify(silent, VerifyOption_G1UsePrevMarking);
  15.430 +}
  15.431 +
  15.432 +void G1CollectedHeap::verify(bool silent,
  15.433                               VerifyOption vo) {
  15.434    if (SafepointSynchronize::is_at_safepoint() || ! UseTLAB) {
  15.435      if (!silent) { gclog_or_tty->print("Roots (excluding permgen) "); }
  15.436 @@ -3212,7 +3205,7 @@
  15.437        assert(check_heap_region_claim_values(HeapRegion::InitialClaimValue),
  15.438               "sanity check");
  15.439  
  15.440 -      G1ParVerifyTask task(this, allow_dirty, vo);
  15.441 +      G1ParVerifyTask task(this, vo);
  15.442        assert(UseDynamicNumberOfGCThreads ||
  15.443          workers()->active_workers() == workers()->total_workers(),
  15.444          "If not dynamic should be using all the workers");
  15.445 @@ -3234,7 +3227,7 @@
  15.446        assert(check_heap_region_claim_values(HeapRegion::InitialClaimValue),
  15.447               "sanity check");
  15.448      } else {
  15.449 -      VerifyRegionClosure blk(allow_dirty, false, vo);
  15.450 +      VerifyRegionClosure blk(false, vo);
  15.451        heap_region_iterate(&blk);
  15.452        if (blk.failures()) {
  15.453          failures = true;
  15.454 @@ -3284,12 +3277,12 @@
  15.455              _g1_storage.high_boundary());
  15.456    st->cr();
  15.457    st->print("  region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K);
  15.458 -  size_t young_regions = _young_list->length();
  15.459 -  st->print(SIZE_FORMAT " young (" SIZE_FORMAT "K), ",
  15.460 -            young_regions, young_regions * HeapRegion::GrainBytes / K);
  15.461 -  size_t survivor_regions = g1_policy()->recorded_survivor_regions();
  15.462 -  st->print(SIZE_FORMAT " survivors (" SIZE_FORMAT "K)",
  15.463 -            survivor_regions, survivor_regions * HeapRegion::GrainBytes / K);
  15.464 +  uint young_regions = _young_list->length();
  15.465 +  st->print("%u young (" SIZE_FORMAT "K), ", young_regions,
  15.466 +            (size_t) young_regions * HeapRegion::GrainBytes / K);
  15.467 +  uint survivor_regions = g1_policy()->recorded_survivor_regions();
  15.468 +  st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions,
  15.469 +            (size_t) survivor_regions * HeapRegion::GrainBytes / K);
  15.470    st->cr();
  15.471    perm()->as_gen()->print_on(st);
  15.472  }
  15.473 @@ -3299,7 +3292,11 @@
  15.474  
  15.475    // Print the per-region information.
  15.476    st->cr();
  15.477 -  st->print_cr("Heap Regions: (Y=young(eden), SU=young(survivor), HS=humongous(starts), HC=humongous(continues), CS=collection set, F=free, TS=gc time stamp, PTAMS=previous top-at-mark-start, NTAMS=next top-at-mark-start)");
  15.478 +  st->print_cr("Heap Regions: (Y=young(eden), SU=young(survivor), "
  15.479 +               "HS=humongous(starts), HC=humongous(continues), "
  15.480 +               "CS=collection set, F=free, TS=gc time stamp, "
  15.481 +               "PTAMS=previous top-at-mark-start, "
  15.482 +               "NTAMS=next top-at-mark-start)");
  15.483    PrintRegionClosure blk(st);
  15.484    heap_region_iterate(&blk);
  15.485  }
  15.486 @@ -3477,16 +3474,16 @@
  15.487  
  15.488  void
  15.489  G1CollectedHeap::setup_surviving_young_words() {
  15.490 -  guarantee( _surviving_young_words == NULL, "pre-condition" );
  15.491 -  size_t array_length = g1_policy()->young_cset_region_length();
  15.492 -  _surviving_young_words = NEW_C_HEAP_ARRAY(size_t, array_length);
  15.493 +  assert(_surviving_young_words == NULL, "pre-condition");
  15.494 +  uint array_length = g1_policy()->young_cset_region_length();
  15.495 +  _surviving_young_words = NEW_C_HEAP_ARRAY(size_t, (size_t) array_length);
  15.496    if (_surviving_young_words == NULL) {
  15.497      vm_exit_out_of_memory(sizeof(size_t) * array_length,
  15.498                            "Not enough space for young surv words summary.");
  15.499    }
  15.500 -  memset(_surviving_young_words, 0, array_length * sizeof(size_t));
  15.501 +  memset(_surviving_young_words, 0, (size_t) array_length * sizeof(size_t));
  15.502  #ifdef ASSERT
  15.503 -  for (size_t i = 0;  i < array_length; ++i) {
  15.504 +  for (uint i = 0;  i < array_length; ++i) {
  15.505      assert( _surviving_young_words[i] == 0, "memset above" );
  15.506    }
  15.507  #endif // !ASSERT
  15.508 @@ -3495,9 +3492,10 @@
  15.509  void
  15.510  G1CollectedHeap::update_surviving_young_words(size_t* surv_young_words) {
  15.511    MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
  15.512 -  size_t array_length = g1_policy()->young_cset_region_length();
  15.513 -  for (size_t i = 0; i < array_length; ++i)
  15.514 +  uint array_length = g1_policy()->young_cset_region_length();
  15.515 +  for (uint i = 0; i < array_length; ++i) {
  15.516      _surviving_young_words[i] += surv_young_words[i];
  15.517 +  }
  15.518  }
  15.519  
  15.520  void
  15.521 @@ -3609,12 +3607,12 @@
  15.522        increment_total_full_collections();
  15.523      }
  15.524  
  15.525 -    // if PrintGCDetails is on, we'll print long statistics information
  15.526 +    // if the log level is "finer" is on, we'll print long statistics information
  15.527      // in the collector policy code, so let's not print this as the output
  15.528      // is messy if we do.
  15.529 -    gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
  15.530 -    TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
  15.531 -    TraceTime t(verbose_str, PrintGC && !PrintGCDetails, true, gclog_or_tty);
  15.532 +    gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
  15.533 +    TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
  15.534 +    TraceTime t(verbose_str, G1Log::fine() && !G1Log::finer(), true, gclog_or_tty);
  15.535  
  15.536      TraceCollectorStats tcs(g1mm()->incremental_collection_counters());
  15.537      TraceMemoryManagerStats tms(false /* fullGC */, gc_cause());
  15.538 @@ -3647,8 +3645,7 @@
  15.539          HandleMark hm;  // Discard invalid handles created during verification
  15.540          gclog_or_tty->print(" VerifyBeforeGC:");
  15.541          prepare_for_verify();
  15.542 -        Universe::verify(/* allow dirty */ false,
  15.543 -                         /* silent      */ false,
  15.544 +        Universe::verify(/* silent      */ false,
  15.545                           /* option      */ VerifyOption_G1UsePrevMarking);
  15.546        }
  15.547  
  15.548 @@ -3892,8 +3889,7 @@
  15.549            HandleMark hm;  // Discard invalid handles created during verification
  15.550            gclog_or_tty->print(" VerifyAfterGC:");
  15.551            prepare_for_verify();
  15.552 -          Universe::verify(/* allow dirty */ true,
  15.553 -                           /* silent      */ false,
  15.554 +          Universe::verify(/* silent      */ false,
  15.555                             /* option      */ VerifyOption_G1UsePrevMarking);
  15.556          }
  15.557  
  15.558 @@ -3931,8 +3927,8 @@
  15.559    }
  15.560  
  15.561    // The closing of the inner scope, immediately above, will complete
  15.562 -  // the PrintGC logging output. The record_collection_pause_end() call
  15.563 -  // above will complete the logging output of PrintGCDetails.
  15.564 +  // logging at the "fine" level. The record_collection_pause_end() call
  15.565 +  // above will complete logging at the "finer" level.
  15.566    //
  15.567    // It is not yet to safe, however, to tell the concurrent mark to
  15.568    // start as we have some optional output below. We don't want the
  15.569 @@ -4068,7 +4064,6 @@
  15.570  
  15.571  void G1CollectedHeap::remove_self_forwarding_pointers() {
  15.572    assert(check_cset_heap_region_claim_values(HeapRegion::InitialClaimValue), "sanity");
  15.573 -  assert(g1_policy()->assertMarkedBytesDataOK(), "Should be!");
  15.574  
  15.575    G1ParRemoveSelfForwardPtrsTask rsfp_task(this);
  15.576  
  15.577 @@ -4086,7 +4081,6 @@
  15.578    reset_cset_heap_region_claim_values();
  15.579  
  15.580    assert(check_cset_heap_region_claim_values(HeapRegion::InitialClaimValue), "sanity");
  15.581 -  assert(g1_policy()->assertMarkedBytesDataOK(), "Should be!");
  15.582  
  15.583    // Now restore saved marks, if any.
  15.584    if (_objs_with_preserved_marks != NULL) {
  15.585 @@ -4248,16 +4242,16 @@
  15.586    // non-young regions (where the age is -1)
  15.587    // We also add a few elements at the beginning and at the end in
  15.588    // an attempt to eliminate cache contention
  15.589 -  size_t real_length = 1 + _g1h->g1_policy()->young_cset_region_length();
  15.590 -  size_t array_length = PADDING_ELEM_NUM +
  15.591 -                        real_length +
  15.592 -                        PADDING_ELEM_NUM;
  15.593 +  uint real_length = 1 + _g1h->g1_policy()->young_cset_region_length();
  15.594 +  uint array_length = PADDING_ELEM_NUM +
  15.595 +                      real_length +
  15.596 +                      PADDING_ELEM_NUM;
  15.597    _surviving_young_words_base = NEW_C_HEAP_ARRAY(size_t, array_length);
  15.598    if (_surviving_young_words_base == NULL)
  15.599      vm_exit_out_of_memory(array_length * sizeof(size_t),
  15.600                            "Not enough space for young surv histo.");
  15.601    _surviving_young_words = _surviving_young_words_base + PADDING_ELEM_NUM;
  15.602 -  memset(_surviving_young_words, 0, real_length * sizeof(size_t));
  15.603 +  memset(_surviving_young_words, 0, (size_t) real_length * sizeof(size_t));
  15.604  
  15.605    _alloc_buffers[GCAllocForSurvived] = &_surviving_alloc_buffer;
  15.606    _alloc_buffers[GCAllocForTenured]  = &_tenured_alloc_buffer;
  15.607 @@ -4394,7 +4388,7 @@
  15.608  template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object>
  15.609  oop G1ParCopyClosure<do_gen_barrier, barrier, do_mark_object>
  15.610    ::copy_to_survivor_space(oop old) {
  15.611 -  size_t    word_sz = old->size();
  15.612 +  size_t word_sz = old->size();
  15.613    HeapRegion* from_region = _g1->heap_region_containing_raw(old);
  15.614    // +1 to make the -1 indexes valid...
  15.615    int       young_index = from_region->young_index_in_cset()+1;
  15.616 @@ -5514,9 +5508,9 @@
  15.617  
  15.618    if (evacuation_failed()) {
  15.619      remove_self_forwarding_pointers();
  15.620 -    if (PrintGCDetails) {
  15.621 +    if (G1Log::finer()) {
  15.622        gclog_or_tty->print(" (to-space overflow)");
  15.623 -    } else if (PrintGC) {
  15.624 +    } else if (G1Log::fine()) {
  15.625        gclog_or_tty->print("--");
  15.626      }
  15.627    }
  15.628 @@ -5591,8 +5585,8 @@
  15.629    hr->set_notHumongous();
  15.630    free_region(hr, &hr_pre_used, free_list, par);
  15.631  
  15.632 -  size_t i = hr->hrs_index() + 1;
  15.633 -  size_t num = 1;
  15.634 +  uint i = hr->hrs_index() + 1;
  15.635 +  uint num = 1;
  15.636    while (i < n_regions()) {
  15.637      HeapRegion* curr_hr = region_at(i);
  15.638      if (!curr_hr->continuesHumongous()) {
  15.639 @@ -5801,7 +5795,7 @@
  15.640      if (cur->is_young()) {
  15.641        int index = cur->young_index_in_cset();
  15.642        assert(index != -1, "invariant");
  15.643 -      assert((size_t) index < policy->young_cset_region_length(), "invariant");
  15.644 +      assert((uint) index < policy->young_cset_region_length(), "invariant");
  15.645        size_t words_survived = _surviving_young_words[index];
  15.646        cur->record_surv_words_in_group(words_survived);
  15.647  
  15.648 @@ -6141,7 +6135,7 @@
  15.649  // Methods for the GC alloc regions
  15.650  
  15.651  HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size,
  15.652 -                                                 size_t count,
  15.653 +                                                 uint count,
  15.654                                                   GCAllocPurpose ap) {
  15.655    assert(FreeList_lock->owned_by_self(), "pre-condition");
  15.656  
  15.657 @@ -6213,7 +6207,7 @@
  15.658    FreeRegionList*     _free_list;
  15.659    OldRegionSet*       _old_set;
  15.660    HumongousRegionSet* _humongous_set;
  15.661 -  size_t              _region_count;
  15.662 +  uint                _region_count;
  15.663  
  15.664  public:
  15.665    VerifyRegionListsClosure(OldRegionSet* old_set,
  15.666 @@ -6222,7 +6216,7 @@
  15.667      _old_set(old_set), _humongous_set(humongous_set),
  15.668      _free_list(free_list), _region_count(0) { }
  15.669  
  15.670 -  size_t region_count()      { return _region_count;      }
  15.671 +  uint region_count() { return _region_count; }
  15.672  
  15.673    bool doHeapRegion(HeapRegion* hr) {
  15.674      _region_count += 1;
  15.675 @@ -6244,7 +6238,7 @@
  15.676    }
  15.677  };
  15.678  
  15.679 -HeapRegion* G1CollectedHeap::new_heap_region(size_t hrs_index,
  15.680 +HeapRegion* G1CollectedHeap::new_heap_region(uint hrs_index,
  15.681                                               HeapWord* bottom) {
  15.682    HeapWord* end = bottom + HeapRegion::GrainWords;
  15.683    MemRegion mr(bottom, end);
    16.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Tue Mar 06 12:36:59 2012 +0100
    16.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Apr 20 11:41:49 2012 -0700
    16.3 @@ -85,8 +85,8 @@
    16.4  
    16.5    HeapRegion* _curr;
    16.6  
    16.7 -  size_t      _length;
    16.8 -  size_t      _survivor_length;
    16.9 +  uint        _length;
   16.10 +  uint        _survivor_length;
   16.11  
   16.12    size_t      _last_sampled_rs_lengths;
   16.13    size_t      _sampled_rs_lengths;
   16.14 @@ -101,8 +101,8 @@
   16.15  
   16.16    void         empty_list();
   16.17    bool         is_empty() { return _length == 0; }
   16.18 -  size_t       length() { return _length; }
   16.19 -  size_t       survivor_length() { return _survivor_length; }
   16.20 +  uint         length() { return _length; }
   16.21 +  uint         survivor_length() { return _survivor_length; }
   16.22  
   16.23    // Currently we do not keep track of the used byte sum for the
   16.24    // young list and the survivors and it'd be quite a lot of work to
   16.25 @@ -111,10 +111,10 @@
   16.26    // we'll report the more accurate information then.
   16.27    size_t       eden_used_bytes() {
   16.28      assert(length() >= survivor_length(), "invariant");
   16.29 -    return (length() - survivor_length()) * HeapRegion::GrainBytes;
   16.30 +    return (size_t) (length() - survivor_length()) * HeapRegion::GrainBytes;
   16.31    }
   16.32    size_t       survivor_used_bytes() {
   16.33 -    return survivor_length() * HeapRegion::GrainBytes;
   16.34 +    return (size_t) survivor_length() * HeapRegion::GrainBytes;
   16.35    }
   16.36  
   16.37    void rs_length_sampling_init();
   16.38 @@ -247,7 +247,7 @@
   16.39    MasterHumongousRegionSet  _humongous_set;
   16.40  
   16.41    // The number of regions we could create by expansion.
   16.42 -  size_t _expansion_regions;
   16.43 +  uint _expansion_regions;
   16.44  
   16.45    // The block offset table for the G1 heap.
   16.46    G1BlockOffsetSharedArray* _bot_shared;
   16.47 @@ -339,7 +339,7 @@
   16.48    bool* _in_cset_fast_test_base;
   16.49  
   16.50    // The length of the _in_cset_fast_test_base array.
   16.51 -  size_t _in_cset_fast_test_length;
   16.52 +  uint _in_cset_fast_test_length;
   16.53  
   16.54    volatile unsigned _gc_time_stamp;
   16.55  
   16.56 @@ -458,14 +458,14 @@
   16.57    // length and remove them from the master free list. Return the
   16.58    // index of the first region or G1_NULL_HRS_INDEX if the search
   16.59    // was unsuccessful.
   16.60 -  size_t humongous_obj_allocate_find_first(size_t num_regions,
   16.61 -                                           size_t word_size);
   16.62 +  uint humongous_obj_allocate_find_first(uint num_regions,
   16.63 +                                         size_t word_size);
   16.64  
   16.65    // Initialize a contiguous set of free regions of length num_regions
   16.66    // and starting at index first so that they appear as a single
   16.67    // humongous region.
   16.68 -  HeapWord* humongous_obj_allocate_initialize_regions(size_t first,
   16.69 -                                                      size_t num_regions,
   16.70 +  HeapWord* humongous_obj_allocate_initialize_regions(uint first,
   16.71 +                                                      uint num_regions,
   16.72                                                        size_t word_size);
   16.73  
   16.74    // Attempt to allocate a humongous object of the given size. Return
   16.75 @@ -574,7 +574,7 @@
   16.76                                     size_t allocated_bytes);
   16.77  
   16.78    // For GC alloc regions.
   16.79 -  HeapRegion* new_gc_alloc_region(size_t word_size, size_t count,
   16.80 +  HeapRegion* new_gc_alloc_region(size_t word_size, uint count,
   16.81                                    GCAllocPurpose ap);
   16.82    void retire_gc_alloc_region(HeapRegion* alloc_region,
   16.83                                size_t allocated_bytes, GCAllocPurpose ap);
   16.84 @@ -641,7 +641,7 @@
   16.85    void register_region_with_in_cset_fast_test(HeapRegion* r) {
   16.86      assert(_in_cset_fast_test_base != NULL, "sanity");
   16.87      assert(r->in_collection_set(), "invariant");
   16.88 -    size_t index = r->hrs_index();
   16.89 +    uint index = r->hrs_index();
   16.90      assert(index < _in_cset_fast_test_length, "invariant");
   16.91      assert(!_in_cset_fast_test_base[index], "invariant");
   16.92      _in_cset_fast_test_base[index] = true;
   16.93 @@ -655,7 +655,7 @@
   16.94      if (_g1_committed.contains((HeapWord*) obj)) {
   16.95        // no need to subtract the bottom of the heap from obj,
   16.96        // _in_cset_fast_test is biased
   16.97 -      size_t index = ((size_t) obj) >> HeapRegion::LogOfHRGrainBytes;
   16.98 +      uintx index = (uintx) obj >> HeapRegion::LogOfHRGrainBytes;
   16.99        bool ret = _in_cset_fast_test[index];
  16.100        // let's make sure the result is consistent with what the slower
  16.101        // test returns
  16.102 @@ -670,7 +670,7 @@
  16.103    void clear_cset_fast_test() {
  16.104      assert(_in_cset_fast_test_base != NULL, "sanity");
  16.105      memset(_in_cset_fast_test_base, false,
  16.106 -        _in_cset_fast_test_length * sizeof(bool));
  16.107 +           (size_t) _in_cset_fast_test_length * sizeof(bool));
  16.108    }
  16.109  
  16.110    // This is called at the end of either a concurrent cycle or a Full
  16.111 @@ -1101,23 +1101,23 @@
  16.112    }
  16.113  
  16.114    // The total number of regions in the heap.
  16.115 -  size_t n_regions() { return _hrs.length(); }
  16.116 +  uint n_regions() { return _hrs.length(); }
  16.117  
  16.118    // The max number of regions in the heap.
  16.119 -  size_t max_regions() { return _hrs.max_length(); }
  16.120 +  uint max_regions() { return _hrs.max_length(); }
  16.121  
  16.122    // The number of regions that are completely free.
  16.123 -  size_t free_regions() { return _free_list.length(); }
  16.124 +  uint free_regions() { return _free_list.length(); }
  16.125  
  16.126    // The number of regions that are not completely free.
  16.127 -  size_t used_regions() { return n_regions() - free_regions(); }
  16.128 +  uint used_regions() { return n_regions() - free_regions(); }
  16.129  
  16.130    // The number of regions available for "regular" expansion.
  16.131 -  size_t expansion_regions() { return _expansion_regions; }
  16.132 +  uint expansion_regions() { return _expansion_regions; }
  16.133  
  16.134    // Factory method for HeapRegion instances. It will return NULL if
  16.135    // the allocation fails.
  16.136 -  HeapRegion* new_heap_region(size_t hrs_index, HeapWord* bottom);
  16.137 +  HeapRegion* new_heap_region(uint hrs_index, HeapWord* bottom);
  16.138  
  16.139    void verify_not_dirty_region(HeapRegion* hr) PRODUCT_RETURN;
  16.140    void verify_dirty_region(HeapRegion* hr) PRODUCT_RETURN;
  16.141 @@ -1301,7 +1301,7 @@
  16.142    void heap_region_iterate_from(HeapRegion* r, HeapRegionClosure* blk) const;
  16.143  
  16.144    // Return the region with the given index. It assumes the index is valid.
  16.145 -  HeapRegion* region_at(size_t index) const { return _hrs.at(index); }
  16.146 +  HeapRegion* region_at(uint index) const { return _hrs.at(index); }
  16.147  
  16.148    // Divide the heap region sequence into "chunks" of some size (the number
  16.149    // of regions divided by the number of parallel threads times some
  16.150 @@ -1504,10 +1504,10 @@
  16.151    // Currently there is only one place where this is called with
  16.152    // vo == UseMarkWord, which is to verify the marking during a
  16.153    // full GC.
  16.154 -  void verify(bool allow_dirty, bool silent, VerifyOption vo);
  16.155 +  void verify(bool silent, VerifyOption vo);
  16.156  
  16.157    // Override; it uses the "prev" marking information
  16.158 -  virtual void verify(bool allow_dirty, bool silent);
  16.159 +  virtual void verify(bool silent);
  16.160    virtual void print_on(outputStream* st) const;
  16.161    virtual void print_extended_on(outputStream* st) const;
  16.162  
    17.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Tue Mar 06 12:36:59 2012 +0100
    17.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri Apr 20 11:41:49 2012 -0700
    17.3 @@ -29,6 +29,7 @@
    17.4  #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
    17.5  #include "gc_implementation/g1/g1CollectorPolicy.hpp"
    17.6  #include "gc_implementation/g1/g1ErgoVerbose.hpp"
    17.7 +#include "gc_implementation/g1/g1Log.hpp"
    17.8  #include "gc_implementation/g1/heapRegionRemSet.hpp"
    17.9  #include "gc_implementation/shared/gcPolicyCounters.hpp"
   17.10  #include "runtime/arguments.hpp"
   17.11 @@ -191,11 +192,6 @@
   17.12    _in_marking_window(false),
   17.13    _in_marking_window_im(false),
   17.14  
   17.15 -  _known_garbage_ratio(0.0),
   17.16 -  _known_garbage_bytes(0),
   17.17 -
   17.18 -  _young_gc_eff_seq(new TruncatedSeq(TruncatedSeqLength)),
   17.19 -
   17.20    _recent_prev_end_times_for_all_gcs_sec(
   17.21                                  new TruncatedSeq(NumPrevPausesForHeuristics)),
   17.22  
   17.23 @@ -430,31 +426,36 @@
   17.24    }
   17.25  
   17.26    if (FLAG_IS_CMDLINE(NewSize)) {
   17.27 -     _min_desired_young_length = MAX2((size_t) 1, NewSize / HeapRegion::GrainBytes);
   17.28 +    _min_desired_young_length = MAX2((uint) (NewSize / HeapRegion::GrainBytes),
   17.29 +                                     1U);
   17.30      if (FLAG_IS_CMDLINE(MaxNewSize)) {
   17.31 -      _max_desired_young_length = MAX2((size_t) 1, MaxNewSize / HeapRegion::GrainBytes);
   17.32 +      _max_desired_young_length =
   17.33 +                             MAX2((uint) (MaxNewSize / HeapRegion::GrainBytes),
   17.34 +                                  1U);
   17.35        _sizer_kind = SizerMaxAndNewSize;
   17.36        _adaptive_size = _min_desired_young_length == _max_desired_young_length;
   17.37      } else {
   17.38        _sizer_kind = SizerNewSizeOnly;
   17.39      }
   17.40    } else if (FLAG_IS_CMDLINE(MaxNewSize)) {
   17.41 -    _max_desired_young_length = MAX2((size_t) 1, MaxNewSize / HeapRegion::GrainBytes);
   17.42 +    _max_desired_young_length =
   17.43 +                             MAX2((uint) (MaxNewSize / HeapRegion::GrainBytes),
   17.44 +                                  1U);
   17.45      _sizer_kind = SizerMaxNewSizeOnly;
   17.46    }
   17.47  }
   17.48  
   17.49 -size_t G1YoungGenSizer::calculate_default_min_length(size_t new_number_of_heap_regions) {
   17.50 -  size_t default_value = (new_number_of_heap_regions * G1DefaultMinNewGenPercent) / 100;
   17.51 -  return MAX2((size_t)1, default_value);
   17.52 +uint G1YoungGenSizer::calculate_default_min_length(uint new_number_of_heap_regions) {
   17.53 +  uint default_value = (new_number_of_heap_regions * G1DefaultMinNewGenPercent) / 100;
   17.54 +  return MAX2(1U, default_value);
   17.55  }
   17.56  
   17.57 -size_t G1YoungGenSizer::calculate_default_max_length(size_t new_number_of_heap_regions) {
   17.58 -  size_t default_value = (new_number_of_heap_regions * G1DefaultMaxNewGenPercent) / 100;
   17.59 -  return MAX2((size_t)1, default_value);
   17.60 +uint G1YoungGenSizer::calculate_default_max_length(uint new_number_of_heap_regions) {
   17.61 +  uint default_value = (new_number_of_heap_regions * G1DefaultMaxNewGenPercent) / 100;
   17.62 +  return MAX2(1U, default_value);
   17.63  }
   17.64  
   17.65 -void G1YoungGenSizer::heap_size_changed(size_t new_number_of_heap_regions) {
   17.66 +void G1YoungGenSizer::heap_size_changed(uint new_number_of_heap_regions) {
   17.67    assert(new_number_of_heap_regions > 0, "Heap must be initialized");
   17.68  
   17.69    switch (_sizer_kind) {
   17.70 @@ -511,16 +512,16 @@
   17.71    _gc_policy_counters = new GCPolicyCounters("GarbageFirst", 1, 3);
   17.72  }
   17.73  
   17.74 -bool G1CollectorPolicy::predict_will_fit(size_t young_length,
   17.75 +bool G1CollectorPolicy::predict_will_fit(uint young_length,
   17.76                                           double base_time_ms,
   17.77 -                                         size_t base_free_regions,
   17.78 +                                         uint base_free_regions,
   17.79                                           double target_pause_time_ms) {
   17.80    if (young_length >= base_free_regions) {
   17.81      // end condition 1: not enough space for the young regions
   17.82      return false;
   17.83    }
   17.84  
   17.85 -  double accum_surv_rate = accum_yg_surv_rate_pred((int)(young_length - 1));
   17.86 +  double accum_surv_rate = accum_yg_surv_rate_pred((int) young_length - 1);
   17.87    size_t bytes_to_copy =
   17.88                 (size_t) (accum_surv_rate * (double) HeapRegion::GrainBytes);
   17.89    double copy_time_ms = predict_object_copy_time_ms(bytes_to_copy);
   17.90 @@ -532,7 +533,7 @@
   17.91    }
   17.92  
   17.93    size_t free_bytes =
   17.94 -                  (base_free_regions - young_length) * HeapRegion::GrainBytes;
   17.95 +                   (base_free_regions - young_length) * HeapRegion::GrainBytes;
   17.96    if ((2.0 * sigma()) * (double) bytes_to_copy > (double) free_bytes) {
   17.97      // end condition 3: out-of-space (conservatively!)
   17.98      return false;
   17.99 @@ -542,25 +543,25 @@
  17.100    return true;
  17.101  }
  17.102  
  17.103 -void G1CollectorPolicy::record_new_heap_size(size_t new_number_of_regions) {
  17.104 +void G1CollectorPolicy::record_new_heap_size(uint new_number_of_regions) {
  17.105    // re-calculate the necessary reserve
  17.106    double reserve_regions_d = (double) new_number_of_regions * _reserve_factor;
  17.107    // We use ceiling so that if reserve_regions_d is > 0.0 (but
  17.108    // smaller than 1.0) we'll get 1.
  17.109 -  _reserve_regions = (size_t) ceil(reserve_regions_d);
  17.110 +  _reserve_regions = (uint) ceil(reserve_regions_d);
  17.111  
  17.112    _young_gen_sizer->heap_size_changed(new_number_of_regions);
  17.113  }
  17.114  
  17.115 -size_t G1CollectorPolicy::calculate_young_list_desired_min_length(
  17.116 -                                                     size_t base_min_length) {
  17.117 -  size_t desired_min_length = 0;
  17.118 +uint G1CollectorPolicy::calculate_young_list_desired_min_length(
  17.119 +                                                       uint base_min_length) {
  17.120 +  uint desired_min_length = 0;
  17.121    if (adaptive_young_list_length()) {
  17.122      if (_alloc_rate_ms_seq->num() > 3) {
  17.123        double now_sec = os::elapsedTime();
  17.124        double when_ms = _mmu_tracker->when_max_gc_sec(now_sec) * 1000.0;
  17.125        double alloc_rate_ms = predict_alloc_rate_ms();
  17.126 -      desired_min_length = (size_t) ceil(alloc_rate_ms * when_ms);
  17.127 +      desired_min_length = (uint) ceil(alloc_rate_ms * when_ms);
  17.128      } else {
  17.129        // otherwise we don't have enough info to make the prediction
  17.130      }
  17.131 @@ -570,7 +571,7 @@
  17.132    return MAX2(_young_gen_sizer->min_desired_young_length(), desired_min_length);
  17.133  }
  17.134  
  17.135 -size_t G1CollectorPolicy::calculate_young_list_desired_max_length() {
  17.136 +uint G1CollectorPolicy::calculate_young_list_desired_max_length() {
  17.137    // Here, we might want to also take into account any additional
  17.138    // constraints (i.e., user-defined minimum bound). Currently, we
  17.139    // effectively don't set this bound.
  17.140 @@ -587,11 +588,11 @@
  17.141    // Calculate the absolute and desired min bounds.
  17.142  
  17.143    // This is how many young regions we already have (currently: the survivors).
  17.144 -  size_t base_min_length = recorded_survivor_regions();
  17.145 +  uint base_min_length = recorded_survivor_regions();
  17.146    // This is the absolute minimum young length, which ensures that we
  17.147    // can allocate one eden region in the worst-case.
  17.148 -  size_t absolute_min_length = base_min_length + 1;
  17.149 -  size_t desired_min_length =
  17.150 +  uint absolute_min_length = base_min_length + 1;
  17.151 +  uint desired_min_length =
  17.152                       calculate_young_list_desired_min_length(base_min_length);
  17.153    if (desired_min_length < absolute_min_length) {
  17.154      desired_min_length = absolute_min_length;
  17.155 @@ -600,16 +601,16 @@
  17.156    // Calculate the absolute and desired max bounds.
  17.157  
  17.158    // We will try our best not to "eat" into the reserve.
  17.159 -  size_t absolute_max_length = 0;
  17.160 +  uint absolute_max_length = 0;
  17.161    if (_free_regions_at_end_of_collection > _reserve_regions) {
  17.162      absolute_max_length = _free_regions_at_end_of_collection - _reserve_regions;
  17.163    }
  17.164 -  size_t desired_max_length = calculate_young_list_desired_max_length();
  17.165 +  uint desired_max_length = calculate_young_list_desired_max_length();
  17.166    if (desired_max_length > absolute_max_length) {
  17.167      desired_max_length = absolute_max_length;
  17.168    }
  17.169  
  17.170 -  size_t young_list_target_length = 0;
  17.171 +  uint young_list_target_length = 0;
  17.172    if (adaptive_young_list_length()) {
  17.173      if (gcs_are_young()) {
  17.174        young_list_target_length =
  17.175 @@ -647,11 +648,11 @@
  17.176    update_max_gc_locker_expansion();
  17.177  }
  17.178  
  17.179 -size_t
  17.180 +uint
  17.181  G1CollectorPolicy::calculate_young_list_target_length(size_t rs_lengths,
  17.182 -                                                   size_t base_min_length,
  17.183 -                                                   size_t desired_min_length,
  17.184 -                                                   size_t desired_max_length) {
  17.185 +                                                     uint base_min_length,
  17.186 +                                                     uint desired_min_length,
  17.187 +                                                     uint desired_max_length) {
  17.188    assert(adaptive_young_list_length(), "pre-condition");
  17.189    assert(gcs_are_young(), "only call this for young GCs");
  17.190  
  17.191 @@ -666,9 +667,9 @@
  17.192    // will be reflected in the predictions by the
  17.193    // survivor_regions_evac_time prediction.
  17.194    assert(desired_min_length > base_min_length, "invariant");
  17.195 -  size_t min_young_length = desired_min_length - base_min_length;
  17.196 +  uint min_young_length = desired_min_length - base_min_length;
  17.197    assert(desired_max_length > base_min_length, "invariant");
  17.198 -  size_t max_young_length = desired_max_length - base_min_length;
  17.199 +  uint max_young_length = desired_max_length - base_min_length;
  17.200  
  17.201    double target_pause_time_ms = _mmu_tracker->max_gc_time() * 1000.0;
  17.202    double survivor_regions_evac_time = predict_survivor_regions_evac_time();
  17.203 @@ -678,8 +679,8 @@
  17.204    double base_time_ms =
  17.205      predict_base_elapsed_time_ms(pending_cards, scanned_cards) +
  17.206      survivor_regions_evac_time;
  17.207 -  size_t available_free_regions = _free_regions_at_end_of_collection;
  17.208 -  size_t base_free_regions = 0;
  17.209 +  uint available_free_regions = _free_regions_at_end_of_collection;
  17.210 +  uint base_free_regions = 0;
  17.211    if (available_free_regions > _reserve_regions) {
  17.212      base_free_regions = available_free_regions - _reserve_regions;
  17.213    }
  17.214 @@ -716,9 +717,9 @@
  17.215        // the new max. This way we maintain the loop invariants.
  17.216  
  17.217        assert(min_young_length < max_young_length, "invariant");
  17.218 -      size_t diff = (max_young_length - min_young_length) / 2;
  17.219 +      uint diff = (max_young_length - min_young_length) / 2;
  17.220        while (diff > 0) {
  17.221 -        size_t young_length = min_young_length + diff;
  17.222 +        uint young_length = min_young_length + diff;
  17.223          if (predict_will_fit(young_length, base_time_ms,
  17.224                               base_free_regions, target_pause_time_ms)) {
  17.225            min_young_length = young_length;
  17.226 @@ -862,8 +863,6 @@
  17.227    _last_young_gc = false;
  17.228    clear_initiate_conc_mark_if_possible();
  17.229    clear_during_initial_mark_pause();
  17.230 -  _known_garbage_bytes = 0;
  17.231 -  _known_garbage_ratio = 0.0;
  17.232    _in_marking_window = false;
  17.233    _in_marking_window_im = false;
  17.234  
  17.235 @@ -876,7 +875,7 @@
  17.236    // Reset survivors SurvRateGroup.
  17.237    _survivor_surv_rate_group->reset();
  17.238    update_young_list_target_length();
  17.239 -  _collectionSetChooser->clearMarkedHeapRegions();
  17.240 +  _collectionSetChooser->clear();
  17.241  }
  17.242  
  17.243  void G1CollectorPolicy::record_stop_world_start() {
  17.244 @@ -885,7 +884,7 @@
  17.245  
  17.246  void G1CollectorPolicy::record_collection_pause_start(double start_time_sec,
  17.247                                                        size_t start_used) {
  17.248 -  if (PrintGCDetails) {
  17.249 +  if (G1Log::finer()) {
  17.250      gclog_or_tty->stamp(PrintGCTimeStamps);
  17.251      gclog_or_tty->print("[GC pause");
  17.252      gclog_or_tty->print(" (%s)", gcs_are_young() ? "young" : "mixed");
  17.253 @@ -1022,11 +1021,16 @@
  17.254      if (val > max)
  17.255        max = val;
  17.256      total += val;
  17.257 -    buf.append("  %3.1lf", val);
  17.258 +    if (G1Log::finest()) {
  17.259 +      buf.append("  %.1lf", val);
  17.260 +    }
  17.261    }
  17.262 -  buf.append_and_print_cr("");
  17.263 +
  17.264 +  if (G1Log::finest()) {
  17.265 +    buf.append_and_print_cr("");
  17.266 +  }
  17.267    double avg = total / (double) no_of_gc_threads();
  17.268 -  buf.append_and_print_cr(" Avg: %5.1lf, Min: %5.1lf, Max: %5.1lf, Diff: %5.1lf]",
  17.269 +  buf.append_and_print_cr(" Avg: %.1lf Min: %.1lf Max: %.1lf Diff: %.1lf]",
  17.270      avg, min, max, max - min);
  17.271  }
  17.272  
  17.273 @@ -1223,7 +1227,7 @@
  17.274  
  17.275    // These values are used to update the summary information that is
  17.276    // displayed when TraceGen0Time is enabled, and are output as part
  17.277 -  // of the PrintGCDetails output, in the non-parallel case.
  17.278 +  // of the "finer" output, in the non-parallel case.
  17.279  
  17.280    double ext_root_scan_time = avg_value(_par_last_ext_root_scan_times_ms);
  17.281    double satb_filtering_time = avg_value(_par_last_satb_filtering_times_ms);
  17.282 @@ -1316,7 +1320,7 @@
  17.283      // given that humongous object allocations do not really affect
  17.284      // either the pause's duration nor when the next pause will take
  17.285      // place we can safely ignore them here.
  17.286 -    size_t regions_allocated = eden_cset_region_length();
  17.287 +    uint regions_allocated = eden_cset_region_length();
  17.288      double alloc_rate_ms = (double) regions_allocated / app_time_ms;
  17.289      _alloc_rate_ms_seq->add(alloc_rate_ms);
  17.290  
  17.291 @@ -1356,8 +1360,7 @@
  17.292      }
  17.293    }
  17.294  
  17.295 -  // PrintGCDetails output
  17.296 -  if (PrintGCDetails) {
  17.297 +  if (G1Log::finer()) {
  17.298      bool print_marking_info =
  17.299        _g1->mark_in_progress() && !last_pause_included_initial_mark;
  17.300  
  17.301 @@ -1376,11 +1379,15 @@
  17.302          print_par_stats(2, "SATB Filtering", _par_last_satb_filtering_times_ms);
  17.303        }
  17.304        print_par_stats(2, "Update RS", _par_last_update_rs_times_ms);
  17.305 -      print_par_sizes(3, "Processed Buffers", _par_last_update_rs_processed_buffers);
  17.306 +      if (G1Log::finest()) {
  17.307 +        print_par_sizes(3, "Processed Buffers", _par_last_update_rs_processed_buffers);
  17.308 +      }
  17.309        print_par_stats(2, "Scan RS", _par_last_scan_rs_times_ms);
  17.310        print_par_stats(2, "Object Copy", _par_last_obj_copy_times_ms);
  17.311        print_par_stats(2, "Termination", _par_last_termination_times_ms);
  17.312 -      print_par_sizes(3, "Termination Attempts", _par_last_termination_attempts);
  17.313 +      if (G1Log::finest()) {
  17.314 +        print_par_sizes(3, "Termination Attempts", _par_last_termination_attempts);
  17.315 +      }
  17.316  
  17.317        for (int i = 0; i < _parallel_gc_threads; i++) {
  17.318          _par_last_gc_worker_times_ms[i] = _par_last_gc_worker_end_times_ms[i] -
  17.319 @@ -1406,7 +1413,9 @@
  17.320          print_stats(1, "SATB Filtering", satb_filtering_time);
  17.321        }
  17.322        print_stats(1, "Update RS", update_rs_time);
  17.323 -      print_stats(2, "Processed Buffers", (int)update_rs_processed_buffers);
  17.324 +      if (G1Log::finest()) {
  17.325 +        print_stats(2, "Processed Buffers", (int)update_rs_processed_buffers);
  17.326 +      }
  17.327        print_stats(1, "Scan RS", scan_rs_time);
  17.328        print_stats(1, "Object Copying", obj_copy_time);
  17.329      }
  17.330 @@ -1440,16 +1449,6 @@
  17.331      }
  17.332    }
  17.333  
  17.334 -  // Update the efficiency-since-mark vars.
  17.335 -  double proc_ms = elapsed_ms * (double) _parallel_gc_threads;
  17.336 -  if (elapsed_ms < MIN_TIMER_GRANULARITY) {
  17.337 -    // This usually happens due to the timer not having the required
  17.338 -    // granularity. Some Linuxes are the usual culprits.
  17.339 -    // We'll just set it to something (arbitrarily) small.
  17.340 -    proc_ms = 1.0;
  17.341 -  }
  17.342 -  double cur_efficiency = (double) freed_bytes / proc_ms;
  17.343 -
  17.344    bool new_in_marking_window = _in_marking_window;
  17.345    bool new_in_marking_window_im = false;
  17.346    if (during_initial_mark_pause()) {
  17.347 @@ -1484,10 +1483,6 @@
  17.348      }
  17.349    }
  17.350  
  17.351 -  if (_last_gc_was_young && !_during_marking) {
  17.352 -    _young_gc_eff_seq->add(cur_efficiency);
  17.353 -  }
  17.354 -
  17.355    _short_lived_surv_rate_group->start_adding_regions();
  17.356    // do that for any other surv rate groupsx
  17.357  
  17.358 @@ -1495,8 +1490,9 @@
  17.359      double pause_time_ms = elapsed_ms;
  17.360  
  17.361      size_t diff = 0;
  17.362 -    if (_max_pending_cards >= _pending_cards)
  17.363 +    if (_max_pending_cards >= _pending_cards) {
  17.364        diff = _max_pending_cards - _pending_cards;
  17.365 +    }
  17.366      _pending_card_diff_seq->add((double) diff);
  17.367  
  17.368      double cost_per_card_ms = 0.0;
  17.369 @@ -1601,7 +1597,7 @@
  17.370    double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0;
  17.371    adjust_concurrent_refinement(update_rs_time, update_rs_processed_buffers, update_rs_time_goal_ms);
  17.372  
  17.373 -  assert(assertMarkedBytesDataOK(), "Marked regions not OK at pause end.");
  17.374 +  _collectionSetChooser->verify();
  17.375  }
  17.376  
  17.377  #define EXT_SIZE_FORMAT "%d%s"
  17.378 @@ -1610,7 +1606,7 @@
  17.379    proper_unit_for_byte_size((bytes))
  17.380  
  17.381  void G1CollectorPolicy::print_heap_transition() {
  17.382 -  if (PrintGCDetails) {
  17.383 +  if (G1Log::finer()) {
  17.384      YoungList* young_list = _g1->young_list();
  17.385      size_t eden_bytes = young_list->eden_used_bytes();
  17.386      size_t survivor_bytes = young_list->survivor_used_bytes();
  17.387 @@ -1637,7 +1633,7 @@
  17.388        EXT_SIZE_PARAMS(capacity));
  17.389  
  17.390      _prev_eden_capacity = eden_capacity;
  17.391 -  } else if (PrintGC) {
  17.392 +  } else if (G1Log::fine()) {
  17.393      _g1->print_size_transition(gclog_or_tty,
  17.394                                 _cur_collection_pause_used_at_start_bytes,
  17.395                                 _g1->used(), _g1->capacity());
  17.396 @@ -1730,8 +1726,7 @@
  17.397    return region_elapsed_time_ms;
  17.398  }
  17.399  
  17.400 -size_t
  17.401 -G1CollectorPolicy::predict_bytes_to_copy(HeapRegion* hr) {
  17.402 +size_t G1CollectorPolicy::predict_bytes_to_copy(HeapRegion* hr) {
  17.403    size_t bytes_to_copy;
  17.404    if (hr->is_marked())
  17.405      bytes_to_copy = hr->max_live_bytes();
  17.406 @@ -1745,8 +1740,8 @@
  17.407  }
  17.408  
  17.409  void
  17.410 -G1CollectorPolicy::init_cset_region_lengths(size_t eden_cset_region_length,
  17.411 -                                          size_t survivor_cset_region_length) {
  17.412 +G1CollectorPolicy::init_cset_region_lengths(uint eden_cset_region_length,
  17.413 +                                            uint survivor_cset_region_length) {
  17.414    _eden_cset_region_length     = eden_cset_region_length;
  17.415    _survivor_cset_region_length = survivor_cset_region_length;
  17.416    _old_cset_region_length      = 0;
  17.417 @@ -2010,7 +2005,7 @@
  17.418  }
  17.419  #endif // PRODUCT
  17.420  
  17.421 -size_t G1CollectorPolicy::max_regions(int purpose) {
  17.422 +uint G1CollectorPolicy::max_regions(int purpose) {
  17.423    switch (purpose) {
  17.424      case GCAllocForSurvived:
  17.425        return _max_survivor_regions;
  17.426 @@ -2023,13 +2018,13 @@
  17.427  }
  17.428  
  17.429  void G1CollectorPolicy::update_max_gc_locker_expansion() {
  17.430 -  size_t expansion_region_num = 0;
  17.431 +  uint expansion_region_num = 0;
  17.432    if (GCLockerEdenExpansionPercent > 0) {
  17.433      double perc = (double) GCLockerEdenExpansionPercent / 100.0;
  17.434      double expansion_region_num_d = perc * (double) _young_list_target_length;
  17.435      // We use ceiling so that if expansion_region_num_d is > 0.0 (but
  17.436      // less than 1.0) we'll get 1.
  17.437 -    expansion_region_num = (size_t) ceil(expansion_region_num_d);
  17.438 +    expansion_region_num = (uint) ceil(expansion_region_num_d);
  17.439    } else {
  17.440      assert(expansion_region_num == 0, "sanity");
  17.441    }
  17.442 @@ -2043,34 +2038,12 @@
  17.443                   (double) _young_list_target_length / (double) SurvivorRatio;
  17.444    // We use ceiling so that if max_survivor_regions_d is > 0.0 (but
  17.445    // smaller than 1.0) we'll get 1.
  17.446 -  _max_survivor_regions = (size_t) ceil(max_survivor_regions_d);
  17.447 +  _max_survivor_regions = (uint) ceil(max_survivor_regions_d);
  17.448  
  17.449    _tenuring_threshold = _survivors_age_table.compute_tenuring_threshold(
  17.450          HeapRegion::GrainWords * _max_survivor_regions);
  17.451  }
  17.452  
  17.453 -#ifndef PRODUCT
  17.454 -class HRSortIndexIsOKClosure: public HeapRegionClosure {
  17.455 -  CollectionSetChooser* _chooser;
  17.456 -public:
  17.457 -  HRSortIndexIsOKClosure(CollectionSetChooser* chooser) :
  17.458 -    _chooser(chooser) {}
  17.459 -
  17.460 -  bool doHeapRegion(HeapRegion* r) {
  17.461 -    if (!r->continuesHumongous()) {
  17.462 -      assert(_chooser->regionProperlyOrdered(r), "Ought to be.");
  17.463 -    }
  17.464 -    return false;
  17.465 -  }
  17.466 -};
  17.467 -
  17.468 -bool G1CollectorPolicy::assertMarkedBytesDataOK() {
  17.469 -  HRSortIndexIsOKClosure cl(_collectionSetChooser);
  17.470 -  _g1->heap_region_iterate(&cl);
  17.471 -  return true;
  17.472 -}
  17.473 -#endif
  17.474 -
  17.475  bool G1CollectorPolicy::force_initial_mark_if_outside_cycle(
  17.476                                                       GCCause::Cause gc_cause) {
  17.477    bool during_cycle = _g1->concurrent_mark()->cmThread()->during_cycle();
  17.478 @@ -2168,8 +2141,8 @@
  17.479        // We will skip any region that's currently used as an old GC
  17.480        // alloc region (we should not consider those for collection
  17.481        // before we fill them up).
  17.482 -      if (_hrSorted->shouldAdd(r) && !_g1h->is_old_gc_alloc_region(r)) {
  17.483 -        _hrSorted->addMarkedHeapRegion(r);
  17.484 +      if (_hrSorted->should_add(r) && !_g1h->is_old_gc_alloc_region(r)) {
  17.485 +        _hrSorted->add_region(r);
  17.486        }
  17.487      }
  17.488      return false;
  17.489 @@ -2179,16 +2152,14 @@
  17.490  class ParKnownGarbageHRClosure: public HeapRegionClosure {
  17.491    G1CollectedHeap* _g1h;
  17.492    CollectionSetChooser* _hrSorted;
  17.493 -  jint _marked_regions_added;
  17.494 +  uint _marked_regions_added;
  17.495    size_t _reclaimable_bytes_added;
  17.496 -  jint _chunk_size;
  17.497 -  jint _cur_chunk_idx;
  17.498 -  jint _cur_chunk_end; // Cur chunk [_cur_chunk_idx, _cur_chunk_end)
  17.499 -  int _worker;
  17.500 -  int _invokes;
  17.501 +  uint _chunk_size;
  17.502 +  uint _cur_chunk_idx;
  17.503 +  uint _cur_chunk_end; // Cur chunk [_cur_chunk_idx, _cur_chunk_end)
  17.504  
  17.505    void get_new_chunk() {
  17.506 -    _cur_chunk_idx = _hrSorted->getParMarkedHeapRegionChunk(_chunk_size);
  17.507 +    _cur_chunk_idx = _hrSorted->claim_array_chunk(_chunk_size);
  17.508      _cur_chunk_end = _cur_chunk_idx + _chunk_size;
  17.509    }
  17.510    void add_region(HeapRegion* r) {
  17.511 @@ -2196,7 +2167,7 @@
  17.512        get_new_chunk();
  17.513      }
  17.514      assert(_cur_chunk_idx < _cur_chunk_end, "postcondition");
  17.515 -    _hrSorted->setMarkedHeapRegion(_cur_chunk_idx, r);
  17.516 +    _hrSorted->set_region(_cur_chunk_idx, r);
  17.517      _marked_regions_added++;
  17.518      _reclaimable_bytes_added += r->reclaimable_bytes();
  17.519      _cur_chunk_idx++;
  17.520 @@ -2204,104 +2175,79 @@
  17.521  
  17.522  public:
  17.523    ParKnownGarbageHRClosure(CollectionSetChooser* hrSorted,
  17.524 -                           jint chunk_size,
  17.525 -                           int worker) :
  17.526 +                           uint chunk_size) :
  17.527        _g1h(G1CollectedHeap::heap()),
  17.528 -      _hrSorted(hrSorted), _chunk_size(chunk_size), _worker(worker),
  17.529 +      _hrSorted(hrSorted), _chunk_size(chunk_size),
  17.530        _marked_regions_added(0), _reclaimable_bytes_added(0),
  17.531 -      _cur_chunk_idx(0), _cur_chunk_end(0), _invokes(0) { }
  17.532 +      _cur_chunk_idx(0), _cur_chunk_end(0) { }
  17.533  
  17.534    bool doHeapRegion(HeapRegion* r) {
  17.535 -    // We only include humongous regions in collection
  17.536 -    // sets when concurrent mark shows that their contained object is
  17.537 -    // unreachable.
  17.538 -    _invokes++;
  17.539 -
  17.540      // Do we have any marking information for this region?
  17.541      if (r->is_marked()) {
  17.542        // We will skip any region that's currently used as an old GC
  17.543        // alloc region (we should not consider those for collection
  17.544        // before we fill them up).
  17.545 -      if (_hrSorted->shouldAdd(r) && !_g1h->is_old_gc_alloc_region(r)) {
  17.546 +      if (_hrSorted->should_add(r) && !_g1h->is_old_gc_alloc_region(r)) {
  17.547          add_region(r);
  17.548        }
  17.549      }
  17.550      return false;
  17.551    }
  17.552 -  jint marked_regions_added() { return _marked_regions_added; }
  17.553 +  uint marked_regions_added() { return _marked_regions_added; }
  17.554    size_t reclaimable_bytes_added() { return _reclaimable_bytes_added; }
  17.555 -  int invokes() { return _invokes; }
  17.556  };
  17.557  
  17.558  class ParKnownGarbageTask: public AbstractGangTask {
  17.559    CollectionSetChooser* _hrSorted;
  17.560 -  jint _chunk_size;
  17.561 +  uint _chunk_size;
  17.562    G1CollectedHeap* _g1;
  17.563  public:
  17.564 -  ParKnownGarbageTask(CollectionSetChooser* hrSorted, jint chunk_size) :
  17.565 +  ParKnownGarbageTask(CollectionSetChooser* hrSorted, uint chunk_size) :
  17.566      AbstractGangTask("ParKnownGarbageTask"),
  17.567      _hrSorted(hrSorted), _chunk_size(chunk_size),
  17.568      _g1(G1CollectedHeap::heap()) { }
  17.569  
  17.570    void work(uint worker_id) {
  17.571 -    ParKnownGarbageHRClosure parKnownGarbageCl(_hrSorted,
  17.572 -                                               _chunk_size,
  17.573 -                                               worker_id);
  17.574 +    ParKnownGarbageHRClosure parKnownGarbageCl(_hrSorted, _chunk_size);
  17.575 +
  17.576      // Back to zero for the claim value.
  17.577      _g1->heap_region_par_iterate_chunked(&parKnownGarbageCl, worker_id,
  17.578                                           _g1->workers()->active_workers(),
  17.579                                           HeapRegion::InitialClaimValue);
  17.580 -    jint regions_added = parKnownGarbageCl.marked_regions_added();
  17.581 +    uint regions_added = parKnownGarbageCl.marked_regions_added();
  17.582      size_t reclaimable_bytes_added =
  17.583                                     parKnownGarbageCl.reclaimable_bytes_added();
  17.584 -    _hrSorted->updateTotals(regions_added, reclaimable_bytes_added);
  17.585 -    if (G1PrintParCleanupStats) {
  17.586 -      gclog_or_tty->print_cr("     Thread %d called %d times, added %d regions to list.",
  17.587 -                 worker_id, parKnownGarbageCl.invokes(), regions_added);
  17.588 -    }
  17.589 +    _hrSorted->update_totals(regions_added, reclaimable_bytes_added);
  17.590    }
  17.591  };
  17.592  
  17.593  void
  17.594  G1CollectorPolicy::record_concurrent_mark_cleanup_end(int no_of_gc_threads) {
  17.595 -  double start_sec;
  17.596 -  if (G1PrintParCleanupStats) {
  17.597 -    start_sec = os::elapsedTime();
  17.598 -  }
  17.599 +  _collectionSetChooser->clear();
  17.600  
  17.601 -  _collectionSetChooser->clearMarkedHeapRegions();
  17.602 -  double clear_marked_end_sec;
  17.603 -  if (G1PrintParCleanupStats) {
  17.604 -    clear_marked_end_sec = os::elapsedTime();
  17.605 -    gclog_or_tty->print_cr("  clear marked regions: %8.3f ms.",
  17.606 -                           (clear_marked_end_sec - start_sec) * 1000.0);
  17.607 -  }
  17.608 -
  17.609 +  uint region_num = _g1->n_regions();
  17.610    if (G1CollectedHeap::use_parallel_gc_threads()) {
  17.611 -    const size_t OverpartitionFactor = 4;
  17.612 -    size_t WorkUnit;
  17.613 +    const uint OverpartitionFactor = 4;
  17.614 +    uint WorkUnit;
  17.615      // The use of MinChunkSize = 8 in the original code
  17.616      // causes some assertion failures when the total number of
  17.617      // region is less than 8.  The code here tries to fix that.
  17.618      // Should the original code also be fixed?
  17.619      if (no_of_gc_threads > 0) {
  17.620 -      const size_t MinWorkUnit =
  17.621 -        MAX2(_g1->n_regions() / no_of_gc_threads, (size_t) 1U);
  17.622 -      WorkUnit =
  17.623 -        MAX2(_g1->n_regions() / (no_of_gc_threads * OverpartitionFactor),
  17.624 -             MinWorkUnit);
  17.625 +      const uint MinWorkUnit = MAX2(region_num / no_of_gc_threads, 1U);
  17.626 +      WorkUnit = MAX2(region_num / (no_of_gc_threads * OverpartitionFactor),
  17.627 +                      MinWorkUnit);
  17.628      } else {
  17.629        assert(no_of_gc_threads > 0,
  17.630          "The active gc workers should be greater than 0");
  17.631        // In a product build do something reasonable to avoid a crash.
  17.632 -      const size_t MinWorkUnit =
  17.633 -        MAX2(_g1->n_regions() / ParallelGCThreads, (size_t) 1U);
  17.634 +      const uint MinWorkUnit = MAX2(region_num / (uint) ParallelGCThreads, 1U);
  17.635        WorkUnit =
  17.636 -        MAX2(_g1->n_regions() / (ParallelGCThreads * OverpartitionFactor),
  17.637 +        MAX2(region_num / (uint) (ParallelGCThreads * OverpartitionFactor),
  17.638               MinWorkUnit);
  17.639      }
  17.640 -    _collectionSetChooser->prepareForAddMarkedHeapRegionsPar(_g1->n_regions(),
  17.641 -                                                             WorkUnit);
  17.642 +    _collectionSetChooser->prepare_for_par_region_addition(_g1->n_regions(),
  17.643 +                                                           WorkUnit);
  17.644      ParKnownGarbageTask parKnownGarbageTask(_collectionSetChooser,
  17.645                                              (int) WorkUnit);
  17.646      _g1->workers()->run_task(&parKnownGarbageTask);
  17.647 @@ -2312,20 +2258,10 @@
  17.648      KnownGarbageClosure knownGarbagecl(_collectionSetChooser);
  17.649      _g1->heap_region_iterate(&knownGarbagecl);
  17.650    }
  17.651 -  double known_garbage_end_sec;
  17.652 -  if (G1PrintParCleanupStats) {
  17.653 -    known_garbage_end_sec = os::elapsedTime();
  17.654 -    gclog_or_tty->print_cr("  compute known garbage: %8.3f ms.",
  17.655 -                      (known_garbage_end_sec - clear_marked_end_sec) * 1000.0);
  17.656 -  }
  17.657  
  17.658 -  _collectionSetChooser->sortMarkedHeapRegions();
  17.659 +  _collectionSetChooser->sort_regions();
  17.660 +
  17.661    double end_sec = os::elapsedTime();
  17.662 -  if (G1PrintParCleanupStats) {
  17.663 -    gclog_or_tty->print_cr("  sorting: %8.3f ms.",
  17.664 -                           (end_sec - known_garbage_end_sec) * 1000.0);
  17.665 -  }
  17.666 -
  17.667    double elapsed_time_ms = (end_sec - _mark_cleanup_start_sec) * 1000.0;
  17.668    _concurrent_mark_cleanup_times_ms->add(elapsed_time_ms);
  17.669    _cur_mark_stop_world_time_ms += elapsed_time_ms;
  17.670 @@ -2541,13 +2477,13 @@
  17.671  bool G1CollectorPolicy::next_gc_should_be_mixed(const char* true_action_str,
  17.672                                                  const char* false_action_str) {
  17.673    CollectionSetChooser* cset_chooser = _collectionSetChooser;
  17.674 -  if (cset_chooser->isEmpty()) {
  17.675 +  if (cset_chooser->is_empty()) {
  17.676      ergo_verbose0(ErgoMixedGCs,
  17.677                    false_action_str,
  17.678                    ergo_format_reason("candidate old regions not available"));
  17.679      return false;
  17.680    }
  17.681 -  size_t reclaimable_bytes = cset_chooser->remainingReclaimableBytes();
  17.682 +  size_t reclaimable_bytes = cset_chooser->remaining_reclaimable_bytes();
  17.683    size_t capacity_bytes = _g1->capacity();
  17.684    double perc = (double) reclaimable_bytes * 100.0 / (double) capacity_bytes;
  17.685    double threshold = (double) G1HeapWastePercent;
  17.686 @@ -2558,7 +2494,7 @@
  17.687                ergo_format_region("candidate old regions")
  17.688                ergo_format_byte_perc("reclaimable")
  17.689                ergo_format_perc("threshold"),
  17.690 -              cset_chooser->remainingRegions(),
  17.691 +              cset_chooser->remaining_regions(),
  17.692                reclaimable_bytes, perc, threshold);
  17.693      return false;
  17.694    }
  17.695 @@ -2569,7 +2505,7 @@
  17.696                  ergo_format_region("candidate old regions")
  17.697                  ergo_format_byte_perc("reclaimable")
  17.698                  ergo_format_perc("threshold"),
  17.699 -                cset_chooser->remainingRegions(),
  17.700 +                cset_chooser->remaining_regions(),
  17.701                  reclaimable_bytes, perc, threshold);
  17.702    return true;
  17.703  }
  17.704 @@ -2613,8 +2549,8 @@
  17.705    // pause are appended to the RHS of the young list, i.e.
  17.706    //   [Newly Young Regions ++ Survivors from last pause].
  17.707  
  17.708 -  size_t survivor_region_length = young_list->survivor_length();
  17.709 -  size_t eden_region_length = young_list->length() - survivor_region_length;
  17.710 +  uint survivor_region_length = young_list->survivor_length();
  17.711 +  uint eden_region_length = young_list->length() - survivor_region_length;
  17.712    init_cset_region_lengths(eden_region_length, survivor_region_length);
  17.713    hr = young_list->first_survivor_region();
  17.714    while (hr != NULL) {
  17.715 @@ -2652,11 +2588,11 @@
  17.716  
  17.717    if (!gcs_are_young()) {
  17.718      CollectionSetChooser* cset_chooser = _collectionSetChooser;
  17.719 -    assert(cset_chooser->verify(), "CSet Chooser verification - pre");
  17.720 -    const size_t min_old_cset_length = cset_chooser->calcMinOldCSetLength();
  17.721 -    const size_t max_old_cset_length = cset_chooser->calcMaxOldCSetLength();
  17.722 +    cset_chooser->verify();
  17.723 +    const uint min_old_cset_length = cset_chooser->calc_min_old_cset_length();
  17.724 +    const uint max_old_cset_length = cset_chooser->calc_max_old_cset_length();
  17.725  
  17.726 -    size_t expensive_region_num = 0;
  17.727 +    uint expensive_region_num = 0;
  17.728      bool check_time_remaining = adaptive_young_list_length();
  17.729      HeapRegion* hr = cset_chooser->peek();
  17.730      while (hr != NULL) {
  17.731 @@ -2741,7 +2677,7 @@
  17.732                      time_remaining_ms);
  17.733      }
  17.734  
  17.735 -    assert(cset_chooser->verify(), "CSet Chooser verification - post");
  17.736 +    cset_chooser->verify();
  17.737    }
  17.738  
  17.739    stop_incremental_cset_building();
    18.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Tue Mar 06 12:36:59 2012 +0100
    18.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Fri Apr 20 11:41:49 2012 -0700
    18.3 @@ -128,19 +128,19 @@
    18.4      SizerNewRatio
    18.5    };
    18.6    SizerKind _sizer_kind;
    18.7 -  size_t _min_desired_young_length;
    18.8 -  size_t _max_desired_young_length;
    18.9 +  uint _min_desired_young_length;
   18.10 +  uint _max_desired_young_length;
   18.11    bool _adaptive_size;
   18.12 -  size_t calculate_default_min_length(size_t new_number_of_heap_regions);
   18.13 -  size_t calculate_default_max_length(size_t new_number_of_heap_regions);
   18.14 +  uint calculate_default_min_length(uint new_number_of_heap_regions);
   18.15 +  uint calculate_default_max_length(uint new_number_of_heap_regions);
   18.16  
   18.17  public:
   18.18    G1YoungGenSizer();
   18.19 -  void heap_size_changed(size_t new_number_of_heap_regions);
   18.20 -  size_t min_desired_young_length() {
   18.21 +  void heap_size_changed(uint new_number_of_heap_regions);
   18.22 +  uint min_desired_young_length() {
   18.23      return _min_desired_young_length;
   18.24    }
   18.25 -  size_t max_desired_young_length() {
   18.26 +  uint max_desired_young_length() {
   18.27      return _max_desired_young_length;
   18.28    }
   18.29    bool adaptive_young_list_length() {
   18.30 @@ -175,7 +175,7 @@
   18.31  
   18.32    double _cur_collection_start_sec;
   18.33    size_t _cur_collection_pause_used_at_start_bytes;
   18.34 -  size_t _cur_collection_pause_used_regions_at_start;
   18.35 +  uint   _cur_collection_pause_used_regions_at_start;
   18.36    double _cur_collection_par_time_ms;
   18.37  
   18.38    double _cur_collection_code_root_fixup_time_ms;
   18.39 @@ -233,13 +233,13 @@
   18.40    // indicates whether we are in young or mixed GC mode
   18.41    bool _gcs_are_young;
   18.42  
   18.43 -  size_t _young_list_target_length;
   18.44 -  size_t _young_list_fixed_length;
   18.45 +  uint _young_list_target_length;
   18.46 +  uint _young_list_fixed_length;
   18.47    size_t _prev_eden_capacity; // used for logging
   18.48  
   18.49    // The max number of regions we can extend the eden by while the GC
   18.50    // locker is active. This should be >= _young_list_target_length;
   18.51 -  size_t _young_list_max_length;
   18.52 +  uint _young_list_max_length;
   18.53  
   18.54    bool                  _last_gc_was_young;
   18.55  
   18.56 @@ -257,7 +257,7 @@
   18.57    double                _gc_overhead_perc;
   18.58  
   18.59    double _reserve_factor;
   18.60 -  size_t _reserve_regions;
   18.61 +  uint _reserve_regions;
   18.62  
   18.63    bool during_marking() {
   18.64      return _during_marking;
   18.65 @@ -288,22 +288,20 @@
   18.66  
   18.67    TruncatedSeq* _cost_per_byte_ms_during_cm_seq;
   18.68  
   18.69 -  TruncatedSeq* _young_gc_eff_seq;
   18.70 -
   18.71    G1YoungGenSizer* _young_gen_sizer;
   18.72  
   18.73 -  size_t _eden_cset_region_length;
   18.74 -  size_t _survivor_cset_region_length;
   18.75 -  size_t _old_cset_region_length;
   18.76 +  uint _eden_cset_region_length;
   18.77 +  uint _survivor_cset_region_length;
   18.78 +  uint _old_cset_region_length;
   18.79  
   18.80 -  void init_cset_region_lengths(size_t eden_cset_region_length,
   18.81 -                                size_t survivor_cset_region_length);
   18.82 +  void init_cset_region_lengths(uint eden_cset_region_length,
   18.83 +                                uint survivor_cset_region_length);
   18.84  
   18.85 -  size_t eden_cset_region_length()     { return _eden_cset_region_length;     }
   18.86 -  size_t survivor_cset_region_length() { return _survivor_cset_region_length; }
   18.87 -  size_t old_cset_region_length()      { return _old_cset_region_length;      }
   18.88 +  uint eden_cset_region_length()     { return _eden_cset_region_length;     }
   18.89 +  uint survivor_cset_region_length() { return _survivor_cset_region_length; }
   18.90 +  uint old_cset_region_length()      { return _old_cset_region_length;      }
   18.91  
   18.92 -  size_t _free_regions_at_end_of_collection;
   18.93 +  uint _free_regions_at_end_of_collection;
   18.94  
   18.95    size_t _recorded_rs_lengths;
   18.96    size_t _max_rs_lengths;
   18.97 @@ -315,9 +313,6 @@
   18.98  
   18.99    size_t _rs_lengths_prediction;
  18.100  
  18.101 -  size_t _known_garbage_bytes;
  18.102 -  double _known_garbage_ratio;
  18.103 -
  18.104    double sigma() { return _sigma; }
  18.105  
  18.106    // A function that prevents us putting too much stock in small sample
  18.107 @@ -496,10 +491,10 @@
  18.108  
  18.109    void set_recorded_rs_lengths(size_t rs_lengths);
  18.110  
  18.111 -  size_t cset_region_length()       { return young_cset_region_length() +
  18.112 -                                             old_cset_region_length(); }
  18.113 -  size_t young_cset_region_length() { return eden_cset_region_length() +
  18.114 -                                             survivor_cset_region_length(); }
  18.115 +  uint cset_region_length()       { return young_cset_region_length() +
  18.116 +                                           old_cset_region_length(); }
  18.117 +  uint young_cset_region_length() { return eden_cset_region_length() +
  18.118 +                                           survivor_cset_region_length(); }
  18.119  
  18.120    void record_young_free_cset_time_ms(double time_ms) {
  18.121      _recorded_young_free_cset_time_ms = time_ms;
  18.122 @@ -509,10 +504,6 @@
  18.123      _recorded_non_young_free_cset_time_ms = time_ms;
  18.124    }
  18.125  
  18.126 -  double predict_young_gc_eff() {
  18.127 -    return get_new_neg_prediction(_young_gc_eff_seq);
  18.128 -  }
  18.129 -
  18.130    double predict_survivor_regions_evac_time();
  18.131  
  18.132    void cset_regions_freed() {
  18.133 @@ -522,20 +513,6 @@
  18.134      // also call it on any more surv rate groups
  18.135    }
  18.136  
  18.137 -  void set_known_garbage_bytes(size_t known_garbage_bytes) {
  18.138 -    _known_garbage_bytes = known_garbage_bytes;
  18.139 -    size_t heap_bytes = _g1->capacity();
  18.140 -    _known_garbage_ratio = (double) _known_garbage_bytes / (double) heap_bytes;
  18.141 -  }
  18.142 -
  18.143 -  void decrease_known_garbage_bytes(size_t known_garbage_bytes) {
  18.144 -    guarantee( _known_garbage_bytes >= known_garbage_bytes, "invariant" );
  18.145 -
  18.146 -    _known_garbage_bytes -= known_garbage_bytes;
  18.147 -    size_t heap_bytes = _g1->capacity();
  18.148 -    _known_garbage_ratio = (double) _known_garbage_bytes / (double) heap_bytes;
  18.149 -  }
  18.150 -
  18.151    G1MMUTracker* mmu_tracker() {
  18.152      return _mmu_tracker;
  18.153    }
  18.154 @@ -720,12 +697,12 @@
  18.155    // Calculate and return the minimum desired young list target
  18.156    // length. This is the minimum desired young list length according
  18.157    // to the user's inputs.
  18.158 -  size_t calculate_young_list_desired_min_length(size_t base_min_length);
  18.159 +  uint calculate_young_list_desired_min_length(uint base_min_length);
  18.160  
  18.161    // Calculate and return the maximum desired young list target
  18.162    // length. This is the maximum desired young list length according
  18.163    // to the user's inputs.
  18.164 -  size_t calculate_young_list_desired_max_length();
  18.165 +  uint calculate_young_list_desired_max_length();
  18.166  
  18.167    // Calculate and return the maximum young list target length that
  18.168    // can fit into the pause time goal. The parameters are: rs_lengths
  18.169 @@ -733,18 +710,18 @@
  18.170    // be, base_min_length is the alreay existing number of regions in
  18.171    // the young list, min_length and max_length are the desired min and
  18.172    // max young list length according to the user's inputs.
  18.173 -  size_t calculate_young_list_target_length(size_t rs_lengths,
  18.174 -                                            size_t base_min_length,
  18.175 -                                            size_t desired_min_length,
  18.176 -                                            size_t desired_max_length);
  18.177 +  uint calculate_young_list_target_length(size_t rs_lengths,
  18.178 +                                          uint base_min_length,
  18.179 +                                          uint desired_min_length,
  18.180 +                                          uint desired_max_length);
  18.181  
  18.182    // Check whether a given young length (young_length) fits into the
  18.183    // given target pause time and whether the prediction for the amount
  18.184    // of objects to be copied for the given length will fit into the
  18.185    // given free space (expressed by base_free_regions).  It is used by
  18.186    // calculate_young_list_target_length().
  18.187 -  bool predict_will_fit(size_t young_length, double base_time_ms,
  18.188 -                        size_t base_free_regions, double target_pause_time_ms);
  18.189 +  bool predict_will_fit(uint young_length, double base_time_ms,
  18.190 +                        uint base_free_regions, double target_pause_time_ms);
  18.191  
  18.192    // Count the number of bytes used in the CS.
  18.193    void count_CS_bytes_used();
  18.194 @@ -773,7 +750,7 @@
  18.195    }
  18.196  
  18.197    // This should be called after the heap is resized.
  18.198 -  void record_new_heap_size(size_t new_number_of_regions);
  18.199 +  void record_new_heap_size(uint new_number_of_regions);
  18.200  
  18.201    void init();
  18.202  
  18.203 @@ -1026,12 +1003,6 @@
  18.204    // exceeded the desired limit, return an amount to expand by.
  18.205    size_t expansion_amount();
  18.206  
  18.207 -#ifndef PRODUCT
  18.208 -  // Check any appropriate marked bytes info, asserting false if
  18.209 -  // something's wrong, else returning "true".
  18.210 -  bool assertMarkedBytesDataOK();
  18.211 -#endif
  18.212 -
  18.213    // Print tracing information.
  18.214    void print_tracing_info() const;
  18.215  
  18.216 @@ -1048,18 +1019,18 @@
  18.217    }
  18.218  
  18.219    bool is_young_list_full() {
  18.220 -    size_t young_list_length = _g1->young_list()->length();
  18.221 -    size_t young_list_target_length = _young_list_target_length;
  18.222 +    uint young_list_length = _g1->young_list()->length();
  18.223 +    uint young_list_target_length = _young_list_target_length;
  18.224      return young_list_length >= young_list_target_length;
  18.225    }
  18.226  
  18.227    bool can_expand_young_list() {
  18.228 -    size_t young_list_length = _g1->young_list()->length();
  18.229 -    size_t young_list_max_length = _young_list_max_length;
  18.230 +    uint young_list_length = _g1->young_list()->length();
  18.231 +    uint young_list_max_length = _young_list_max_length;
  18.232      return young_list_length < young_list_max_length;
  18.233    }
  18.234  
  18.235 -  size_t young_list_max_length() {
  18.236 +  uint young_list_max_length() {
  18.237      return _young_list_max_length;
  18.238    }
  18.239  
  18.240 @@ -1074,19 +1045,6 @@
  18.241      return _young_gen_sizer->adaptive_young_list_length();
  18.242    }
  18.243  
  18.244 -  inline double get_gc_eff_factor() {
  18.245 -    double ratio = _known_garbage_ratio;
  18.246 -
  18.247 -    double square = ratio * ratio;
  18.248 -    // square = square * square;
  18.249 -    double ret = square * 9.0 + 1.0;
  18.250 -#if 0
  18.251 -    gclog_or_tty->print_cr("ratio = %1.2lf, ret = %1.2lf", ratio, ret);
  18.252 -#endif // 0
  18.253 -    guarantee(0.0 <= ret && ret < 10.0, "invariant!");
  18.254 -    return ret;
  18.255 -  }
  18.256 -
  18.257  private:
  18.258    //
  18.259    // Survivor regions policy.
  18.260 @@ -1097,7 +1055,7 @@
  18.261    int _tenuring_threshold;
  18.262  
  18.263    // The limit on the number of regions allocated for survivors.
  18.264 -  size_t _max_survivor_regions;
  18.265 +  uint _max_survivor_regions;
  18.266  
  18.267    // For reporting purposes.
  18.268    size_t _eden_bytes_before_gc;
  18.269 @@ -1105,7 +1063,7 @@
  18.270    size_t _capacity_before_gc;
  18.271  
  18.272    // The amount of survor regions after a collection.
  18.273 -  size_t _recorded_survivor_regions;
  18.274 +  uint _recorded_survivor_regions;
  18.275    // List of survivor regions.
  18.276    HeapRegion* _recorded_survivor_head;
  18.277    HeapRegion* _recorded_survivor_tail;
  18.278 @@ -1127,9 +1085,9 @@
  18.279      return purpose == GCAllocForSurvived;
  18.280    }
  18.281  
  18.282 -  static const size_t REGIONS_UNLIMITED = ~(size_t)0;
  18.283 +  static const uint REGIONS_UNLIMITED = (uint) -1;
  18.284  
  18.285 -  size_t max_regions(int purpose);
  18.286 +  uint max_regions(int purpose);
  18.287  
  18.288    // The limit on regions for a particular purpose is reached.
  18.289    void note_alloc_region_limit_reached(int purpose) {
  18.290 @@ -1146,7 +1104,7 @@
  18.291      _survivor_surv_rate_group->stop_adding_regions();
  18.292    }
  18.293  
  18.294 -  void record_survivor_regions(size_t      regions,
  18.295 +  void record_survivor_regions(uint regions,
  18.296                                 HeapRegion* head,
  18.297                                 HeapRegion* tail) {
  18.298      _recorded_survivor_regions = regions;
  18.299 @@ -1154,12 +1112,11 @@
  18.300      _recorded_survivor_tail    = tail;
  18.301    }
  18.302  
  18.303 -  size_t recorded_survivor_regions() {
  18.304 +  uint recorded_survivor_regions() {
  18.305      return _recorded_survivor_regions;
  18.306    }
  18.307  
  18.308 -  void record_thread_age_table(ageTable* age_table)
  18.309 -  {
  18.310 +  void record_thread_age_table(ageTable* age_table) {
  18.311      _survivors_age_table.merge_par(age_table);
  18.312    }
  18.313  
    19.1 --- a/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp	Tue Mar 06 12:36:59 2012 +0100
    19.2 +++ b/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp	Fri Apr 20 11:41:49 2012 -0700
    19.3 @@ -1,5 +1,5 @@
    19.4  /*
    19.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    19.6 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    19.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.8   *
    19.9   * This code is free software; you can redistribute it and/or modify it
   19.10 @@ -120,7 +120,7 @@
   19.11  
   19.12  // Single parameter format strings
   19.13  #define ergo_format_str(_name_)      ", " _name_ ": %s"
   19.14 -#define ergo_format_region(_name_)   ", " _name_ ": "SIZE_FORMAT" regions"
   19.15 +#define ergo_format_region(_name_)   ", " _name_ ": %u regions"
   19.16  #define ergo_format_byte(_name_)     ", " _name_ ": "SIZE_FORMAT" bytes"
   19.17  #define ergo_format_double(_name_)   ", " _name_ ": %1.2f"
   19.18  #define ergo_format_perc(_name_)     ", " _name_ ": %1.2f %%"
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/src/share/vm/gc_implementation/g1/g1Log.cpp	Fri Apr 20 11:41:49 2012 -0700
    20.3 @@ -0,0 +1,56 @@
    20.4 +/*
    20.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.7 + *
    20.8 + * This code is free software; you can redistribute it and/or modify it
    20.9 + * under the terms of the GNU General Public License version 2 only, as
   20.10 + * published by the Free Software Foundation.
   20.11 + *
   20.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   20.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   20.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   20.15 + * version 2 for more details (a copy is included in the LICENSE file that
   20.16 + * accompanied this code).
   20.17 + *
   20.18 + * You should have received a copy of the GNU General Public License version
   20.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   20.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20.21 + *
   20.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   20.23 + * or visit www.oracle.com if you need additional information or have any
   20.24 + * questions.
   20.25 + *
   20.26 + */
   20.27 +
   20.28 +#include "precompiled.hpp"
   20.29 +#include "gc_implementation/g1/g1_globals.hpp"
   20.30 +#include "gc_implementation/g1/g1Log.hpp"
   20.31 +#include "runtime/globals.hpp"
   20.32 +
   20.33 +G1Log::LogLevel G1Log::_level = G1Log::LevelNone;
   20.34 +
   20.35 +// If G1LogLevel has not been set up we will use the values of PrintGC
   20.36 +// and PrintGCDetails for the logging level.
   20.37 +// - PrintGC maps to "fine".
   20.38 +// - PrintGCDetails maps to "finer".
   20.39 +void G1Log::init() {
   20.40 +  if (G1LogLevel != NULL && G1LogLevel[0] != '\0') {
   20.41 +    if (strncmp("none", G1LogLevel, 4) == 0 && G1LogLevel[4] == '\0') {
   20.42 +      _level = LevelNone;
   20.43 +    } else if (strncmp("fine", G1LogLevel, 4) == 0 && G1LogLevel[4] == '\0') {
   20.44 +      _level = LevelFine;
   20.45 +    } else if (strncmp("finer", G1LogLevel, 5) == 0 && G1LogLevel[5] == '\0') {
   20.46 +      _level = LevelFiner;
   20.47 +    } else if (strncmp("finest", G1LogLevel, 6) == 0 && G1LogLevel[6] == '\0') {
   20.48 +      _level = LevelFinest;
   20.49 +    } else {
   20.50 +      warning("Unknown logging level '%s', should be one of 'fine', 'finer' or 'finest'.", G1LogLevel);
   20.51 +    }
   20.52 +  } else {
   20.53 +    if (PrintGCDetails) {
   20.54 +      _level = LevelFiner;
   20.55 +    } else if (PrintGC) {
   20.56 +      _level = LevelFine;
   20.57 +    }
   20.58 +  }
   20.59 +}
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/src/share/vm/gc_implementation/g1/g1Log.hpp	Fri Apr 20 11:41:49 2012 -0700
    21.3 @@ -0,0 +1,56 @@
    21.4 +/*
    21.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    21.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.7 + *
    21.8 + * This code is free software; you can redistribute it and/or modify it
    21.9 + * under the terms of the GNU General Public License version 2 only, as
   21.10 + * published by the Free Software Foundation.
   21.11 + *
   21.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   21.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   21.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   21.15 + * version 2 for more details (a copy is included in the LICENSE file that
   21.16 + * accompanied this code).
   21.17 + *
   21.18 + * You should have received a copy of the GNU General Public License version
   21.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   21.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   21.21 + *
   21.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   21.23 + * or visit www.oracle.com if you need additional information or have any
   21.24 + * questions.
   21.25 + *
   21.26 + */
   21.27 +
   21.28 +#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1LOG_HPP
   21.29 +#define SHARE_VM_GC_IMPLEMENTATION_G1_G1LOG_HPP
   21.30 +
   21.31 +#include "memory/allocation.hpp"
   21.32 +
   21.33 +class G1Log : public AllStatic {
   21.34 +  typedef enum {
   21.35 +    LevelNone,
   21.36 +    LevelFine,
   21.37 +    LevelFiner,
   21.38 +    LevelFinest
   21.39 +  } LogLevel;
   21.40 +
   21.41 +  static LogLevel _level;
   21.42 +
   21.43 + public:
   21.44 +  inline static bool fine() {
   21.45 +    return _level >= LevelFine;
   21.46 +  }
   21.47 +
   21.48 +  inline static bool finer() {
   21.49 +    return _level >= LevelFiner;
   21.50 +  }
   21.51 +
   21.52 +  inline static bool finest() {
   21.53 +    return _level == LevelFinest;
   21.54 +  }
   21.55 +
   21.56 +  static void init();
   21.57 +};
   21.58 +
   21.59 +#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1LOG_HPP
    22.1 --- a/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Tue Mar 06 12:36:59 2012 +0100
    22.2 +++ b/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Fri Apr 20 11:41:49 2012 -0700
    22.3 @@ -29,6 +29,7 @@
    22.4  #include "classfile/vmSymbols.hpp"
    22.5  #include "code/codeCache.hpp"
    22.6  #include "code/icBuffer.hpp"
    22.7 +#include "gc_implementation/g1/g1Log.hpp"
    22.8  #include "gc_implementation/g1/g1MarkSweep.hpp"
    22.9  #include "memory/gcLocker.hpp"
   22.10  #include "memory/genCollectedHeap.hpp"
   22.11 @@ -126,7 +127,7 @@
   22.12  void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading,
   22.13                                      bool clear_all_softrefs) {
   22.14    // Recursively traverse all live objects and mark them
   22.15 -  TraceTime tm("phase 1", PrintGC && Verbose, true, gclog_or_tty);
   22.16 +  TraceTime tm("phase 1", G1Log::fine() && Verbose, true, gclog_or_tty);
   22.17    GenMarkSweep::trace(" 1");
   22.18  
   22.19    SharedHeap* sh = SharedHeap::heap();
   22.20 @@ -192,8 +193,7 @@
   22.21      // fail. At the end of the GC, the orginal mark word values
   22.22      // (including hash values) are restored to the appropriate
   22.23      // objects.
   22.24 -    Universe::heap()->verify(/* allow dirty */ true,
   22.25 -                             /* silent      */ false,
   22.26 +    Universe::heap()->verify(/* silent      */ false,
   22.27                               /* option      */ VerifyOption_G1UseMarkWord);
   22.28  
   22.29      G1CollectedHeap* g1h = G1CollectedHeap::heap();
   22.30 @@ -291,7 +291,7 @@
   22.31    G1CollectedHeap* g1h = G1CollectedHeap::heap();
   22.32    Generation* pg = g1h->perm_gen();
   22.33  
   22.34 -  TraceTime tm("phase 2", PrintGC && Verbose, true, gclog_or_tty);
   22.35 +  TraceTime tm("phase 2", G1Log::fine() && Verbose, true, gclog_or_tty);
   22.36    GenMarkSweep::trace("2");
   22.37  
   22.38    FindFirstRegionClosure cl;
   22.39 @@ -335,7 +335,7 @@
   22.40    Generation* pg = g1h->perm_gen();
   22.41  
   22.42    // Adjust the pointers to reflect the new locations
   22.43 -  TraceTime tm("phase 3", PrintGC && Verbose, true, gclog_or_tty);
   22.44 +  TraceTime tm("phase 3", G1Log::fine() && Verbose, true, gclog_or_tty);
   22.45    GenMarkSweep::trace("3");
   22.46  
   22.47    SharedHeap* sh = SharedHeap::heap();
   22.48 @@ -399,7 +399,7 @@
   22.49    G1CollectedHeap* g1h = G1CollectedHeap::heap();
   22.50    Generation* pg = g1h->perm_gen();
   22.51  
   22.52 -  TraceTime tm("phase 4", PrintGC && Verbose, true, gclog_or_tty);
   22.53 +  TraceTime tm("phase 4", G1Log::fine() && Verbose, true, gclog_or_tty);
   22.54    GenMarkSweep::trace("4");
   22.55  
   22.56    pg->compact();
    23.1 --- a/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp	Tue Mar 06 12:36:59 2012 +0100
    23.2 +++ b/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp	Fri Apr 20 11:41:49 2012 -0700
    23.3 @@ -1,5 +1,5 @@
    23.4  /*
    23.5 - * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
    23.6 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    23.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.8   *
    23.9   * This code is free software; you can redistribute it and/or modify it
   23.10 @@ -177,19 +177,19 @@
   23.11    // values we read here are possible (i.e., at a STW phase at the end
   23.12    // of a GC).
   23.13  
   23.14 -  size_t young_list_length = g1->young_list()->length();
   23.15 -  size_t survivor_list_length = g1->g1_policy()->recorded_survivor_regions();
   23.16 +  uint young_list_length = g1->young_list()->length();
   23.17 +  uint survivor_list_length = g1->g1_policy()->recorded_survivor_regions();
   23.18    assert(young_list_length >= survivor_list_length, "invariant");
   23.19 -  size_t eden_list_length = young_list_length - survivor_list_length;
   23.20 +  uint eden_list_length = young_list_length - survivor_list_length;
   23.21    // Max length includes any potential extensions to the young gen
   23.22    // we'll do when the GC locker is active.
   23.23 -  size_t young_list_max_length = g1->g1_policy()->young_list_max_length();
   23.24 +  uint young_list_max_length = g1->g1_policy()->young_list_max_length();
   23.25    assert(young_list_max_length >= survivor_list_length, "invariant");
   23.26 -  size_t eden_list_max_length = young_list_max_length - survivor_list_length;
   23.27 +  uint eden_list_max_length = young_list_max_length - survivor_list_length;
   23.28  
   23.29    _overall_used = g1->used_unlocked();
   23.30 -  _eden_used = eden_list_length * HeapRegion::GrainBytes;
   23.31 -  _survivor_used = survivor_list_length * HeapRegion::GrainBytes;
   23.32 +  _eden_used = (size_t) eden_list_length * HeapRegion::GrainBytes;
   23.33 +  _survivor_used = (size_t) survivor_list_length * HeapRegion::GrainBytes;
   23.34    _young_region_num = young_list_length;
   23.35    _old_used = subtract_up_to_zero(_overall_used, _eden_used + _survivor_used);
   23.36  
   23.37 @@ -207,7 +207,7 @@
   23.38    committed -= _survivor_committed + _old_committed;
   23.39  
   23.40    // Next, calculate and remove the committed size for the eden.
   23.41 -  _eden_committed = eden_list_max_length * HeapRegion::GrainBytes;
   23.42 +  _eden_committed = (size_t) eden_list_max_length * HeapRegion::GrainBytes;
   23.43    // Somewhat defensive: be robust in case there are inaccuracies in
   23.44    // the calculations
   23.45    _eden_committed = MIN2(_eden_committed, committed);
   23.46 @@ -237,10 +237,10 @@
   23.47    // When a new eden region is allocated, only the eden_used size is
   23.48    // affected (since we have recalculated everything else at the last GC).
   23.49  
   23.50 -  size_t young_region_num = g1h()->young_list()->length();
   23.51 +  uint young_region_num = g1h()->young_list()->length();
   23.52    if (young_region_num > _young_region_num) {
   23.53 -    size_t diff = young_region_num - _young_region_num;
   23.54 -    _eden_used += diff * HeapRegion::GrainBytes;
   23.55 +    uint diff = young_region_num - _young_region_num;
   23.56 +    _eden_used += (size_t) diff * HeapRegion::GrainBytes;
   23.57      // Somewhat defensive: cap the eden used size to make sure it
   23.58      // never exceeds the committed size.
   23.59      _eden_used = MIN2(_eden_used, _eden_committed);
    24.1 --- a/src/share/vm/gc_implementation/g1/g1MonitoringSupport.hpp	Tue Mar 06 12:36:59 2012 +0100
    24.2 +++ b/src/share/vm/gc_implementation/g1/g1MonitoringSupport.hpp	Fri Apr 20 11:41:49 2012 -0700
    24.3 @@ -1,5 +1,5 @@
    24.4  /*
    24.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    24.6 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    24.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    24.8   *
    24.9   * This code is free software; you can redistribute it and/or modify it
   24.10 @@ -147,7 +147,7 @@
   24.11    size_t _overall_committed;
   24.12    size_t _overall_used;
   24.13  
   24.14 -  size_t _young_region_num;
   24.15 +  uint   _young_region_num;
   24.16    size_t _young_gen_committed;
   24.17    size_t _eden_committed;
   24.18    size_t _eden_used;
    25.1 --- a/src/share/vm/gc_implementation/g1/g1_globals.hpp	Tue Mar 06 12:36:59 2012 +0100
    25.2 +++ b/src/share/vm/gc_implementation/g1/g1_globals.hpp	Fri Apr 20 11:41:49 2012 -0700
    25.3 @@ -26,7 +26,6 @@
    25.4  #define SHARE_VM_GC_IMPLEMENTATION_G1_G1_GLOBALS_HPP
    25.5  
    25.6  #include "runtime/globals.hpp"
    25.7 -
    25.8  //
    25.9  // Defines all globals flags used by the garbage-first compiler.
   25.10  //
   25.11 @@ -128,9 +127,6 @@
   25.12              "Prints the liveness information for all regions in the heap "  \
   25.13              "at the end of a marking cycle.")                               \
   25.14                                                                              \
   25.15 -  develop(bool, G1PrintParCleanupStats, false,                              \
   25.16 -          "When true, print extra stats about parallel cleanup.")           \
   25.17 -                                                                            \
   25.18    product(intx, G1UpdateBufferSize, 256,                                    \
   25.19            "Size of an update buffer")                                       \
   25.20                                                                              \
   25.21 @@ -309,7 +305,10 @@
   25.22                                                                              \
   25.23    develop(uintx, G1OldCSetRegionThresholdPercent, 10,                       \
   25.24            "An upper bound for the number of old CSet regions expressed "    \
   25.25 -          "as a percentage of the heap size.")
   25.26 +          "as a percentage of the heap size.")                              \
   25.27 +                                                                            \
   25.28 +  experimental(ccstr, G1LogLevel, NULL,                                     \
   25.29 +          "Log level for G1 logging: fine, finer, finest")
   25.30  
   25.31  G1_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_EXPERIMENTAL_FLAG, DECLARE_NOTPRODUCT_FLAG, DECLARE_MANAGEABLE_FLAG, DECLARE_PRODUCT_RW_FLAG)
   25.32  
    26.1 --- a/src/share/vm/gc_implementation/g1/heapRegion.cpp	Tue Mar 06 12:36:59 2012 +0100
    26.2 +++ b/src/share/vm/gc_implementation/g1/heapRegion.cpp	Fri Apr 20 11:41:49 2012 -0700
    26.3 @@ -334,7 +334,7 @@
    26.4  
    26.5    guarantee(GrainWords == 0, "we should only set it once");
    26.6    GrainWords = GrainBytes >> LogHeapWordSize;
    26.7 -  guarantee((size_t)(1 << LogOfHRGrainWords) == GrainWords, "sanity");
    26.8 +  guarantee((size_t) 1 << LogOfHRGrainWords == GrainWords, "sanity");
    26.9  
   26.10    guarantee(CardsPerRegion == 0, "we should only set it once");
   26.11    CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift;
   26.12 @@ -370,7 +370,6 @@
   26.13      _claimed = InitialClaimValue;
   26.14    }
   26.15    zero_marked_bytes();
   26.16 -  set_sort_index(-1);
   26.17  
   26.18    _offsets.resize(HeapRegion::GrainWords);
   26.19    init_top_at_mark_start();
   26.20 @@ -482,17 +481,16 @@
   26.21  #endif // _MSC_VER
   26.22  
   26.23  
   26.24 -HeapRegion::
   26.25 -HeapRegion(size_t hrs_index, G1BlockOffsetSharedArray* sharedOffsetArray,
   26.26 -           MemRegion mr, bool is_zeroed)
   26.27 -  : G1OffsetTableContigSpace(sharedOffsetArray, mr, is_zeroed),
   26.28 +HeapRegion::HeapRegion(uint hrs_index,
   26.29 +                       G1BlockOffsetSharedArray* sharedOffsetArray,
   26.30 +                       MemRegion mr, bool is_zeroed) :
   26.31 +    G1OffsetTableContigSpace(sharedOffsetArray, mr, is_zeroed),
   26.32      _hrs_index(hrs_index),
   26.33      _humongous_type(NotHumongous), _humongous_start_region(NULL),
   26.34      _in_collection_set(false),
   26.35      _next_in_special_set(NULL), _orig_end(NULL),
   26.36      _claimed(InitialClaimValue), _evacuation_failed(false),
   26.37 -    _prev_marked_bytes(0), _next_marked_bytes(0), _sort_index(-1),
   26.38 -    _gc_efficiency(0.0),
   26.39 +    _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0),
   26.40      _young_type(NotYoung), _next_young_region(NULL),
   26.41      _next_dirty_cards_region(NULL), _next(NULL), _pending_removal(false),
   26.42  #ifdef ASSERT
   26.43 @@ -779,16 +777,15 @@
   26.44    G1OffsetTableContigSpace::print_on(st);
   26.45  }
   26.46  
   26.47 -void HeapRegion::verify(bool allow_dirty) const {
   26.48 +void HeapRegion::verify() const {
   26.49    bool dummy = false;
   26.50 -  verify(allow_dirty, VerifyOption_G1UsePrevMarking, /* failures */ &dummy);
   26.51 +  verify(VerifyOption_G1UsePrevMarking, /* failures */ &dummy);
   26.52  }
   26.53  
   26.54  // This really ought to be commoned up into OffsetTableContigSpace somehow.
   26.55  // We would need a mechanism to make that code skip dead objects.
   26.56  
   26.57 -void HeapRegion::verify(bool allow_dirty,
   26.58 -                        VerifyOption vo,
   26.59 +void HeapRegion::verify(VerifyOption vo,
   26.60                          bool* failures) const {
   26.61    G1CollectedHeap* g1 = G1CollectedHeap::heap();
   26.62    *failures = false;
    27.1 --- a/src/share/vm/gc_implementation/g1/heapRegion.hpp	Tue Mar 06 12:36:59 2012 +0100
    27.2 +++ b/src/share/vm/gc_implementation/g1/heapRegion.hpp	Fri Apr 20 11:41:49 2012 -0700
    27.3 @@ -52,12 +52,15 @@
    27.4  class HeapRegion;
    27.5  class HeapRegionSetBase;
    27.6  
    27.7 -#define HR_FORMAT SIZE_FORMAT":(%s)["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]"
    27.8 +#define HR_FORMAT "%u:(%s)["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]"
    27.9  #define HR_FORMAT_PARAMS(_hr_) \
   27.10                  (_hr_)->hrs_index(), \
   27.11                  (_hr_)->is_survivor() ? "S" : (_hr_)->is_young() ? "E" : "-", \
   27.12                  (_hr_)->bottom(), (_hr_)->top(), (_hr_)->end()
   27.13  
   27.14 +// sentinel value for hrs_index
   27.15 +#define G1_NULL_HRS_INDEX ((uint) -1)
   27.16 +
   27.17  // A dirty card to oop closure for heap regions. It
   27.18  // knows how to get the G1 heap and how to use the bitmap
   27.19  // in the concurrent marker used by G1 to filter remembered
   27.20 @@ -235,7 +238,7 @@
   27.21  
   27.22   protected:
   27.23    // The index of this region in the heap region sequence.
   27.24 -  size_t  _hrs_index;
   27.25 +  uint  _hrs_index;
   27.26  
   27.27    HumongousType _humongous_type;
   27.28    // For a humongous region, region in which it starts.
   27.29 @@ -278,12 +281,8 @@
   27.30    size_t _prev_marked_bytes;    // Bytes known to be live via last completed marking.
   27.31    size_t _next_marked_bytes;    // Bytes known to be live via in-progress marking.
   27.32  
   27.33 -  // See "sort_index" method.  -1 means is not in the array.
   27.34 -  int _sort_index;
   27.35 -
   27.36 -  // <PREDICTION>
   27.37 +  // The calculated GC efficiency of the region.
   27.38    double _gc_efficiency;
   27.39 -  // </PREDICTION>
   27.40  
   27.41    enum YoungType {
   27.42      NotYoung,                   // a region is not young
   27.43 @@ -342,7 +341,7 @@
   27.44  
   27.45   public:
   27.46    // If "is_zeroed" is "true", the region "mr" can be assumed to contain zeros.
   27.47 -  HeapRegion(size_t hrs_index,
   27.48 +  HeapRegion(uint hrs_index,
   27.49               G1BlockOffsetSharedArray* sharedOffsetArray,
   27.50               MemRegion mr, bool is_zeroed);
   27.51  
   27.52 @@ -389,7 +388,7 @@
   27.53  
   27.54    // If this region is a member of a HeapRegionSeq, the index in that
   27.55    // sequence, otherwise -1.
   27.56 -  size_t hrs_index() const { return _hrs_index; }
   27.57 +  uint hrs_index() const { return _hrs_index; }
   27.58  
   27.59    // The number of bytes marked live in the region in the last marking phase.
   27.60    size_t marked_bytes()    { return _prev_marked_bytes; }
   27.61 @@ -626,16 +625,6 @@
   27.62    // last mark phase ended.
   27.63    bool is_marked() { return _prev_top_at_mark_start != bottom(); }
   27.64  
   27.65 -  // If "is_marked()" is true, then this is the index of the region in
   27.66 -  // an array constructed at the end of marking of the regions in a
   27.67 -  // "desirability" order.
   27.68 -  int sort_index() {
   27.69 -    return _sort_index;
   27.70 -  }
   27.71 -  void set_sort_index(int i) {
   27.72 -    _sort_index = i;
   27.73 -  }
   27.74 -
   27.75    void init_top_at_conc_mark_count() {
   27.76      _top_at_conc_mark_count = bottom();
   27.77    }
   27.78 @@ -823,10 +812,10 @@
   27.79    // Currently there is only one place where this is called with
   27.80    // vo == UseMarkWord, which is to verify the marking during a
   27.81    // full GC.
   27.82 -  void verify(bool allow_dirty, VerifyOption vo, bool *failures) const;
   27.83 +  void verify(VerifyOption vo, bool *failures) const;
   27.84  
   27.85    // Override; it uses the "prev" marking information
   27.86 -  virtual void verify(bool allow_dirty) const;
   27.87 +  virtual void verify() const;
   27.88  };
   27.89  
   27.90  // HeapRegionClosure is used for iterating over regions.
    28.1 --- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Tue Mar 06 12:36:59 2012 +0100
    28.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Fri Apr 20 11:41:49 2012 -0700
    28.3 @@ -1,5 +1,5 @@
    28.4  /*
    28.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    28.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
    28.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    28.8   *
    28.9   * This code is free software; you can redistribute it and/or modify it
   28.10 @@ -577,7 +577,7 @@
   28.11  #endif
   28.12  
   28.13  void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) {
   28.14 -  size_t cur_hrs_ind = hr()->hrs_index();
   28.15 +  size_t cur_hrs_ind = (size_t) hr()->hrs_index();
   28.16  
   28.17  #if HRRS_VERBOSE
   28.18    gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").",
   28.19 @@ -841,7 +841,7 @@
   28.20  #endif
   28.21  
   28.22    // Set the corresponding coarse bit.
   28.23 -  size_t max_hrs_index = max->hr()->hrs_index();
   28.24 +  size_t max_hrs_index = (size_t) max->hr()->hrs_index();
   28.25    if (!_coarse_map.at(max_hrs_index)) {
   28.26      _coarse_map.at_put(max_hrs_index, true);
   28.27      _n_coarse_entries++;
   28.28 @@ -866,17 +866,20 @@
   28.29  void OtherRegionsTable::scrub(CardTableModRefBS* ctbs,
   28.30                                BitMap* region_bm, BitMap* card_bm) {
   28.31    // First eliminated garbage regions from the coarse map.
   28.32 -  if (G1RSScrubVerbose)
   28.33 -    gclog_or_tty->print_cr("Scrubbing region "SIZE_FORMAT":",
   28.34 -                           hr()->hrs_index());
   28.35 +  if (G1RSScrubVerbose) {
   28.36 +    gclog_or_tty->print_cr("Scrubbing region %u:", hr()->hrs_index());
   28.37 +  }
   28.38  
   28.39    assert(_coarse_map.size() == region_bm->size(), "Precondition");
   28.40 -  if (G1RSScrubVerbose)
   28.41 -    gclog_or_tty->print("   Coarse map: before = %d...", _n_coarse_entries);
   28.42 +  if (G1RSScrubVerbose) {
   28.43 +    gclog_or_tty->print("   Coarse map: before = "SIZE_FORMAT"...",
   28.44 +                        _n_coarse_entries);
   28.45 +  }
   28.46    _coarse_map.set_intersection(*region_bm);
   28.47    _n_coarse_entries = _coarse_map.count_one_bits();
   28.48 -  if (G1RSScrubVerbose)
   28.49 -    gclog_or_tty->print_cr("   after = %d.", _n_coarse_entries);
   28.50 +  if (G1RSScrubVerbose) {
   28.51 +    gclog_or_tty->print_cr("   after = "SIZE_FORMAT".", _n_coarse_entries);
   28.52 +  }
   28.53  
   28.54    // Now do the fine-grained maps.
   28.55    for (size_t i = 0; i < _max_fine_entries; i++) {
   28.56 @@ -885,23 +888,27 @@
   28.57      while (cur != NULL) {
   28.58        PosParPRT* nxt = cur->next();
   28.59        // If the entire region is dead, eliminate.
   28.60 -      if (G1RSScrubVerbose)
   28.61 -        gclog_or_tty->print_cr("     For other region "SIZE_FORMAT":",
   28.62 +      if (G1RSScrubVerbose) {
   28.63 +        gclog_or_tty->print_cr("     For other region %u:",
   28.64                                 cur->hr()->hrs_index());
   28.65 -      if (!region_bm->at(cur->hr()->hrs_index())) {
   28.66 +      }
   28.67 +      if (!region_bm->at((size_t) cur->hr()->hrs_index())) {
   28.68          *prev = nxt;
   28.69          cur->set_next(NULL);
   28.70          _n_fine_entries--;
   28.71 -        if (G1RSScrubVerbose)
   28.72 +        if (G1RSScrubVerbose) {
   28.73            gclog_or_tty->print_cr("          deleted via region map.");
   28.74 +        }
   28.75          PosParPRT::free(cur);
   28.76        } else {
   28.77          // Do fine-grain elimination.
   28.78 -        if (G1RSScrubVerbose)
   28.79 +        if (G1RSScrubVerbose) {
   28.80            gclog_or_tty->print("          occ: before = %4d.", cur->occupied());
   28.81 +        }
   28.82          cur->scrub(ctbs, card_bm);
   28.83 -        if (G1RSScrubVerbose)
   28.84 +        if (G1RSScrubVerbose) {
   28.85            gclog_or_tty->print_cr("          after = %4d.", cur->occupied());
   28.86 +        }
   28.87          // Did that empty the table completely?
   28.88          if (cur->occupied() == 0) {
   28.89            *prev = nxt;
   28.90 @@ -1003,7 +1010,7 @@
   28.91  
   28.92  void OtherRegionsTable::clear_incoming_entry(HeapRegion* from_hr) {
   28.93    MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
   28.94 -  size_t hrs_ind = from_hr->hrs_index();
   28.95 +  size_t hrs_ind = (size_t) from_hr->hrs_index();
   28.96    size_t ind = hrs_ind & _mod_max_fine_entries_mask;
   28.97    if (del_single_region_table(ind, from_hr)) {
   28.98      assert(!_coarse_map.at(hrs_ind), "Inv");
   28.99 @@ -1011,7 +1018,7 @@
  28.100      _coarse_map.par_at_put(hrs_ind, 0);
  28.101    }
  28.102    // Check to see if any of the fcc entries come from here.
  28.103 -  size_t hr_ind = hr()->hrs_index();
  28.104 +  size_t hr_ind = (size_t) hr()->hrs_index();
  28.105    for (int tid = 0; tid < HeapRegionRemSet::num_par_rem_sets(); tid++) {
  28.106      int fcc_ent = _from_card_cache[tid][hr_ind];
  28.107      if (fcc_ent != -1) {
  28.108 @@ -1223,7 +1230,7 @@
  28.109      if ((size_t)_coarse_cur_region_index < _coarse_map->size()) {
  28.110        _coarse_cur_region_cur_card = 0;
  28.111        HeapWord* r_bot =
  28.112 -        _g1h->region_at(_coarse_cur_region_index)->bottom();
  28.113 +        _g1h->region_at((uint) _coarse_cur_region_index)->bottom();
  28.114        _cur_region_card_offset = _bosa->index_for(r_bot);
  28.115      } else {
  28.116        return false;
    29.1 --- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp	Tue Mar 06 12:36:59 2012 +0100
    29.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp	Fri Apr 20 11:41:49 2012 -0700
    29.3 @@ -329,13 +329,13 @@
    29.4  
    29.5    // Declare the heap size (in # of regions) to the HeapRegionRemSet(s).
    29.6    // (Uses it to initialize from_card_cache).
    29.7 -  static void init_heap(size_t max_regions) {
    29.8 -    OtherRegionsTable::init_from_card_cache(max_regions);
    29.9 +  static void init_heap(uint max_regions) {
   29.10 +    OtherRegionsTable::init_from_card_cache((size_t) max_regions);
   29.11    }
   29.12  
   29.13    // Declares that only regions i s.t. 0 <= i < new_n_regs are in use.
   29.14 -  static void shrink_heap(size_t new_n_regs) {
   29.15 -    OtherRegionsTable::shrink_from_card_cache(new_n_regs);
   29.16 +  static void shrink_heap(uint new_n_regs) {
   29.17 +    OtherRegionsTable::shrink_from_card_cache((size_t) new_n_regs);
   29.18    }
   29.19  
   29.20  #ifndef PRODUCT
    30.1 --- a/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Tue Mar 06 12:36:59 2012 +0100
    30.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Fri Apr 20 11:41:49 2012 -0700
    30.3 @@ -1,5 +1,5 @@
    30.4  /*
    30.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    30.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
    30.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.8   *
    30.9   * This code is free software; you can redistribute it and/or modify it
   30.10 @@ -31,16 +31,15 @@
   30.11  
   30.12  // Private
   30.13  
   30.14 -size_t HeapRegionSeq::find_contiguous_from(size_t from, size_t num) {
   30.15 -  size_t len = length();
   30.16 +uint HeapRegionSeq::find_contiguous_from(uint from, uint num) {
   30.17 +  uint len = length();
   30.18    assert(num > 1, "use this only for sequences of length 2 or greater");
   30.19    assert(from <= len,
   30.20 -         err_msg("from: "SIZE_FORMAT" should be valid and <= than "SIZE_FORMAT,
   30.21 -                 from, len));
   30.22 +         err_msg("from: %u should be valid and <= than %u", from, len));
   30.23  
   30.24 -  size_t curr = from;
   30.25 -  size_t first = G1_NULL_HRS_INDEX;
   30.26 -  size_t num_so_far = 0;
   30.27 +  uint curr = from;
   30.28 +  uint first = G1_NULL_HRS_INDEX;
   30.29 +  uint num_so_far = 0;
   30.30    while (curr < len && num_so_far < num) {
   30.31      if (at(curr)->is_empty()) {
   30.32        if (first == G1_NULL_HRS_INDEX) {
   30.33 @@ -60,7 +59,7 @@
   30.34      // we found enough space for the humongous object
   30.35      assert(from <= first && first < len, "post-condition");
   30.36      assert(first < curr && (curr - first) == num, "post-condition");
   30.37 -    for (size_t i = first; i < first + num; ++i) {
   30.38 +    for (uint i = first; i < first + num; ++i) {
   30.39        assert(at(i)->is_empty(), "post-condition");
   30.40      }
   30.41      return first;
   30.42 @@ -73,10 +72,10 @@
   30.43  // Public
   30.44  
   30.45  void HeapRegionSeq::initialize(HeapWord* bottom, HeapWord* end,
   30.46 -                               size_t max_length) {
   30.47 -  assert((size_t) bottom % HeapRegion::GrainBytes == 0,
   30.48 +                               uint max_length) {
   30.49 +  assert((uintptr_t) bottom % HeapRegion::GrainBytes == 0,
   30.50           "bottom should be heap region aligned");
   30.51 -  assert((size_t) end % HeapRegion::GrainBytes == 0,
   30.52 +  assert((uintptr_t) end % HeapRegion::GrainBytes == 0,
   30.53           "end should be heap region aligned");
   30.54  
   30.55    _length = 0;
   30.56 @@ -88,8 +87,8 @@
   30.57    _max_length = max_length;
   30.58  
   30.59    _regions = NEW_C_HEAP_ARRAY(HeapRegion*, max_length);
   30.60 -  memset(_regions, 0, max_length * sizeof(HeapRegion*));
   30.61 -  _regions_biased = _regions - ((size_t) bottom >> _region_shift);
   30.62 +  memset(_regions, 0, (size_t) max_length * sizeof(HeapRegion*));
   30.63 +  _regions_biased = _regions - ((uintx) bottom >> _region_shift);
   30.64  
   30.65    assert(&_regions[0] == &_regions_biased[addr_to_index_biased(bottom)],
   30.66           "bottom should be included in the region with index 0");
   30.67 @@ -105,7 +104,7 @@
   30.68    assert(_heap_bottom <= next_bottom, "invariant");
   30.69    while (next_bottom < new_end) {
   30.70      assert(next_bottom < _heap_end, "invariant");
   30.71 -    size_t index = length();
   30.72 +    uint index = length();
   30.73  
   30.74      assert(index < _max_length, "otherwise we cannot expand further");
   30.75      if (index == 0) {
   30.76 @@ -139,9 +138,9 @@
   30.77    return MemRegion(old_end, next_bottom);
   30.78  }
   30.79  
   30.80 -size_t HeapRegionSeq::free_suffix() {
   30.81 -  size_t res = 0;
   30.82 -  size_t index = length();
   30.83 +uint HeapRegionSeq::free_suffix() {
   30.84 +  uint res = 0;
   30.85 +  uint index = length();
   30.86    while (index > 0) {
   30.87      index -= 1;
   30.88      if (!at(index)->is_empty()) {
   30.89 @@ -152,27 +151,24 @@
   30.90    return res;
   30.91  }
   30.92  
   30.93 -size_t HeapRegionSeq::find_contiguous(size_t num) {
   30.94 +uint HeapRegionSeq::find_contiguous(uint num) {
   30.95    assert(num > 1, "use this only for sequences of length 2 or greater");
   30.96    assert(_next_search_index <= length(),
   30.97 -         err_msg("_next_search_indeex: "SIZE_FORMAT" "
   30.98 -                 "should be valid and <= than "SIZE_FORMAT,
   30.99 +         err_msg("_next_search_index: %u should be valid and <= than %u",
  30.100                   _next_search_index, length()));
  30.101  
  30.102 -  size_t start = _next_search_index;
  30.103 -  size_t res = find_contiguous_from(start, num);
  30.104 +  uint start = _next_search_index;
  30.105 +  uint res = find_contiguous_from(start, num);
  30.106    if (res == G1_NULL_HRS_INDEX && start > 0) {
  30.107      // Try starting from the beginning. If _next_search_index was 0,
  30.108      // no point in doing this again.
  30.109      res = find_contiguous_from(0, num);
  30.110    }
  30.111    if (res != G1_NULL_HRS_INDEX) {
  30.112 -    assert(res < length(),
  30.113 -           err_msg("res: "SIZE_FORMAT" should be valid", res));
  30.114 +    assert(res < length(), err_msg("res: %u should be valid", res));
  30.115      _next_search_index = res + num;
  30.116      assert(_next_search_index <= length(),
  30.117 -           err_msg("_next_search_indeex: "SIZE_FORMAT" "
  30.118 -                   "should be valid and <= than "SIZE_FORMAT,
  30.119 +           err_msg("_next_search_index: %u should be valid and <= than %u",
  30.120                     _next_search_index, length()));
  30.121    }
  30.122    return res;
  30.123 @@ -183,20 +179,20 @@
  30.124  }
  30.125  
  30.126  void HeapRegionSeq::iterate_from(HeapRegion* hr, HeapRegionClosure* blk) const {
  30.127 -  size_t hr_index = 0;
  30.128 +  uint hr_index = 0;
  30.129    if (hr != NULL) {
  30.130 -    hr_index = (size_t) hr->hrs_index();
  30.131 +    hr_index = hr->hrs_index();
  30.132    }
  30.133  
  30.134 -  size_t len = length();
  30.135 -  for (size_t i = hr_index; i < len; i += 1) {
  30.136 +  uint len = length();
  30.137 +  for (uint i = hr_index; i < len; i += 1) {
  30.138      bool res = blk->doHeapRegion(at(i));
  30.139      if (res) {
  30.140        blk->incomplete();
  30.141        return;
  30.142      }
  30.143    }
  30.144 -  for (size_t i = 0; i < hr_index; i += 1) {
  30.145 +  for (uint i = 0; i < hr_index; i += 1) {
  30.146      bool res = blk->doHeapRegion(at(i));
  30.147      if (res) {
  30.148        blk->incomplete();
  30.149 @@ -206,7 +202,7 @@
  30.150  }
  30.151  
  30.152  MemRegion HeapRegionSeq::shrink_by(size_t shrink_bytes,
  30.153 -                                   size_t* num_regions_deleted) {
  30.154 +                                   uint* num_regions_deleted) {
  30.155    // Reset this in case it's currently pointing into the regions that
  30.156    // we just removed.
  30.157    _next_search_index = 0;
  30.158 @@ -218,7 +214,7 @@
  30.159    assert(_allocated_length > 0, "we should have at least one region committed");
  30.160  
  30.161    // around the loop, i will be the next region to be removed
  30.162 -  size_t i = length() - 1;
  30.163 +  uint i = length() - 1;
  30.164    assert(i > 0, "we should never remove all regions");
  30.165    // [last_start, end) is the MemRegion that covers the regions we will remove.
  30.166    HeapWord* end = at(i)->end();
  30.167 @@ -249,29 +245,24 @@
  30.168  #ifndef PRODUCT
  30.169  void HeapRegionSeq::verify_optional() {
  30.170    guarantee(_length <= _allocated_length,
  30.171 -            err_msg("invariant: _length: "SIZE_FORMAT" "
  30.172 -                    "_allocated_length: "SIZE_FORMAT,
  30.173 +            err_msg("invariant: _length: %u _allocated_length: %u",
  30.174                      _length, _allocated_length));
  30.175    guarantee(_allocated_length <= _max_length,
  30.176 -            err_msg("invariant: _allocated_length: "SIZE_FORMAT" "
  30.177 -                    "_max_length: "SIZE_FORMAT,
  30.178 +            err_msg("invariant: _allocated_length: %u _max_length: %u",
  30.179                      _allocated_length, _max_length));
  30.180    guarantee(_next_search_index <= _length,
  30.181 -            err_msg("invariant: _next_search_index: "SIZE_FORMAT" "
  30.182 -                    "_length: "SIZE_FORMAT,
  30.183 +            err_msg("invariant: _next_search_index: %u _length: %u",
  30.184                      _next_search_index, _length));
  30.185  
  30.186    HeapWord* prev_end = _heap_bottom;
  30.187 -  for (size_t i = 0; i < _allocated_length; i += 1) {
  30.188 +  for (uint i = 0; i < _allocated_length; i += 1) {
  30.189      HeapRegion* hr = _regions[i];
  30.190 -    guarantee(hr != NULL, err_msg("invariant: i: "SIZE_FORMAT, i));
  30.191 +    guarantee(hr != NULL, err_msg("invariant: i: %u", i));
  30.192      guarantee(hr->bottom() == prev_end,
  30.193 -              err_msg("invariant i: "SIZE_FORMAT" "HR_FORMAT" "
  30.194 -                      "prev_end: "PTR_FORMAT,
  30.195 +              err_msg("invariant i: %u "HR_FORMAT" prev_end: "PTR_FORMAT,
  30.196                        i, HR_FORMAT_PARAMS(hr), prev_end));
  30.197      guarantee(hr->hrs_index() == i,
  30.198 -              err_msg("invariant: i: "SIZE_FORMAT" hrs_index(): "SIZE_FORMAT,
  30.199 -                      i, hr->hrs_index()));
  30.200 +              err_msg("invariant: i: %u hrs_index(): %u", i, hr->hrs_index()));
  30.201      if (i < _length) {
  30.202        // Asserts will fire if i is >= _length
  30.203        HeapWord* addr = hr->bottom();
  30.204 @@ -290,8 +281,8 @@
  30.205        prev_end = hr->end();
  30.206      }
  30.207    }
  30.208 -  for (size_t i = _allocated_length; i < _max_length; i += 1) {
  30.209 -    guarantee(_regions[i] == NULL, err_msg("invariant i: "SIZE_FORMAT, i));
  30.210 +  for (uint i = _allocated_length; i < _max_length; i += 1) {
  30.211 +    guarantee(_regions[i] == NULL, err_msg("invariant i: %u", i));
  30.212    }
  30.213  }
  30.214  #endif // PRODUCT
    31.1 --- a/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp	Tue Mar 06 12:36:59 2012 +0100
    31.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp	Fri Apr 20 11:41:49 2012 -0700
    31.3 @@ -1,5 +1,5 @@
    31.4  /*
    31.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    31.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
    31.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    31.8   *
    31.9   * This code is free software; you can redistribute it and/or modify it
   31.10 @@ -29,8 +29,6 @@
   31.11  class HeapRegionClosure;
   31.12  class FreeRegionList;
   31.13  
   31.14 -#define G1_NULL_HRS_INDEX ((size_t) -1)
   31.15 -
   31.16  // This class keeps track of the region metadata (i.e., HeapRegion
   31.17  // instances). They are kept in the _regions array in address
   31.18  // order. A region's index in the array corresponds to its index in
   31.19 @@ -65,7 +63,7 @@
   31.20    HeapRegion** _regions_biased;
   31.21  
   31.22    // The number of regions committed in the heap.
   31.23 -  size_t _length;
   31.24 +  uint _length;
   31.25  
   31.26    // The address of the first reserved word in the heap.
   31.27    HeapWord* _heap_bottom;
   31.28 @@ -74,32 +72,32 @@
   31.29    HeapWord* _heap_end;
   31.30  
   31.31    // The log of the region byte size.
   31.32 -  size_t _region_shift;
   31.33 +  uint _region_shift;
   31.34  
   31.35    // A hint for which index to start searching from for humongous
   31.36    // allocations.
   31.37 -  size_t _next_search_index;
   31.38 +  uint _next_search_index;
   31.39  
   31.40    // The number of regions for which we have allocated HeapRegions for.
   31.41 -  size_t _allocated_length;
   31.42 +  uint _allocated_length;
   31.43  
   31.44    // The maximum number of regions in the heap.
   31.45 -  size_t _max_length;
   31.46 +  uint _max_length;
   31.47  
   31.48    // Find a contiguous set of empty regions of length num, starting
   31.49    // from the given index.
   31.50 -  size_t find_contiguous_from(size_t from, size_t num);
   31.51 +  uint find_contiguous_from(uint from, uint num);
   31.52  
   31.53    // Map a heap address to a biased region index. Assume that the
   31.54    // address is valid.
   31.55 -  inline size_t addr_to_index_biased(HeapWord* addr) const;
   31.56 +  inline uintx addr_to_index_biased(HeapWord* addr) const;
   31.57  
   31.58 -  void increment_length(size_t* length) {
   31.59 +  void increment_length(uint* length) {
   31.60      assert(*length < _max_length, "pre-condition");
   31.61      *length += 1;
   31.62    }
   31.63  
   31.64 -  void decrement_length(size_t* length) {
   31.65 +  void decrement_length(uint* length) {
   31.66      assert(*length > 0, "pre-condition");
   31.67      *length -= 1;
   31.68    }
   31.69 @@ -108,11 +106,11 @@
   31.70    // Empty contructor, we'll initialize it with the initialize() method.
   31.71    HeapRegionSeq() { }
   31.72  
   31.73 -  void initialize(HeapWord* bottom, HeapWord* end, size_t max_length);
   31.74 +  void initialize(HeapWord* bottom, HeapWord* end, uint max_length);
   31.75  
   31.76    // Return the HeapRegion at the given index. Assume that the index
   31.77    // is valid.
   31.78 -  inline HeapRegion* at(size_t index) const;
   31.79 +  inline HeapRegion* at(uint index) const;
   31.80  
   31.81    // If addr is within the committed space return its corresponding
   31.82    // HeapRegion, otherwise return NULL.
   31.83 @@ -123,10 +121,10 @@
   31.84    inline HeapRegion* addr_to_region_unsafe(HeapWord* addr) const;
   31.85  
   31.86    // Return the number of regions that have been committed in the heap.
   31.87 -  size_t length() const { return _length; }
   31.88 +  uint length() const { return _length; }
   31.89  
   31.90    // Return the maximum number of regions in the heap.
   31.91 -  size_t max_length() const { return _max_length; }
   31.92 +  uint max_length() const { return _max_length; }
   31.93  
   31.94    // Expand the sequence to reflect that the heap has grown from
   31.95    // old_end to new_end. Either create new HeapRegions, or re-use
   31.96 @@ -139,12 +137,12 @@
   31.97  
   31.98    // Return the number of contiguous regions at the end of the sequence
   31.99    // that are available for allocation.
  31.100 -  size_t free_suffix();
  31.101 +  uint free_suffix();
  31.102  
  31.103    // Find a contiguous set of empty regions of length num and return
  31.104    // the index of the first region or G1_NULL_HRS_INDEX if the
  31.105    // search was unsuccessful.
  31.106 -  size_t find_contiguous(size_t num);
  31.107 +  uint find_contiguous(uint num);
  31.108  
  31.109    // Apply blk->doHeapRegion() on all committed regions in address order,
  31.110    // terminating the iteration early if doHeapRegion() returns true.
  31.111 @@ -159,7 +157,7 @@
  31.112    // sequence. Return a MemRegion that corresponds to the address
  31.113    // range of the uncommitted regions. Assume shrink_bytes is page and
  31.114    // heap region aligned.
  31.115 -  MemRegion shrink_by(size_t shrink_bytes, size_t* num_regions_deleted);
  31.116 +  MemRegion shrink_by(size_t shrink_bytes, uint* num_regions_deleted);
  31.117  
  31.118    // Do some sanity checking.
  31.119    void verify_optional() PRODUCT_RETURN;
    32.1 --- a/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp	Tue Mar 06 12:36:59 2012 +0100
    32.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp	Fri Apr 20 11:41:49 2012 -0700
    32.3 @@ -1,5 +1,5 @@
    32.4  /*
    32.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    32.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
    32.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    32.8   *
    32.9   * This code is free software; you can redistribute it and/or modify it
   32.10 @@ -28,11 +28,11 @@
   32.11  #include "gc_implementation/g1/heapRegion.hpp"
   32.12  #include "gc_implementation/g1/heapRegionSeq.hpp"
   32.13  
   32.14 -inline size_t HeapRegionSeq::addr_to_index_biased(HeapWord* addr) const {
   32.15 +inline uintx HeapRegionSeq::addr_to_index_biased(HeapWord* addr) const {
   32.16    assert(_heap_bottom <= addr && addr < _heap_end,
   32.17           err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT" end: "PTR_FORMAT,
   32.18                   addr, _heap_bottom, _heap_end));
   32.19 -  size_t index = (size_t) addr >> _region_shift;
   32.20 +  uintx index = (uintx) addr >> _region_shift;
   32.21    return index;
   32.22  }
   32.23  
   32.24 @@ -40,7 +40,7 @@
   32.25    assert(_heap_bottom <= addr && addr < _heap_end,
   32.26           err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT" end: "PTR_FORMAT,
   32.27                   addr, _heap_bottom, _heap_end));
   32.28 -  size_t index_biased = addr_to_index_biased(addr);
   32.29 +  uintx index_biased = addr_to_index_biased(addr);
   32.30    HeapRegion* hr = _regions_biased[index_biased];
   32.31    assert(hr != NULL, "invariant");
   32.32    return hr;
   32.33 @@ -55,7 +55,7 @@
   32.34    return NULL;
   32.35  }
   32.36  
   32.37 -inline HeapRegion* HeapRegionSeq::at(size_t index) const {
   32.38 +inline HeapRegion* HeapRegionSeq::at(uint index) const {
   32.39    assert(index < length(), "pre-condition");
   32.40    HeapRegion* hr = _regions[index];
   32.41    assert(hr != NULL, "sanity");
    33.1 --- a/src/share/vm/gc_implementation/g1/heapRegionSet.cpp	Tue Mar 06 12:36:59 2012 +0100
    33.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionSet.cpp	Fri Apr 20 11:41:49 2012 -0700
    33.3 @@ -1,5 +1,5 @@
    33.4  /*
    33.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    33.6 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    33.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    33.8   *
    33.9   * This code is free software; you can redistribute it and/or modify it
   33.10 @@ -25,28 +25,26 @@
   33.11  #include "precompiled.hpp"
   33.12  #include "gc_implementation/g1/heapRegionSet.inline.hpp"
   33.13  
   33.14 -size_t HeapRegionSetBase::_unrealistically_long_length = 0;
   33.15 +uint HeapRegionSetBase::_unrealistically_long_length = 0;
   33.16  HRSPhase HeapRegionSetBase::_phase = HRSPhaseNone;
   33.17  
   33.18  //////////////////// HeapRegionSetBase ////////////////////
   33.19  
   33.20 -void HeapRegionSetBase::set_unrealistically_long_length(size_t len) {
   33.21 +void HeapRegionSetBase::set_unrealistically_long_length(uint len) {
   33.22    guarantee(_unrealistically_long_length == 0, "should only be set once");
   33.23    _unrealistically_long_length = len;
   33.24  }
   33.25  
   33.26 -size_t HeapRegionSetBase::calculate_region_num(HeapRegion* hr) {
   33.27 +uint HeapRegionSetBase::calculate_region_num(HeapRegion* hr) {
   33.28    assert(hr->startsHumongous(), "pre-condition");
   33.29    assert(hr->capacity() % HeapRegion::GrainBytes == 0, "invariant");
   33.30 -  size_t region_num = hr->capacity() >> HeapRegion::LogOfHRGrainBytes;
   33.31 +  uint region_num = (uint) (hr->capacity() >> HeapRegion::LogOfHRGrainBytes);
   33.32    assert(region_num > 0, "sanity");
   33.33    return region_num;
   33.34  }
   33.35  
   33.36  void HeapRegionSetBase::fill_in_ext_msg(hrs_ext_msg* msg, const char* message) {
   33.37 -  msg->append("[%s] %s "
   33.38 -              "ln: "SIZE_FORMAT" rn: "SIZE_FORMAT" "
   33.39 -              "cy: "SIZE_FORMAT" ud: "SIZE_FORMAT,
   33.40 +  msg->append("[%s] %s ln: %u rn: %u cy: "SIZE_FORMAT" ud: "SIZE_FORMAT,
   33.41                name(), message, length(), region_num(),
   33.42                total_capacity_bytes(), total_used_bytes());
   33.43    fill_in_ext_msg_extra(msg);
   33.44 @@ -170,13 +168,11 @@
   33.45           hrs_ext_msg(this, "verification should be in progress"));
   33.46  
   33.47    guarantee(length() == _calc_length,
   33.48 -            hrs_err_msg("[%s] length: "SIZE_FORMAT" should be == "
   33.49 -                        "calc length: "SIZE_FORMAT,
   33.50 +            hrs_err_msg("[%s] length: %u should be == calc length: %u",
   33.51                          name(), length(), _calc_length));
   33.52  
   33.53    guarantee(region_num() == _calc_region_num,
   33.54 -            hrs_err_msg("[%s] region num: "SIZE_FORMAT" should be == "
   33.55 -                        "calc region num: "SIZE_FORMAT,
   33.56 +            hrs_err_msg("[%s] region num: %u should be == calc region num: %u",
   33.57                          name(), region_num(), _calc_region_num));
   33.58  
   33.59    guarantee(total_capacity_bytes() == _calc_total_capacity_bytes,
   33.60 @@ -211,8 +207,8 @@
   33.61    out->print_cr("    humongous         : %s", BOOL_TO_STR(regions_humongous()));
   33.62    out->print_cr("    empty             : %s", BOOL_TO_STR(regions_empty()));
   33.63    out->print_cr("  Attributes");
   33.64 -  out->print_cr("    length            : "SIZE_FORMAT_W(14), length());
   33.65 -  out->print_cr("    region num        : "SIZE_FORMAT_W(14), region_num());
   33.66 +  out->print_cr("    length            : %14u", length());
   33.67 +  out->print_cr("    region num        : %14u", region_num());
   33.68    out->print_cr("    total capacity    : "SIZE_FORMAT_W(14)" bytes",
   33.69                  total_capacity_bytes());
   33.70    out->print_cr("    total used        : "SIZE_FORMAT_W(14)" bytes",
   33.71 @@ -243,14 +239,12 @@
   33.72    if (proxy_set->is_empty()) return;
   33.73  
   33.74    assert(proxy_set->length() <= _length,
   33.75 -         hrs_err_msg("[%s] proxy set length: "SIZE_FORMAT" "
   33.76 -                     "should be <= length: "SIZE_FORMAT,
   33.77 +         hrs_err_msg("[%s] proxy set length: %u should be <= length: %u",
   33.78                       name(), proxy_set->length(), _length));
   33.79    _length -= proxy_set->length();
   33.80  
   33.81    assert(proxy_set->region_num() <= _region_num,
   33.82 -         hrs_err_msg("[%s] proxy set region num: "SIZE_FORMAT" "
   33.83 -                     "should be <= region num: "SIZE_FORMAT,
   33.84 +         hrs_err_msg("[%s] proxy set region num: %u should be <= region num: %u",
   33.85                       name(), proxy_set->region_num(), _region_num));
   33.86    _region_num -= proxy_set->region_num();
   33.87  
   33.88 @@ -369,17 +363,17 @@
   33.89    verify_optional();
   33.90  }
   33.91  
   33.92 -void HeapRegionLinkedList::remove_all_pending(size_t target_count) {
   33.93 +void HeapRegionLinkedList::remove_all_pending(uint target_count) {
   33.94    hrs_assert_mt_safety_ok(this);
   33.95    assert(target_count > 1, hrs_ext_msg(this, "pre-condition"));
   33.96    assert(!is_empty(), hrs_ext_msg(this, "pre-condition"));
   33.97  
   33.98    verify_optional();
   33.99 -  DEBUG_ONLY(size_t old_length = length();)
  33.100 +  DEBUG_ONLY(uint old_length = length();)
  33.101  
  33.102    HeapRegion* curr = _head;
  33.103    HeapRegion* prev = NULL;
  33.104 -  size_t count = 0;
  33.105 +  uint count = 0;
  33.106    while (curr != NULL) {
  33.107      hrs_assert_region_ok(this, curr, this);
  33.108      HeapRegion* next = curr->next();
  33.109 @@ -387,7 +381,7 @@
  33.110      if (curr->pending_removal()) {
  33.111        assert(count < target_count,
  33.112               hrs_err_msg("[%s] should not come across more regions "
  33.113 -                         "pending for removal than target_count: "SIZE_FORMAT,
  33.114 +                         "pending for removal than target_count: %u",
  33.115                           name(), target_count));
  33.116  
  33.117        if (prev == NULL) {
  33.118 @@ -422,12 +416,11 @@
  33.119    }
  33.120  
  33.121    assert(count == target_count,
  33.122 -         hrs_err_msg("[%s] count: "SIZE_FORMAT" should be == "
  33.123 -                     "target_count: "SIZE_FORMAT, name(), count, target_count));
  33.124 +         hrs_err_msg("[%s] count: %u should be == target_count: %u",
  33.125 +                     name(), count, target_count));
  33.126    assert(length() + target_count == old_length,
  33.127           hrs_err_msg("[%s] new length should be consistent "
  33.128 -                     "new length: "SIZE_FORMAT" old length: "SIZE_FORMAT" "
  33.129 -                     "target_count: "SIZE_FORMAT,
  33.130 +                     "new length: %u old length: %u target_count: %u",
  33.131                       name(), length(), old_length, target_count));
  33.132  
  33.133    verify_optional();
  33.134 @@ -444,16 +437,16 @@
  33.135    HeapRegion* curr  = _head;
  33.136    HeapRegion* prev1 = NULL;
  33.137    HeapRegion* prev0 = NULL;
  33.138 -  size_t      count = 0;
  33.139 +  uint        count = 0;
  33.140    while (curr != NULL) {
  33.141      verify_next_region(curr);
  33.142  
  33.143      count += 1;
  33.144      guarantee(count < _unrealistically_long_length,
  33.145 -              hrs_err_msg("[%s] the calculated length: "SIZE_FORMAT" "
  33.146 +              hrs_err_msg("[%s] the calculated length: %u "
  33.147                            "seems very long, is there maybe a cycle? "
  33.148                            "curr: "PTR_FORMAT" prev0: "PTR_FORMAT" "
  33.149 -                          "prev1: "PTR_FORMAT" length: "SIZE_FORMAT,
  33.150 +                          "prev1: "PTR_FORMAT" length: %u",
  33.151                            name(), count, curr, prev0, prev1, length()));
  33.152  
  33.153      prev1 = prev0;
    34.1 --- a/src/share/vm/gc_implementation/g1/heapRegionSet.hpp	Tue Mar 06 12:36:59 2012 +0100
    34.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionSet.hpp	Fri Apr 20 11:41:49 2012 -0700
    34.3 @@ -62,20 +62,20 @@
    34.4    friend class VMStructs;
    34.5  
    34.6  protected:
    34.7 -  static size_t calculate_region_num(HeapRegion* hr);
    34.8 +  static uint calculate_region_num(HeapRegion* hr);
    34.9  
   34.10 -  static size_t _unrealistically_long_length;
   34.11 +  static uint _unrealistically_long_length;
   34.12  
   34.13    // The number of regions added to the set. If the set contains
   34.14    // only humongous regions, this reflects only 'starts humongous'
   34.15    // regions and does not include 'continues humongous' ones.
   34.16 -  size_t _length;
   34.17 +  uint _length;
   34.18  
   34.19    // The total number of regions represented by the set. If the set
   34.20    // does not contain humongous regions, this should be the same as
   34.21    // _length. If the set contains only humongous regions, this will
   34.22    // include the 'continues humongous' regions.
   34.23 -  size_t _region_num;
   34.24 +  uint _region_num;
   34.25  
   34.26    // We don't keep track of the total capacity explicitly, we instead
   34.27    // recalculate it based on _region_num and the heap region size.
   34.28 @@ -86,8 +86,8 @@
   34.29    const char* _name;
   34.30  
   34.31    bool        _verify_in_progress;
   34.32 -  size_t      _calc_length;
   34.33 -  size_t      _calc_region_num;
   34.34 +  uint        _calc_length;
   34.35 +  uint        _calc_region_num;
   34.36    size_t      _calc_total_capacity_bytes;
   34.37    size_t      _calc_total_used_bytes;
   34.38  
   34.39 @@ -153,18 +153,18 @@
   34.40    HeapRegionSetBase(const char* name);
   34.41  
   34.42  public:
   34.43 -  static void set_unrealistically_long_length(size_t len);
   34.44 +  static void set_unrealistically_long_length(uint len);
   34.45  
   34.46    const char* name() { return _name; }
   34.47  
   34.48 -  size_t length() { return _length; }
   34.49 +  uint length() { return _length; }
   34.50  
   34.51    bool is_empty() { return _length == 0; }
   34.52  
   34.53 -  size_t region_num() { return _region_num; }
   34.54 +  uint region_num() { return _region_num; }
   34.55  
   34.56    size_t total_capacity_bytes() {
   34.57 -    return region_num() << HeapRegion::LogOfHRGrainBytes;
   34.58 +    return (size_t) region_num() << HeapRegion::LogOfHRGrainBytes;
   34.59    }
   34.60  
   34.61    size_t total_used_bytes() { return _total_used_bytes; }
   34.62 @@ -341,7 +341,7 @@
   34.63    // of regions that are pending for removal in the list, and
   34.64    // target_count should be > 1 (currently, we never need to remove a
   34.65    // single region using this).
   34.66 -  void remove_all_pending(size_t target_count);
   34.67 +  void remove_all_pending(uint target_count);
   34.68  
   34.69    virtual void verify();
   34.70  
    35.1 --- a/src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp	Tue Mar 06 12:36:59 2012 +0100
    35.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionSet.inline.hpp	Fri Apr 20 11:41:49 2012 -0700
    35.3 @@ -1,5 +1,5 @@
    35.4  /*
    35.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    35.6 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    35.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    35.8   *
    35.9   * This code is free software; you can redistribute it and/or modify it
   35.10 @@ -54,15 +54,15 @@
   35.11    assert(_length > 0, hrs_ext_msg(this, "pre-condition"));
   35.12    _length -= 1;
   35.13  
   35.14 -  size_t region_num_diff;
   35.15 +  uint region_num_diff;
   35.16    if (!hr->isHumongous()) {
   35.17      region_num_diff = 1;
   35.18    } else {
   35.19      region_num_diff = calculate_region_num(hr);
   35.20    }
   35.21    assert(region_num_diff <= _region_num,
   35.22 -         hrs_err_msg("[%s] region's region num: "SIZE_FORMAT" "
   35.23 -                     "should be <= region num: "SIZE_FORMAT,
   35.24 +         hrs_err_msg("[%s] region's region num: %u "
   35.25 +                     "should be <= region num: %u",
   35.26                       name(), region_num_diff, _region_num));
   35.27    _region_num -= region_num_diff;
   35.28  
    36.1 --- a/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Tue Mar 06 12:36:59 2012 +0100
    36.2 +++ b/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Fri Apr 20 11:41:49 2012 -0700
    36.3 @@ -1,5 +1,5 @@
    36.4  /*
    36.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    36.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
    36.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    36.8   *
    36.9   * This code is free software; you can redistribute it and/or modify it
   36.10 @@ -481,8 +481,7 @@
   36.11  
   36.12  bool SparsePRT::add_card(RegionIdx_t region_id, CardIdx_t card_index) {
   36.13  #if SPARSE_PRT_VERBOSE
   36.14 -  gclog_or_tty->print_cr("  Adding card %d from region %d to region "
   36.15 -                         SIZE_FORMAT" sparse.",
   36.16 +  gclog_or_tty->print_cr("  Adding card %d from region %d to region %u sparse.",
   36.17                           card_index, region_id, _hr->hrs_index());
   36.18  #endif
   36.19    if (_next->occupied_entries() * 2 > _next->capacity()) {
   36.20 @@ -534,7 +533,7 @@
   36.21    _next = new RSHashTable(last->capacity() * 2);
   36.22  
   36.23  #if SPARSE_PRT_VERBOSE
   36.24 -  gclog_or_tty->print_cr("  Expanded sparse table for "SIZE_FORMAT" to %d.",
   36.25 +  gclog_or_tty->print_cr("  Expanded sparse table for %u to %d.",
   36.26                           _hr->hrs_index(), _next->capacity());
   36.27  #endif
   36.28    for (size_t i = 0; i < last->capacity(); i++) {
    37.1 --- a/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp	Tue Mar 06 12:36:59 2012 +0100
    37.2 +++ b/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp	Fri Apr 20 11:41:49 2012 -0700
    37.3 @@ -34,7 +34,7 @@
    37.4    static_field(HeapRegion, GrainBytes, size_t)                                \
    37.5                                                                                \
    37.6    nonstatic_field(HeapRegionSeq,   _regions, HeapRegion**)                    \
    37.7 -  nonstatic_field(HeapRegionSeq,   _length,  size_t)                          \
    37.8 +  nonstatic_field(HeapRegionSeq,   _length,  uint)                            \
    37.9                                                                                \
   37.10    nonstatic_field(G1CollectedHeap, _hrs,                HeapRegionSeq)        \
   37.11    nonstatic_field(G1CollectedHeap, _g1_committed,       MemRegion)            \
   37.12 @@ -50,8 +50,8 @@
   37.13    nonstatic_field(G1MonitoringSupport, _old_committed,      size_t)           \
   37.14    nonstatic_field(G1MonitoringSupport, _old_used,           size_t)           \
   37.15                                                                                \
   37.16 -  nonstatic_field(HeapRegionSetBase,   _length,             size_t)           \
   37.17 -  nonstatic_field(HeapRegionSetBase,   _region_num,         size_t)           \
   37.18 +  nonstatic_field(HeapRegionSetBase,   _length,             uint)             \
   37.19 +  nonstatic_field(HeapRegionSetBase,   _region_num,         uint)             \
   37.20    nonstatic_field(HeapRegionSetBase,   _total_used_bytes,   size_t)           \
   37.21  
   37.22  
    38.1 --- a/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp	Tue Mar 06 12:36:59 2012 +0100
    38.2 +++ b/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp	Fri Apr 20 11:41:49 2012 -0700
    38.3 @@ -26,6 +26,7 @@
    38.4  #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
    38.5  #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
    38.6  #include "gc_implementation/g1/g1CollectorPolicy.hpp"
    38.7 +#include "gc_implementation/g1/g1Log.hpp"
    38.8  #include "gc_implementation/g1/vm_operations_g1.hpp"
    38.9  #include "gc_implementation/shared/isGCActiveMark.hpp"
   38.10  #include "gc_implementation/g1/vm_operations_g1.hpp"
   38.11 @@ -223,9 +224,9 @@
   38.12  }
   38.13  
   38.14  void VM_CGC_Operation::doit() {
   38.15 -  gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
   38.16 -  TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
   38.17 -  TraceTime t(_printGCMessage, PrintGC, true, gclog_or_tty);
   38.18 +  gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
   38.19 +  TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
   38.20 +  TraceTime t(_printGCMessage, G1Log::fine(), true, gclog_or_tty);
   38.21    SharedHeap* sh = SharedHeap::heap();
   38.22    // This could go away if CollectedHeap gave access to _gc_is_active...
   38.23    if (sh != NULL) {
    39.1 --- a/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp	Tue Mar 06 12:36:59 2012 +0100
    39.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp	Fri Apr 20 11:41:49 2012 -0700
    39.3 @@ -42,7 +42,7 @@
    39.4  
    39.5   protected:
    39.6    template <class T> void do_oop_work(T* p) {
    39.7 -    oop obj = oopDesc::load_decode_heap_oop_not_null(p);
    39.8 +    oop obj = oopDesc::load_decode_heap_oop(p);
    39.9      if (_young_gen->is_in_reserved(obj) &&
   39.10          !_card_table->addr_is_marked_imprecise(p)) {
   39.11        // Don't overwrite the first missing card mark
    40.1 --- a/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp	Tue Mar 06 12:36:59 2012 +0100
    40.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp	Fri Apr 20 11:41:49 2012 -0700
    40.3 @@ -911,23 +911,23 @@
    40.4  }
    40.5  
    40.6  
    40.7 -void ParallelScavengeHeap::verify(bool allow_dirty, bool silent, VerifyOption option /* ignored */) {
    40.8 +void ParallelScavengeHeap::verify(bool silent, VerifyOption option /* ignored */) {
    40.9    // Why do we need the total_collections()-filter below?
   40.10    if (total_collections() > 0) {
   40.11      if (!silent) {
   40.12        gclog_or_tty->print("permanent ");
   40.13      }
   40.14 -    perm_gen()->verify(allow_dirty);
   40.15 +    perm_gen()->verify();
   40.16  
   40.17      if (!silent) {
   40.18        gclog_or_tty->print("tenured ");
   40.19      }
   40.20 -    old_gen()->verify(allow_dirty);
   40.21 +    old_gen()->verify();
   40.22  
   40.23      if (!silent) {
   40.24        gclog_or_tty->print("eden ");
   40.25      }
   40.26 -    young_gen()->verify(allow_dirty);
   40.27 +    young_gen()->verify();
   40.28    }
   40.29  }
   40.30  
    41.1 --- a/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp	Tue Mar 06 12:36:59 2012 +0100
    41.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp	Fri Apr 20 11:41:49 2012 -0700
    41.3 @@ -257,7 +257,7 @@
    41.4    virtual void gc_threads_do(ThreadClosure* tc) const;
    41.5    virtual void print_tracing_info() const;
    41.6  
    41.7 -  void verify(bool allow_dirty, bool silent, VerifyOption option /* ignored */);
    41.8 +  void verify(bool silent, VerifyOption option /* ignored */);
    41.9  
   41.10    void print_heap_change(size_t prev_used);
   41.11  
    42.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp	Tue Mar 06 12:36:59 2012 +0100
    42.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp	Fri Apr 20 11:41:49 2012 -0700
    42.3 @@ -1,5 +1,5 @@
    42.4  /*
    42.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    42.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
    42.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    42.8   *
    42.9   * This code is free software; you can redistribute it and/or modify it
   42.10 @@ -477,8 +477,8 @@
   42.11  }
   42.12  #endif
   42.13  
   42.14 -void PSOldGen::verify(bool allow_dirty) {
   42.15 -  object_space()->verify(allow_dirty);
   42.16 +void PSOldGen::verify() {
   42.17 +  object_space()->verify();
   42.18  }
   42.19  class VerifyObjectStartArrayClosure : public ObjectClosure {
   42.20    PSOldGen* _gen;
    43.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp	Tue Mar 06 12:36:59 2012 +0100
    43.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp	Fri Apr 20 11:41:49 2012 -0700
    43.3 @@ -1,5 +1,5 @@
    43.4  /*
    43.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    43.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
    43.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    43.8   *
    43.9   * This code is free software; you can redistribute it and/or modify it
   43.10 @@ -174,7 +174,7 @@
   43.11    virtual void print_on(outputStream* st) const;
   43.12    void print_used_change(size_t prev_used) const;
   43.13  
   43.14 -  void verify(bool allow_dirty);
   43.15 +  void verify();
   43.16    void verify_object_start_array();
   43.17  
   43.18    // These should not used
    44.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Tue Mar 06 12:36:59 2012 +0100
    44.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Fri Apr 20 11:41:49 2012 -0700
    44.3 @@ -1,5 +1,5 @@
    44.4  /*
    44.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    44.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
    44.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44.8   *
    44.9   * This code is free software; you can redistribute it and/or modify it
   44.10 @@ -937,10 +937,10 @@
   44.11    }
   44.12  }
   44.13  
   44.14 -void PSYoungGen::verify(bool allow_dirty) {
   44.15 -  eden_space()->verify(allow_dirty);
   44.16 -  from_space()->verify(allow_dirty);
   44.17 -  to_space()->verify(allow_dirty);
   44.18 +void PSYoungGen::verify() {
   44.19 +  eden_space()->verify();
   44.20 +  from_space()->verify();
   44.21 +  to_space()->verify();
   44.22  }
   44.23  
   44.24  #ifndef PRODUCT
    45.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.hpp	Tue Mar 06 12:36:59 2012 +0100
    45.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.hpp	Fri Apr 20 11:41:49 2012 -0700
    45.3 @@ -1,5 +1,5 @@
    45.4  /*
    45.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    45.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
    45.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    45.8   *
    45.9   * This code is free software; you can redistribute it and/or modify it
   45.10 @@ -181,7 +181,7 @@
   45.11    void print_used_change(size_t prev_used) const;
   45.12    virtual const char* name() const { return "PSYoungGen"; }
   45.13  
   45.14 -  void verify(bool allow_dirty);
   45.15 +  void verify();
   45.16  
   45.17    // Space boundary invariant checker
   45.18    void space_invariants() PRODUCT_RETURN;
    46.1 --- a/src/share/vm/gc_implementation/shared/immutableSpace.cpp	Tue Mar 06 12:36:59 2012 +0100
    46.2 +++ b/src/share/vm/gc_implementation/shared/immutableSpace.cpp	Fri Apr 20 11:41:49 2012 -0700
    46.3 @@ -1,5 +1,5 @@
    46.4  /*
    46.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    46.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
    46.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    46.8   *
    46.9   * This code is free software; you can redistribute it and/or modify it
   46.10 @@ -70,7 +70,7 @@
   46.11  
   46.12  #endif
   46.13  
   46.14 -void ImmutableSpace::verify(bool allow_dirty) {
   46.15 +void ImmutableSpace::verify() {
   46.16    HeapWord* p = bottom();
   46.17    HeapWord* t = end();
   46.18    HeapWord* prev_p = NULL;
    47.1 --- a/src/share/vm/gc_implementation/shared/immutableSpace.hpp	Tue Mar 06 12:36:59 2012 +0100
    47.2 +++ b/src/share/vm/gc_implementation/shared/immutableSpace.hpp	Fri Apr 20 11:41:49 2012 -0700
    47.3 @@ -1,5 +1,5 @@
    47.4  /*
    47.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    47.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
    47.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    47.8   *
    47.9   * This code is free software; you can redistribute it and/or modify it
   47.10 @@ -65,7 +65,7 @@
   47.11    // Debugging
   47.12    virtual void print() const            PRODUCT_RETURN;
   47.13    virtual void print_short() const      PRODUCT_RETURN;
   47.14 -  virtual void verify(bool allow_dirty);
   47.15 +  virtual void verify();
   47.16  };
   47.17  
   47.18  #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_IMMUTABLESPACE_HPP
    48.1 --- a/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Tue Mar 06 12:36:59 2012 +0100
    48.2 +++ b/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Fri Apr 20 11:41:49 2012 -0700
    48.3 @@ -891,12 +891,12 @@
    48.4    }
    48.5  }
    48.6  
    48.7 -void MutableNUMASpace::verify(bool allow_dirty) {
    48.8 +void MutableNUMASpace::verify() {
    48.9    // This can be called after setting an arbitary value to the space's top,
   48.10    // so an object can cross the chunk boundary. We ensure the parsablity
   48.11    // of the space and just walk the objects in linear fashion.
   48.12    ensure_parsability();
   48.13 -  MutableSpace::verify(allow_dirty);
   48.14 +  MutableSpace::verify();
   48.15  }
   48.16  
   48.17  // Scan pages and gather stats about page placement and size.
    49.1 --- a/src/share/vm/gc_implementation/shared/mutableNUMASpace.hpp	Tue Mar 06 12:36:59 2012 +0100
    49.2 +++ b/src/share/vm/gc_implementation/shared/mutableNUMASpace.hpp	Fri Apr 20 11:41:49 2012 -0700
    49.3 @@ -1,5 +1,5 @@
    49.4  /*
    49.5 - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    49.6 + * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
    49.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    49.8   *
    49.9   * This code is free software; you can redistribute it and/or modify it
   49.10 @@ -225,7 +225,7 @@
   49.11    // Debugging
   49.12    virtual void print_on(outputStream* st) const;
   49.13    virtual void print_short_on(outputStream* st) const;
   49.14 -  virtual void verify(bool allow_dirty);
   49.15 +  virtual void verify();
   49.16  
   49.17    virtual void set_top(HeapWord* value);
   49.18  };
    50.1 --- a/src/share/vm/gc_implementation/shared/mutableSpace.cpp	Tue Mar 06 12:36:59 2012 +0100
    50.2 +++ b/src/share/vm/gc_implementation/shared/mutableSpace.cpp	Fri Apr 20 11:41:49 2012 -0700
    50.3 @@ -1,5 +1,5 @@
    50.4  /*
    50.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    50.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
    50.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    50.8   *
    50.9   * This code is free software; you can redistribute it and/or modify it
   50.10 @@ -246,7 +246,7 @@
   50.11                   bottom(), top(), end());
   50.12  }
   50.13  
   50.14 -void MutableSpace::verify(bool allow_dirty) {
   50.15 +void MutableSpace::verify() {
   50.16    HeapWord* p = bottom();
   50.17    HeapWord* t = top();
   50.18    HeapWord* prev_p = NULL;
    51.1 --- a/src/share/vm/gc_implementation/shared/mutableSpace.hpp	Tue Mar 06 12:36:59 2012 +0100
    51.2 +++ b/src/share/vm/gc_implementation/shared/mutableSpace.hpp	Fri Apr 20 11:41:49 2012 -0700
    51.3 @@ -1,5 +1,5 @@
    51.4  /*
    51.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    51.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
    51.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    51.8   *
    51.9   * This code is free software; you can redistribute it and/or modify it
   51.10 @@ -141,7 +141,7 @@
   51.11    virtual void print_on(outputStream* st) const;
   51.12    virtual void print_short() const;
   51.13    virtual void print_short_on(outputStream* st) const;
   51.14 -  virtual void verify(bool allow_dirty);
   51.15 +  virtual void verify();
   51.16  };
   51.17  
   51.18  #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_MUTABLESPACE_HPP
    52.1 --- a/src/share/vm/gc_interface/collectedHeap.hpp	Tue Mar 06 12:36:59 2012 +0100
    52.2 +++ b/src/share/vm/gc_interface/collectedHeap.hpp	Fri Apr 20 11:41:49 2012 -0700
    52.3 @@ -659,7 +659,7 @@
    52.4    }
    52.5  
    52.6    // Heap verification
    52.7 -  virtual void verify(bool allow_dirty, bool silent, VerifyOption option) = 0;
    52.8 +  virtual void verify(bool silent, VerifyOption option) = 0;
    52.9  
   52.10    // Non product verification and debugging.
   52.11  #ifndef PRODUCT
    53.1 --- a/src/share/vm/memory/compactingPermGenGen.cpp	Tue Mar 06 12:36:59 2012 +0100
    53.2 +++ b/src/share/vm/memory/compactingPermGenGen.cpp	Fri Apr 20 11:41:49 2012 -0700
    53.3 @@ -444,11 +444,11 @@
    53.4  }
    53.5  
    53.6  
    53.7 -void CompactingPermGenGen::verify(bool allow_dirty) {
    53.8 -  the_space()->verify(allow_dirty);
    53.9 +void CompactingPermGenGen::verify() {
   53.10 +  the_space()->verify();
   53.11    if (!SharedSkipVerify && spec()->enable_shared_spaces()) {
   53.12 -    ro_space()->verify(allow_dirty);
   53.13 -    rw_space()->verify(allow_dirty);
   53.14 +    ro_space()->verify();
   53.15 +    rw_space()->verify();
   53.16    }
   53.17  }
   53.18  
    54.1 --- a/src/share/vm/memory/compactingPermGenGen.hpp	Tue Mar 06 12:36:59 2012 +0100
    54.2 +++ b/src/share/vm/memory/compactingPermGenGen.hpp	Fri Apr 20 11:41:49 2012 -0700
    54.3 @@ -1,5 +1,5 @@
    54.4  /*
    54.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    54.6 + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
    54.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.8   *
    54.9   * This code is free software; you can redistribute it and/or modify it
   54.10 @@ -230,7 +230,7 @@
   54.11                                        void* new_vtable_start,
   54.12                                        void* obj);
   54.13  
   54.14 -  void verify(bool allow_dirty);
   54.15 +  void verify();
   54.16  
   54.17    // Serialization
   54.18    static void initialize_oops() KERNEL_RETURN;
    55.1 --- a/src/share/vm/memory/defNewGeneration.cpp	Tue Mar 06 12:36:59 2012 +0100
    55.2 +++ b/src/share/vm/memory/defNewGeneration.cpp	Fri Apr 20 11:41:49 2012 -0700
    55.3 @@ -939,10 +939,10 @@
    55.4    }
    55.5  }
    55.6  
    55.7 -void DefNewGeneration::verify(bool allow_dirty) {
    55.8 -  eden()->verify(allow_dirty);
    55.9 -  from()->verify(allow_dirty);
   55.10 -    to()->verify(allow_dirty);
   55.11 +void DefNewGeneration::verify() {
   55.12 +  eden()->verify();
   55.13 +  from()->verify();
   55.14 +    to()->verify();
   55.15  }
   55.16  
   55.17  void DefNewGeneration::print_on(outputStream* st) const {
    56.1 --- a/src/share/vm/memory/defNewGeneration.hpp	Tue Mar 06 12:36:59 2012 +0100
    56.2 +++ b/src/share/vm/memory/defNewGeneration.hpp	Fri Apr 20 11:41:49 2012 -0700
    56.3 @@ -1,5 +1,5 @@
    56.4  /*
    56.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    56.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
    56.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    56.8   *
    56.9   * This code is free software; you can redistribute it and/or modify it
   56.10 @@ -340,7 +340,7 @@
   56.11    // PrintHeapAtGC support.
   56.12    void print_on(outputStream* st) const;
   56.13  
   56.14 -  void verify(bool allow_dirty);
   56.15 +  void verify();
   56.16  
   56.17    bool promo_failure_scan_is_complete() const {
   56.18      return _promo_failure_scan_stack.is_empty();
    57.1 --- a/src/share/vm/memory/genCollectedHeap.cpp	Tue Mar 06 12:36:59 2012 +0100
    57.2 +++ b/src/share/vm/memory/genCollectedHeap.cpp	Fri Apr 20 11:41:49 2012 -0700
    57.3 @@ -1247,18 +1247,18 @@
    57.4    return _gens[level]->gc_stats();
    57.5  }
    57.6  
    57.7 -void GenCollectedHeap::verify(bool allow_dirty, bool silent, VerifyOption option /* ignored */) {
    57.8 +void GenCollectedHeap::verify(bool silent, VerifyOption option /* ignored */) {
    57.9    if (!silent) {
   57.10      gclog_or_tty->print("permgen ");
   57.11    }
   57.12 -  perm_gen()->verify(allow_dirty);
   57.13 +  perm_gen()->verify();
   57.14    for (int i = _n_gens-1; i >= 0; i--) {
   57.15      Generation* g = _gens[i];
   57.16      if (!silent) {
   57.17        gclog_or_tty->print(g->name());
   57.18        gclog_or_tty->print(" ");
   57.19      }
   57.20 -    g->verify(allow_dirty);
   57.21 +    g->verify();
   57.22    }
   57.23    if (!silent) {
   57.24      gclog_or_tty->print("remset ");
    58.1 --- a/src/share/vm/memory/genCollectedHeap.hpp	Tue Mar 06 12:36:59 2012 +0100
    58.2 +++ b/src/share/vm/memory/genCollectedHeap.hpp	Fri Apr 20 11:41:49 2012 -0700
    58.3 @@ -1,5 +1,5 @@
    58.4  /*
    58.5 - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    58.6 + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
    58.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    58.8   *
    58.9   * This code is free software; you can redistribute it and/or modify it
   58.10 @@ -357,7 +357,7 @@
   58.11    void prepare_for_verify();
   58.12  
   58.13    // Override.
   58.14 -  void verify(bool allow_dirty, bool silent, VerifyOption option);
   58.15 +  void verify(bool silent, VerifyOption option);
   58.16  
   58.17    // Override.
   58.18    virtual void print_on(outputStream* st) const;
    59.1 --- a/src/share/vm/memory/generation.cpp	Tue Mar 06 12:36:59 2012 +0100
    59.2 +++ b/src/share/vm/memory/generation.cpp	Fri Apr 20 11:41:49 2012 -0700
    59.3 @@ -1,5 +1,5 @@
    59.4  /*
    59.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    59.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    59.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    59.8   *
    59.9   * This code is free software; you can redistribute it and/or modify it
   59.10 @@ -696,8 +696,8 @@
   59.11    the_space()->set_top_for_allocations();
   59.12  }
   59.13  
   59.14 -void OneContigSpaceCardGeneration::verify(bool allow_dirty) {
   59.15 -  the_space()->verify(allow_dirty);
   59.16 +void OneContigSpaceCardGeneration::verify() {
   59.17 +  the_space()->verify();
   59.18  }
   59.19  
   59.20  void OneContigSpaceCardGeneration::print_on(outputStream* st)  const {
    60.1 --- a/src/share/vm/memory/generation.hpp	Tue Mar 06 12:36:59 2012 +0100
    60.2 +++ b/src/share/vm/memory/generation.hpp	Fri Apr 20 11:41:49 2012 -0700
    60.3 @@ -1,5 +1,5 @@
    60.4  /*
    60.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    60.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    60.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    60.8   *
    60.9   * This code is free software; you can redistribute it and/or modify it
   60.10 @@ -599,7 +599,7 @@
   60.11    virtual void print() const;
   60.12    virtual void print_on(outputStream* st) const;
   60.13  
   60.14 -  virtual void verify(bool allow_dirty) = 0;
   60.15 +  virtual void verify() = 0;
   60.16  
   60.17    struct StatRecord {
   60.18      int invocations;
   60.19 @@ -753,7 +753,7 @@
   60.20  
   60.21    virtual void record_spaces_top();
   60.22  
   60.23 -  virtual void verify(bool allow_dirty);
   60.24 +  virtual void verify();
   60.25    virtual void print_on(outputStream* st) const;
   60.26  };
   60.27  
    61.1 --- a/src/share/vm/memory/space.cpp	Tue Mar 06 12:36:59 2012 +0100
    61.2 +++ b/src/share/vm/memory/space.cpp	Fri Apr 20 11:41:49 2012 -0700
    61.3 @@ -1,5 +1,5 @@
    61.4  /*
    61.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    61.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    61.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    61.8   *
    61.9   * This code is free software; you can redistribute it and/or modify it
   61.10 @@ -531,7 +531,7 @@
   61.11                bottom(), top(), _offsets.threshold(), end());
   61.12  }
   61.13  
   61.14 -void ContiguousSpace::verify(bool allow_dirty) const {
   61.15 +void ContiguousSpace::verify() const {
   61.16    HeapWord* p = bottom();
   61.17    HeapWord* t = top();
   61.18    HeapWord* prev_p = NULL;
   61.19 @@ -965,27 +965,12 @@
   61.20    initialize(mr, SpaceDecorator::Clear, SpaceDecorator::Mangle);
   61.21  }
   61.22  
   61.23 -
   61.24 -class VerifyOldOopClosure : public OopClosure {
   61.25 - public:
   61.26 -  oop  _the_obj;
   61.27 -  bool _allow_dirty;
   61.28 -  void do_oop(oop* p) {
   61.29 -    _the_obj->verify_old_oop(p, _allow_dirty);
   61.30 -  }
   61.31 -  void do_oop(narrowOop* p) {
   61.32 -    _the_obj->verify_old_oop(p, _allow_dirty);
   61.33 -  }
   61.34 -};
   61.35 -
   61.36  #define OBJ_SAMPLE_INTERVAL 0
   61.37  #define BLOCK_SAMPLE_INTERVAL 100
   61.38  
   61.39 -void OffsetTableContigSpace::verify(bool allow_dirty) const {
   61.40 +void OffsetTableContigSpace::verify() const {
   61.41    HeapWord* p = bottom();
   61.42    HeapWord* prev_p = NULL;
   61.43 -  VerifyOldOopClosure blk;      // Does this do anything?
   61.44 -  blk._allow_dirty = allow_dirty;
   61.45    int objs = 0;
   61.46    int blocks = 0;
   61.47  
   61.48 @@ -1007,8 +992,6 @@
   61.49  
   61.50      if (objs == OBJ_SAMPLE_INTERVAL) {
   61.51        oop(p)->verify();
   61.52 -      blk._the_obj = oop(p);
   61.53 -      oop(p)->oop_iterate(&blk);
   61.54        objs = 0;
   61.55      } else {
   61.56        objs++;
    62.1 --- a/src/share/vm/memory/space.hpp	Tue Mar 06 12:36:59 2012 +0100
    62.2 +++ b/src/share/vm/memory/space.hpp	Fri Apr 20 11:41:49 2012 -0700
    62.3 @@ -1,5 +1,5 @@
    62.4  /*
    62.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    62.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    62.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    62.8   *
    62.9   * This code is free software; you can redistribute it and/or modify it
   62.10 @@ -306,7 +306,7 @@
   62.11    }
   62.12  
   62.13    // Debugging
   62.14 -  virtual void verify(bool allow_dirty) const = 0;
   62.15 +  virtual void verify() const = 0;
   62.16  };
   62.17  
   62.18  // A MemRegionClosure (ResourceObj) whose "do_MemRegion" function applies an
   62.19 @@ -948,7 +948,7 @@
   62.20    }
   62.21  
   62.22    // Debugging
   62.23 -  virtual void verify(bool allow_dirty) const;
   62.24 +  virtual void verify() const;
   62.25  
   62.26    // Used to increase collection frequency.  "factor" of 0 means entire
   62.27    // space.
   62.28 @@ -1100,7 +1100,7 @@
   62.29    virtual void print_on(outputStream* st) const;
   62.30  
   62.31    // Debugging
   62.32 -  void verify(bool allow_dirty) const;
   62.33 +  void verify() const;
   62.34  
   62.35    // Shared space support
   62.36    void serialize_block_offset_array_offsets(SerializeOopClosure* soc);
    63.1 --- a/src/share/vm/memory/universe.cpp	Tue Mar 06 12:36:59 2012 +0100
    63.2 +++ b/src/share/vm/memory/universe.cpp	Fri Apr 20 11:41:49 2012 -0700
    63.3 @@ -1,5 +1,5 @@
    63.4  /*
    63.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    63.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    63.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    63.8   *
    63.9   * This code is free software; you can redistribute it and/or modify it
   63.10 @@ -1326,7 +1326,7 @@
   63.11    st->print_cr("}");
   63.12  }
   63.13  
   63.14 -void Universe::verify(bool allow_dirty, bool silent, VerifyOption option) {
   63.15 +void Universe::verify(bool silent, VerifyOption option) {
   63.16    if (SharedSkipVerify) {
   63.17      return;
   63.18    }
   63.19 @@ -1350,7 +1350,7 @@
   63.20    if (!silent) gclog_or_tty->print("[Verifying ");
   63.21    if (!silent) gclog_or_tty->print("threads ");
   63.22    Threads::verify();
   63.23 -  heap()->verify(allow_dirty, silent, option);
   63.24 +  heap()->verify(silent, option);
   63.25  
   63.26    if (!silent) gclog_or_tty->print("syms ");
   63.27    SymbolTable::verify();
    64.1 --- a/src/share/vm/memory/universe.hpp	Tue Mar 06 12:36:59 2012 +0100
    64.2 +++ b/src/share/vm/memory/universe.hpp	Fri Apr 20 11:41:49 2012 -0700
    64.3 @@ -1,5 +1,5 @@
    64.4  /*
    64.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    64.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    64.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    64.8   *
    64.9   * This code is free software; you can redistribute it and/or modify it
   64.10 @@ -412,7 +412,7 @@
   64.11  
   64.12    // Debugging
   64.13    static bool verify_in_progress() { return _verify_in_progress; }
   64.14 -  static void verify(bool allow_dirty = true, bool silent = false,
   64.15 +  static void verify(bool silent = false,
   64.16                       VerifyOption option = VerifyOption_Default );
   64.17    static int  verify_count()       { return _verify_count; }
   64.18    // The default behavior is to call print_on() on gclog_or_tty.
    65.1 --- a/src/share/vm/oops/instanceRefKlass.cpp	Tue Mar 06 12:36:59 2012 +0100
    65.2 +++ b/src/share/vm/oops/instanceRefKlass.cpp	Fri Apr 20 11:41:49 2012 -0700
    65.3 @@ -1,5 +1,5 @@
    65.4  /*
    65.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    65.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    65.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    65.8   *
    65.9   * This code is free software; you can redistribute it and/or modify it
   65.10 @@ -497,36 +497,12 @@
   65.11  
   65.12    if (referent != NULL) {
   65.13      guarantee(referent->is_oop(), "referent field heap failed");
   65.14 -    if (gch != NULL && !gch->is_in_young(obj)) {
   65.15 -      // We do a specific remembered set check here since the referent
   65.16 -      // field is not part of the oop mask and therefore skipped by the
   65.17 -      // regular verify code.
   65.18 -      if (UseCompressedOops) {
   65.19 -        narrowOop* referent_addr = (narrowOop*)java_lang_ref_Reference::referent_addr(obj);
   65.20 -        obj->verify_old_oop(referent_addr, true);
   65.21 -      } else {
   65.22 -        oop* referent_addr = (oop*)java_lang_ref_Reference::referent_addr(obj);
   65.23 -        obj->verify_old_oop(referent_addr, true);
   65.24 -      }
   65.25 -    }
   65.26    }
   65.27    // Verify next field
   65.28    oop next = java_lang_ref_Reference::next(obj);
   65.29    if (next != NULL) {
   65.30      guarantee(next->is_oop(), "next field verify failed");
   65.31      guarantee(next->is_instanceRef(), "next field verify failed");
   65.32 -    if (gch != NULL && !gch->is_in_young(obj)) {
   65.33 -      // We do a specific remembered set check here since the next field is
   65.34 -      // not part of the oop mask and therefore skipped by the regular
   65.35 -      // verify code.
   65.36 -      if (UseCompressedOops) {
   65.37 -        narrowOop* next_addr = (narrowOop*)java_lang_ref_Reference::next_addr(obj);
   65.38 -        obj->verify_old_oop(next_addr, true);
   65.39 -      } else {
   65.40 -        oop* next_addr = (oop*)java_lang_ref_Reference::next_addr(obj);
   65.41 -        obj->verify_old_oop(next_addr, true);
   65.42 -      }
   65.43 -    }
   65.44    }
   65.45  }
   65.46  
    66.1 --- a/src/share/vm/oops/klass.cpp	Tue Mar 06 12:36:59 2012 +0100
    66.2 +++ b/src/share/vm/oops/klass.cpp	Fri Apr 20 11:41:49 2012 -0700
    66.3 @@ -581,14 +581,6 @@
    66.4    guarantee(obj->klass()->is_klass(), "klass field is not a klass");
    66.5  }
    66.6  
    66.7 -
    66.8 -void Klass::oop_verify_old_oop(oop obj, oop* p, bool allow_dirty) {
    66.9 -  /* $$$ I think this functionality should be handled by verification of
   66.10 -  RememberedSet::verify_old_oop(obj, p, allow_dirty, false);
   66.11 -  the card table. */
   66.12 -}
   66.13 -void Klass::oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty) { }
   66.14 -
   66.15  #ifndef PRODUCT
   66.16  
   66.17  void Klass::verify_vtable_index(int i) {
    67.1 --- a/src/share/vm/oops/klass.hpp	Tue Mar 06 12:36:59 2012 +0100
    67.2 +++ b/src/share/vm/oops/klass.hpp	Fri Apr 20 11:41:49 2012 -0700
    67.3 @@ -805,8 +805,6 @@
    67.4    // Verification
    67.5    virtual const char* internal_name() const = 0;
    67.6    virtual void oop_verify_on(oop obj, outputStream* st);
    67.7 -  virtual void oop_verify_old_oop(oop obj, oop* p, bool allow_dirty);
    67.8 -  virtual void oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty);
    67.9    // tells whether obj is partially constructed (gc during class loading)
   67.10    virtual bool oop_partially_loaded(oop obj) const { return false; }
   67.11    virtual void oop_set_partially_loaded(oop obj) {};
    68.1 --- a/src/share/vm/oops/objArrayKlass.cpp	Tue Mar 06 12:36:59 2012 +0100
    68.2 +++ b/src/share/vm/oops/objArrayKlass.cpp	Fri Apr 20 11:41:49 2012 -0700
    68.3 @@ -545,10 +545,3 @@
    68.4      guarantee(oa->obj_at(index)->is_oop_or_null(), "should be oop");
    68.5    }
    68.6  }
    68.7 -
    68.8 -void objArrayKlass::oop_verify_old_oop(oop obj, oop* p, bool allow_dirty) {
    68.9 -  /* $$$ move into remembered set verification?
   68.10 -  RememberedSet::verify_old_oop(obj, p, allow_dirty, true);
   68.11 -  */
   68.12 -}
   68.13 -void objArrayKlass::oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty) {}
    69.1 --- a/src/share/vm/oops/objArrayKlass.hpp	Tue Mar 06 12:36:59 2012 +0100
    69.2 +++ b/src/share/vm/oops/objArrayKlass.hpp	Fri Apr 20 11:41:49 2012 -0700
    69.3 @@ -1,5 +1,5 @@
    69.4  /*
    69.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    69.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    69.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    69.8   *
    69.9   * This code is free software; you can redistribute it and/or modify it
   69.10 @@ -144,8 +144,6 @@
   69.11    // Verification
   69.12    const char* internal_name() const;
   69.13    void oop_verify_on(oop obj, outputStream* st);
   69.14 -  void oop_verify_old_oop(oop obj, oop* p, bool allow_dirty);
   69.15 -  void oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty);
   69.16  };
   69.17  
   69.18  #endif // SHARE_VM_OOPS_OBJARRAYKLASS_HPP
    70.1 --- a/src/share/vm/oops/oop.cpp	Tue Mar 06 12:36:59 2012 +0100
    70.2 +++ b/src/share/vm/oops/oop.cpp	Fri Apr 20 11:41:49 2012 -0700
    70.3 @@ -1,5 +1,5 @@
    70.4  /*
    70.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    70.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    70.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    70.8   *
    70.9   * This code is free software; you can redistribute it and/or modify it
   70.10 @@ -107,16 +107,6 @@
   70.11    verify_on(tty);
   70.12  }
   70.13  
   70.14 -
   70.15 -// XXX verify_old_oop doesn't do anything (should we remove?)
   70.16 -void oopDesc::verify_old_oop(oop* p, bool allow_dirty) {
   70.17 -  blueprint()->oop_verify_old_oop(this, p, allow_dirty);
   70.18 -}
   70.19 -
   70.20 -void oopDesc::verify_old_oop(narrowOop* p, bool allow_dirty) {
   70.21 -  blueprint()->oop_verify_old_oop(this, p, allow_dirty);
   70.22 -}
   70.23 -
   70.24  bool oopDesc::partially_loaded() {
   70.25    return blueprint()->oop_partially_loaded(this);
   70.26  }
    71.1 --- a/src/share/vm/oops/oop.hpp	Tue Mar 06 12:36:59 2012 +0100
    71.2 +++ b/src/share/vm/oops/oop.hpp	Fri Apr 20 11:41:49 2012 -0700
    71.3 @@ -1,5 +1,5 @@
    71.4  /*
    71.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    71.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    71.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    71.8   *
    71.9   * This code is free software; you can redistribute it and/or modify it
   71.10 @@ -293,8 +293,6 @@
   71.11    // verification operations
   71.12    void verify_on(outputStream* st);
   71.13    void verify();
   71.14 -  void verify_old_oop(oop* p, bool allow_dirty);
   71.15 -  void verify_old_oop(narrowOop* p, bool allow_dirty);
   71.16  
   71.17    // tells whether this oop is partially constructed (gc during class loading)
   71.18    bool partially_loaded();
    72.1 --- a/src/share/vm/runtime/vmThread.cpp	Tue Mar 06 12:36:59 2012 +0100
    72.2 +++ b/src/share/vm/runtime/vmThread.cpp	Fri Apr 20 11:41:49 2012 -0700
    72.3 @@ -1,5 +1,5 @@
    72.4  /*
    72.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    72.6 + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
    72.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    72.8   *
    72.9   * This code is free software; you can redistribute it and/or modify it
   72.10 @@ -304,7 +304,7 @@
   72.11      os::check_heap();
   72.12      // Silent verification so as not to pollute normal output,
   72.13      // unless we really asked for it.
   72.14 -    Universe::verify(true, !(PrintGCDetails || Verbose));
   72.15 +    Universe::verify(!(PrintGCDetails || Verbose));
   72.16    }
   72.17  
   72.18    CompileBroker::set_should_block();

mercurial