1.1 --- a/src/share/vm/gc_implementation/g1/heapRegion.cpp Tue Sep 09 01:58:02 2014 +0000 1.2 +++ b/src/share/vm/gc_implementation/g1/heapRegion.cpp Tue Sep 09 04:48:41 2014 +0200 1.3 @@ -28,6 +28,7 @@ 1.4 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" 1.5 #include "gc_implementation/g1/g1OopClosures.inline.hpp" 1.6 #include "gc_implementation/g1/heapRegion.inline.hpp" 1.7 +#include "gc_implementation/g1/heapRegionBounds.inline.hpp" 1.8 #include "gc_implementation/g1/heapRegionRemSet.hpp" 1.9 #include "gc_implementation/g1/heapRegionManager.inline.hpp" 1.10 #include "gc_implementation/shared/liveRange.hpp" 1.11 @@ -137,32 +138,16 @@ 1.12 } 1.13 } 1.14 1.15 -// Minimum region size; we won't go lower than that. 1.16 -// We might want to decrease this in the future, to deal with small 1.17 -// heaps a bit more efficiently. 1.18 -#define MIN_REGION_SIZE ( 1024 * 1024 ) 1.19 - 1.20 -// Maximum region size; we don't go higher than that. There's a good 1.21 -// reason for having an upper bound. We don't want regions to get too 1.22 -// large, otherwise cleanup's effectiveness would decrease as there 1.23 -// will be fewer opportunities to find totally empty regions after 1.24 -// marking. 1.25 -#define MAX_REGION_SIZE ( 32 * 1024 * 1024 ) 1.26 - 1.27 -// The automatic region size calculation will try to have around this 1.28 -// many regions in the heap (based on the min heap size). 1.29 -#define TARGET_REGION_NUMBER 2048 1.30 - 1.31 size_t HeapRegion::max_region_size() { 1.32 - return (size_t)MAX_REGION_SIZE; 1.33 + return HeapRegionBounds::max_size(); 1.34 } 1.35 1.36 void HeapRegion::setup_heap_region_size(size_t initial_heap_size, size_t max_heap_size) { 1.37 uintx region_size = G1HeapRegionSize; 1.38 if (FLAG_IS_DEFAULT(G1HeapRegionSize)) { 1.39 size_t average_heap_size = (initial_heap_size + max_heap_size) / 2; 1.40 - region_size = MAX2(average_heap_size / TARGET_REGION_NUMBER, 1.41 - (uintx) MIN_REGION_SIZE); 1.42 + region_size = MAX2(average_heap_size / HeapRegionBounds::target_number(), 1.43 + (uintx) HeapRegionBounds::min_size()); 1.44 } 1.45 1.46 int region_size_log = log2_long((jlong) region_size); 1.47 @@ -172,10 +157,10 @@ 1.48 region_size = ((uintx)1 << region_size_log); 1.49 1.50 // Now make sure that we don't go over or under our limits. 1.51 - if (region_size < MIN_REGION_SIZE) { 1.52 - region_size = MIN_REGION_SIZE; 1.53 - } else if (region_size > MAX_REGION_SIZE) { 1.54 - region_size = MAX_REGION_SIZE; 1.55 + if (region_size < HeapRegionBounds::min_size()) { 1.56 + region_size = HeapRegionBounds::min_size(); 1.57 + } else if (region_size > HeapRegionBounds::max_size()) { 1.58 + region_size = HeapRegionBounds::max_size(); 1.59 } 1.60 1.61 // And recalculate the log.