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

Split Close
Expand all
Collapse all
          --- old/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
          +++ new/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
↓ open down ↓ 544 lines elided ↑ open up ↑
 545  545    }
 546  546  
 547  547    if (G1ConcRegionFreeingVerbose) {
 548  548      gclog_or_tty->print_cr("G1ConcRegionFreeing [region alloc] : "
 549  549                             "could not allocate from secondary_free_list");
 550  550    }
 551  551    return NULL;
 552  552  }
 553  553  
 554  554  HeapRegion* G1CollectedHeap::new_region(size_t word_size, bool do_expand) {
 555      -  assert(!isHumongous(word_size) ||
 556      -                                  word_size <= (size_t) HeapRegion::GrainWords,
      555 +  assert(!isHumongous(word_size) || word_size <= HeapRegion::GrainWords,
 557  556           "the only time we use this to allocate a humongous region is "
 558  557           "when we are allocating a single humongous region");
 559  558  
 560  559    HeapRegion* res;
 561  560    if (G1StressConcRegionFreeing) {
 562  561      if (!_secondary_free_list.is_empty()) {
 563  562        if (G1ConcRegionFreeingVerbose) {
 564  563          gclog_or_tty->print_cr("G1ConcRegionFreeing [region alloc] : "
 565  564                                 "forced to look at the secondary_free_list");
 566  565        }
↓ open down ↓ 596 lines elided ↑ open up ↑
1163 1162  private:
1164 1163    G1HRPrinter* _hr_printer;
1165 1164  public:
1166 1165    bool doHeapRegion(HeapRegion* hr) {
1167 1166      assert(!hr->is_young(), "not expecting to find young regions");
1168 1167      // We only generate output for non-empty regions.
1169 1168      if (!hr->is_empty()) {
1170 1169        if (!hr->isHumongous()) {
1171 1170          _hr_printer->post_compaction(hr, G1HRPrinter::Old);
1172 1171        } else if (hr->startsHumongous()) {
1173      -        if (hr->capacity() == (size_t) HeapRegion::GrainBytes) {
     1172 +        if (hr->capacity() == HeapRegion::GrainBytes) {
1174 1173            // single humongous region
1175 1174            _hr_printer->post_compaction(hr, G1HRPrinter::SingleHumongous);
1176 1175          } else {
1177 1176            _hr_printer->post_compaction(hr, G1HRPrinter::StartsHumongous);
1178 1177          }
1179 1178        } else {
1180 1179          assert(hr->continuesHumongous(), "only way to get here");
1181 1180          _hr_printer->post_compaction(hr, G1HRPrinter::ContinuesHumongous);
1182 1181        }
1183 1182      }
↓ open down ↓ 780 lines elided ↑ open up ↑
1964 1963                    (HeapWord*) _g1_reserved.end(),
1965 1964                    _expansion_regions);
1966 1965  
1967 1966    // 6843694 - ensure that the maximum region index can fit
1968 1967    // in the remembered set structures.
1969 1968    const size_t max_region_idx = ((size_t)1 << (sizeof(RegionIdx_t)*BitsPerByte-1)) - 1;
1970 1969    guarantee((max_regions() - 1) <= max_region_idx, "too many regions");
1971 1970  
1972 1971    size_t max_cards_per_region = ((size_t)1 << (sizeof(CardIdx_t)*BitsPerByte-1)) - 1;
1973 1972    guarantee(HeapRegion::CardsPerRegion > 0, "make sure it's initialized");
1974      -  guarantee((size_t) HeapRegion::CardsPerRegion < max_cards_per_region,
     1973 +  guarantee(HeapRegion::CardsPerRegion < max_cards_per_region,
1975 1974              "too many cards per region");
1976 1975  
1977 1976    HeapRegionSet::set_unrealistically_long_length(max_regions() + 1);
1978 1977  
1979 1978    _bot_shared = new G1BlockOffsetSharedArray(_reserved,
1980 1979                                               heap_word_size(init_byte_size));
1981 1980  
1982 1981    _g1h = this;
1983 1982  
1984 1983     _in_cset_fast_test_length = max_regions();
↓ open down ↓ 1059 lines elided ↑ open up ↑
3044 3043  
3045 3044  void G1CollectedHeap::print_on(outputStream* st, bool extended) const {
3046 3045    st->print(" %-20s", "garbage-first heap");
3047 3046    st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
3048 3047              capacity()/K, used_unlocked()/K);
3049 3048    st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")",
3050 3049              _g1_storage.low_boundary(),
3051 3050              _g1_storage.high(),
3052 3051              _g1_storage.high_boundary());
3053 3052    st->cr();
3054      -  st->print("  region size " SIZE_FORMAT "K, ",
3055      -            HeapRegion::GrainBytes/K);
     3053 +  st->print("  region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K);
3056 3054    size_t young_regions = _young_list->length();
3057 3055    st->print(SIZE_FORMAT " young (" SIZE_FORMAT "K), ",
3058 3056              young_regions, young_regions * HeapRegion::GrainBytes / K);
3059 3057    size_t survivor_regions = g1_policy()->recorded_survivor_regions();
3060 3058    st->print(SIZE_FORMAT " survivors (" SIZE_FORMAT "K)",
3061 3059              survivor_regions, survivor_regions * HeapRegion::GrainBytes / K);
3062 3060    st->cr();
3063 3061    perm()->as_gen()->print_on(st);
3064 3062    if (extended) {
3065 3063      st->cr();
↓ open down ↓ 2938 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX