213 } 214 215 size_t GenCollectorPolicy::compute_max_alignment() { 216 // The card marking array and the offset arrays for old generations are 217 // committed in os pages as well. Make sure they are entirely full (to 218 // avoid partial page problems), e.g. if 512 bytes heap corresponds to 1 219 // byte entry and the os page size is 4096, the maximum heap size should 220 // be 512*4096 = 2MB aligned. 221 size_t alignment = GenRemSet::max_alignment_constraint(rem_set_name()); 222 223 // Parallel GC does its own alignment of the generations to avoid requiring a 224 // large page (256M on some platforms) for the permanent generation. The 225 // other collectors should also be updated to do their own alignment and then 226 // this use of lcm() should be removed. 227 if (UseLargePages && !UseParallelGC) { 228 // in presence of large pages we have to make sure that our 229 // alignment is large page aware 230 alignment = lcm(os::large_page_size(), alignment); 231 } 232 233 return alignment; 234 } 235 236 void GenCollectorPolicy::initialize_flags() { 237 // All sizes must be multiples of the generation granularity. 238 set_min_alignment((uintx) Generation::GenGrain); 239 set_max_alignment(compute_max_alignment()); 240 241 CollectorPolicy::initialize_flags(); 242 243 // All generational heaps have a youngest gen; handle those flags here. 244 245 // Adjust max size parameters 246 if (NewSize > MaxNewSize) { 247 MaxNewSize = NewSize; 248 } 249 NewSize = align_size_down(NewSize, min_alignment()); 250 MaxNewSize = align_size_down(MaxNewSize, min_alignment()); 251 252 // Check validity of heap flags | 213 } 214 215 size_t GenCollectorPolicy::compute_max_alignment() { 216 // The card marking array and the offset arrays for old generations are 217 // committed in os pages as well. Make sure they are entirely full (to 218 // avoid partial page problems), e.g. if 512 bytes heap corresponds to 1 219 // byte entry and the os page size is 4096, the maximum heap size should 220 // be 512*4096 = 2MB aligned. 221 size_t alignment = GenRemSet::max_alignment_constraint(rem_set_name()); 222 223 // Parallel GC does its own alignment of the generations to avoid requiring a 224 // large page (256M on some platforms) for the permanent generation. The 225 // other collectors should also be updated to do their own alignment and then 226 // this use of lcm() should be removed. 227 if (UseLargePages && !UseParallelGC) { 228 // in presence of large pages we have to make sure that our 229 // alignment is large page aware 230 alignment = lcm(os::large_page_size(), alignment); 231 } 232 233 assert(alignment >= min_alignment(), "Must be"); 234 235 return alignment; 236 } 237 238 void GenCollectorPolicy::initialize_flags() { 239 // All sizes must be multiples of the generation granularity. 240 set_min_alignment((uintx) Generation::GenGrain); 241 set_max_alignment(compute_max_alignment()); 242 243 CollectorPolicy::initialize_flags(); 244 245 // All generational heaps have a youngest gen; handle those flags here. 246 247 // Adjust max size parameters 248 if (NewSize > MaxNewSize) { 249 MaxNewSize = NewSize; 250 } 251 NewSize = align_size_down(NewSize, min_alignment()); 252 MaxNewSize = align_size_down(MaxNewSize, min_alignment()); 253 254 // Check validity of heap flags |