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

Print this page




 145 // Maximum region size; we don't go higher than that. There's a good
 146 // reason for having an upper bound. We don't want regions to get too
 147 // large, otherwise cleanup's effectiveness would decrease as there
 148 // will be fewer opportunities to find totally empty regions after
 149 // marking.
 150 #define MAX_REGION_SIZE  ( 32 * 1024 * 1024 )
 151 
 152 // The automatic region size calculation will try to have around this
 153 // many regions in the heap (based on the min heap size).
 154 #define TARGET_REGION_NUMBER          2048
 155 
 156 size_t HeapRegion::max_region_size() {
 157   return (size_t)MAX_REGION_SIZE;
 158 }
 159 
 160 void HeapRegion::setup_heap_region_size(size_t initial_heap_size, size_t max_heap_size) {
 161   uintx region_size = G1HeapRegionSize;
 162   if (FLAG_IS_DEFAULT(G1HeapRegionSize)) {
 163     size_t average_heap_size = (initial_heap_size + max_heap_size) / 2;
 164     region_size = MAX2(average_heap_size / TARGET_REGION_NUMBER,
 165                        (uintx) MIN_REGION_SIZE);
 166   }
 167 
 168   int region_size_log = log2_long((jlong) region_size);
 169   // Recalculate the region size to make sure it's a power of
 170   // 2. This means that region_size is the largest power of 2 that's
 171   // <= what we've calculated so far.
 172   region_size = ((uintx)1 << region_size_log);
 173 
 174   // Now make sure that we don't go over or under our limits.
 175   if (region_size < MIN_REGION_SIZE) {
 176     region_size = MIN_REGION_SIZE;
 177   } else if (region_size > MAX_REGION_SIZE) {
 178     region_size = MAX_REGION_SIZE;
 179   }
 180 
 181   // And recalculate the log.
 182   region_size_log = log2_long((jlong) region_size);
 183 
 184   // Now, set up the globals.
 185   guarantee(LogOfHRGrainBytes == 0, "we should only set it once");




 145 // Maximum region size; we don't go higher than that. There's a good
 146 // reason for having an upper bound. We don't want regions to get too
 147 // large, otherwise cleanup's effectiveness would decrease as there
 148 // will be fewer opportunities to find totally empty regions after
 149 // marking.
 150 #define MAX_REGION_SIZE  ( 32 * 1024 * 1024 )
 151 
 152 // The automatic region size calculation will try to have around this
 153 // many regions in the heap (based on the min heap size).
 154 #define TARGET_REGION_NUMBER          2048
 155 
 156 size_t HeapRegion::max_region_size() {
 157   return (size_t)MAX_REGION_SIZE;
 158 }
 159 
 160 void HeapRegion::setup_heap_region_size(size_t initial_heap_size, size_t max_heap_size) {
 161   uintx region_size = G1HeapRegionSize;
 162   if (FLAG_IS_DEFAULT(G1HeapRegionSize)) {
 163     size_t average_heap_size = (initial_heap_size + max_heap_size) / 2;
 164     region_size = MAX2(average_heap_size / TARGET_REGION_NUMBER,
 165                        (size_t) MIN_REGION_SIZE);
 166   }
 167 
 168   int region_size_log = log2_long((jlong) region_size);
 169   // Recalculate the region size to make sure it's a power of
 170   // 2. This means that region_size is the largest power of 2 that's
 171   // <= what we've calculated so far.
 172   region_size = ((uintx)1 << region_size_log);
 173 
 174   // Now make sure that we don't go over or under our limits.
 175   if (region_size < MIN_REGION_SIZE) {
 176     region_size = MIN_REGION_SIZE;
 177   } else if (region_size > MAX_REGION_SIZE) {
 178     region_size = MAX_REGION_SIZE;
 179   }
 180 
 181   // And recalculate the log.
 182   region_size_log = log2_long((jlong) region_size);
 183 
 184   // Now, set up the globals.
 185   guarantee(LogOfHRGrainBytes == 0, "we should only set it once");