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/heapRegion.hpp
          +++ new/src/share/vm/gc_implementation/g1/heapRegion.hpp
↓ open down ↓ 338 lines elided ↑ open up ↑
 339  339    // The predicted number of bytes to copy that was added to
 340  340    // the total value for the collection set.
 341  341    size_t _predicted_bytes_to_copy;
 342  342  
 343  343   public:
 344  344    // If "is_zeroed" is "true", the region "mr" can be assumed to contain zeros.
 345  345    HeapRegion(size_t hrs_index,
 346  346               G1BlockOffsetSharedArray* sharedOffsetArray,
 347  347               MemRegion mr, bool is_zeroed);
 348  348  
 349      -  static int LogOfHRGrainBytes;
 350      -  static int LogOfHRGrainWords;
 351      -  // The normal type of these should be size_t. However, they used to
 352      -  // be members of an enum before and they are assumed by the
 353      -  // compilers to be ints. To avoid going and fixing all their uses,
 354      -  // I'm declaring them as ints. I'm not anticipating heap region
 355      -  // sizes to reach anywhere near 2g, so using an int here is safe.
 356      -  static int GrainBytes;
 357      -  static int GrainWords;
 358      -  static int CardsPerRegion;
      349 +  static int    LogOfHRGrainBytes;
      350 +  static int    LogOfHRGrainWords;
      351 +
      352 +  static size_t GrainBytes;
      353 +  static size_t GrainWords;
      354 +  static size_t CardsPerRegion;
 359  355  
 360  356    static size_t align_up_to_region_byte_size(size_t sz) {
 361  357      return (sz + (size_t) GrainBytes - 1) &
 362  358                                        ~((1 << (size_t) LogOfHRGrainBytes) - 1);
 363  359    }
 364  360  
 365  361    // It sets up the heap region size (GrainBytes / GrainWords), as
 366  362    // well as other related fields that are based on the heap region
 367  363    // size (LogOfHRGrainBytes / LogOfHRGrainWords /
 368  364    // CardsPerRegion). All those fields are considered constant
↓ open down ↓ 480 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX