src/share/vm/gc_implementation/g1/heapRegion.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/gc_implementation/g1

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

Print this page




 157   uintx region_size = G1HeapRegionSize;
 158   if (FLAG_IS_DEFAULT(G1HeapRegionSize)) {
 159     size_t average_heap_size = (initial_heap_size + max_heap_size) / 2;
 160     region_size = MAX2(average_heap_size / TARGET_REGION_NUMBER,
 161                        (uintx) MIN_REGION_SIZE);
 162   }
 163 
 164   int region_size_log = log2_long((jlong) region_size);
 165   // Recalculate the region size to make sure it's a power of
 166   // 2. This means that region_size is the largest power of 2 that's
 167   // <= what we've calculated so far.
 168   region_size = ((uintx)1 << region_size_log);
 169 
 170   // Now make sure that we don't go over or under our limits.
 171   if (region_size < MIN_REGION_SIZE) {
 172     region_size = MIN_REGION_SIZE;
 173   } else if (region_size > MAX_REGION_SIZE) {
 174     region_size = MAX_REGION_SIZE;
 175   }
 176 
 177   if (region_size != G1HeapRegionSize) {
 178     // Update the flag to make sure that PrintFlagsFinal logs the correct value
 179     FLAG_SET_ERGO(uintx, G1HeapRegionSize, region_size);
 180   }
 181 
 182   // And recalculate the log.
 183   region_size_log = log2_long((jlong) region_size);
 184 
 185   // Now, set up the globals.
 186   guarantee(LogOfHRGrainBytes == 0, "we should only set it once");
 187   LogOfHRGrainBytes = region_size_log;
 188 
 189   guarantee(LogOfHRGrainWords == 0, "we should only set it once");
 190   LogOfHRGrainWords = LogOfHRGrainBytes - LogHeapWordSize;
 191 
 192   guarantee(GrainBytes == 0, "we should only set it once");
 193   // The cast to int is safe, given that we've bounded region_size by
 194   // MIN_REGION_SIZE and MAX_REGION_SIZE.
 195   GrainBytes = (size_t)region_size;
 196 
 197   guarantee(GrainWords == 0, "we should only set it once");
 198   GrainWords = GrainBytes >> LogHeapWordSize;
 199   guarantee((size_t) 1 << LogOfHRGrainWords == GrainWords, "sanity");
 200 
 201   guarantee(CardsPerRegion == 0, "we should only set it once");




 157   uintx region_size = G1HeapRegionSize;
 158   if (FLAG_IS_DEFAULT(G1HeapRegionSize)) {
 159     size_t average_heap_size = (initial_heap_size + max_heap_size) / 2;
 160     region_size = MAX2(average_heap_size / TARGET_REGION_NUMBER,
 161                        (uintx) MIN_REGION_SIZE);
 162   }
 163 
 164   int region_size_log = log2_long((jlong) region_size);
 165   // Recalculate the region size to make sure it's a power of
 166   // 2. This means that region_size is the largest power of 2 that's
 167   // <= what we've calculated so far.
 168   region_size = ((uintx)1 << region_size_log);
 169 
 170   // Now make sure that we don't go over or under our limits.
 171   if (region_size < MIN_REGION_SIZE) {
 172     region_size = MIN_REGION_SIZE;
 173   } else if (region_size > MAX_REGION_SIZE) {
 174     region_size = MAX_REGION_SIZE;
 175   }
 176 





 177   // And recalculate the log.
 178   region_size_log = log2_long((jlong) region_size);
 179 
 180   // Now, set up the globals.
 181   guarantee(LogOfHRGrainBytes == 0, "we should only set it once");
 182   LogOfHRGrainBytes = region_size_log;
 183 
 184   guarantee(LogOfHRGrainWords == 0, "we should only set it once");
 185   LogOfHRGrainWords = LogOfHRGrainBytes - LogHeapWordSize;
 186 
 187   guarantee(GrainBytes == 0, "we should only set it once");
 188   // The cast to int is safe, given that we've bounded region_size by
 189   // MIN_REGION_SIZE and MAX_REGION_SIZE.
 190   GrainBytes = (size_t)region_size;
 191 
 192   guarantee(GrainWords == 0, "we should only set it once");
 193   GrainWords = GrainBytes >> LogHeapWordSize;
 194   guarantee((size_t) 1 << LogOfHRGrainWords == GrainWords, "sanity");
 195 
 196   guarantee(CardsPerRegion == 0, "we should only set it once");


src/share/vm/gc_implementation/g1/heapRegion.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File