src/share/vm/gc_implementation/g1/heapRegion.hpp

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:


 331   // The RSet length that was added to the total value
 332   // for the collection set.
 333   size_t _recorded_rs_length;
 334 
 335   // The predicted elapsed time that was added to total value
 336   // for the collection set.
 337   double _predicted_elapsed_time_ms;
 338 
 339   // The predicted number of bytes to copy that was added to
 340   // the total value for the collection set.
 341   size_t _predicted_bytes_to_copy;
 342 
 343  public:
 344   // If "is_zeroed" is "true", the region "mr" can be assumed to contain zeros.
 345   HeapRegion(size_t hrs_index,
 346              G1BlockOffsetSharedArray* sharedOffsetArray,
 347              MemRegion mr, bool is_zeroed);
 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;
 359 
 360   static size_t align_up_to_region_byte_size(size_t sz) {
 361     return (sz + (size_t) GrainBytes - 1) &
 362                                       ~((1 << (size_t) LogOfHRGrainBytes) - 1);
 363   }
 364 
 365   // It sets up the heap region size (GrainBytes / GrainWords), as
 366   // well as other related fields that are based on the heap region
 367   // size (LogOfHRGrainBytes / LogOfHRGrainWords /
 368   // CardsPerRegion). All those fields are considered constant
 369   // throughout the JVM's execution, therefore they should only be set
 370   // up once during initialization time.
 371   static void setup_heap_region_size(uintx min_heap_size);
 372 
 373   enum ClaimValues {
 374     InitialClaimValue     = 0,
 375     FinalCountClaimValue  = 1,
 376     NoteEndClaimValue     = 2,
 377     ScrubRemSetClaimValue = 3,
 378     ParVerifyClaimValue   = 4,




 331   // The RSet length that was added to the total value
 332   // for the collection set.
 333   size_t _recorded_rs_length;
 334 
 335   // The predicted elapsed time that was added to total value
 336   // for the collection set.
 337   double _predicted_elapsed_time_ms;
 338 
 339   // The predicted number of bytes to copy that was added to
 340   // the total value for the collection set.
 341   size_t _predicted_bytes_to_copy;
 342 
 343  public:
 344   // If "is_zeroed" is "true", the region "mr" can be assumed to contain zeros.
 345   HeapRegion(size_t hrs_index,
 346              G1BlockOffsetSharedArray* sharedOffsetArray,
 347              MemRegion mr, bool is_zeroed);
 348 
 349   static int    LogOfHRGrainBytes;
 350   static int    LogOfHRGrainWords;
 351 
 352   static size_t GrainBytes;
 353   static size_t GrainWords;
 354   static size_t CardsPerRegion;




 355 
 356   static size_t align_up_to_region_byte_size(size_t sz) {
 357     return (sz + (size_t) GrainBytes - 1) &
 358                                       ~((1 << (size_t) LogOfHRGrainBytes) - 1);
 359   }
 360 
 361   // It sets up the heap region size (GrainBytes / GrainWords), as
 362   // well as other related fields that are based on the heap region
 363   // size (LogOfHRGrainBytes / LogOfHRGrainWords /
 364   // CardsPerRegion). All those fields are considered constant
 365   // throughout the JVM's execution, therefore they should only be set
 366   // up once during initialization time.
 367   static void setup_heap_region_size(uintx min_heap_size);
 368 
 369   enum ClaimValues {
 370     InitialClaimValue     = 0,
 371     FinalCountClaimValue  = 1,
 372     NoteEndClaimValue     = 2,
 373     ScrubRemSetClaimValue = 3,
 374     ParVerifyClaimValue   = 4,