Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/g1/heapRegion.cpp @ 12178:84683e78e713
8019902: G1: Use the average heap size rather than the minimum heap size to calculate the region size
Reviewed-by: tonyp, tschatzl, sjohanss
author | brutisso |
---|---|
date | Fri, 30 Aug 2013 07:31:47 +0200 |
parents | 5888334c9c24 |
children | 40136aa2cdb1 |
comparison
equal
deleted
inserted
replaced
12177:0d59407e7e09 | 12178:84683e78e713 |
---|---|
147 | 147 |
148 // The automatic region size calculation will try to have around this | 148 // The automatic region size calculation will try to have around this |
149 // many regions in the heap (based on the min heap size). | 149 // many regions in the heap (based on the min heap size). |
150 #define TARGET_REGION_NUMBER 2048 | 150 #define TARGET_REGION_NUMBER 2048 |
151 | 151 |
152 void HeapRegion::setup_heap_region_size(uintx min_heap_size) { | 152 void HeapRegion::setup_heap_region_size(size_t initial_heap_size, size_t max_heap_size) { |
153 // region_size in bytes | |
154 uintx region_size = G1HeapRegionSize; | 153 uintx region_size = G1HeapRegionSize; |
155 if (FLAG_IS_DEFAULT(G1HeapRegionSize)) { | 154 if (FLAG_IS_DEFAULT(G1HeapRegionSize)) { |
156 // We base the automatic calculation on the min heap size. This | 155 size_t average_heap_size = (initial_heap_size + max_heap_size) / 2; |
157 // can be problematic if the spread between min and max is quite | 156 region_size = MAX2(average_heap_size / TARGET_REGION_NUMBER, |
158 // wide, imagine -Xms128m -Xmx32g. But, if we decided it based on | |
159 // the max size, the region size might be way too large for the | |
160 // min size. Either way, some users might have to set the region | |
161 // size manually for some -Xms / -Xmx combos. | |
162 | |
163 region_size = MAX2(min_heap_size / TARGET_REGION_NUMBER, | |
164 (uintx) MIN_REGION_SIZE); | 157 (uintx) MIN_REGION_SIZE); |
165 } | 158 } |
166 | 159 |
167 int region_size_log = log2_long((jlong) region_size); | 160 int region_size_log = log2_long((jlong) region_size); |
168 // Recalculate the region size to make sure it's a power of | 161 // Recalculate the region size to make sure it's a power of |