176 } 177 178 size_t GenCollectorPolicy::compute_max_alignment() { 179 // The card marking array and the offset arrays for old generations are 180 // committed in os pages as well. Make sure they are entirely full (to 181 // avoid partial page problems), e.g. if 512 bytes heap corresponds to 1 182 // byte entry and the os page size is 4096, the maximum heap size should 183 // be 512*4096 = 2MB aligned. 184 size_t alignment = GenRemSet::max_alignment_constraint(rem_set_name()); 185 186 // Parallel GC does its own alignment of the generations to avoid requiring a 187 // large page (256M on some platforms) for the permanent generation. The 188 // other collectors should also be updated to do their own alignment and then 189 // this use of lcm() should be removed. 190 if (UseLargePages && !UseParallelGC) { 191 // in presence of large pages we have to make sure that our 192 // alignment is large page aware 193 alignment = lcm(os::large_page_size(), alignment); 194 } 195 196 return alignment; 197 } 198 199 void GenCollectorPolicy::initialize_flags() { 200 // All sizes must be multiples of the generation granularity. 201 set_min_alignment((uintx) Generation::GenGrain); 202 set_max_alignment(compute_max_alignment()); 203 204 CollectorPolicy::initialize_flags(); 205 206 // All generational heaps have a youngest gen; handle those flags here. 207 208 // Adjust max size parameters 209 if (NewSize > MaxNewSize) { 210 MaxNewSize = NewSize; 211 } 212 NewSize = align_size_down(NewSize, min_alignment()); 213 MaxNewSize = align_size_down(MaxNewSize, min_alignment()); 214 215 // Check validity of heap flags | 176 } 177 178 size_t GenCollectorPolicy::compute_max_alignment() { 179 // The card marking array and the offset arrays for old generations are 180 // committed in os pages as well. Make sure they are entirely full (to 181 // avoid partial page problems), e.g. if 512 bytes heap corresponds to 1 182 // byte entry and the os page size is 4096, the maximum heap size should 183 // be 512*4096 = 2MB aligned. 184 size_t alignment = GenRemSet::max_alignment_constraint(rem_set_name()); 185 186 // Parallel GC does its own alignment of the generations to avoid requiring a 187 // large page (256M on some platforms) for the permanent generation. The 188 // other collectors should also be updated to do their own alignment and then 189 // this use of lcm() should be removed. 190 if (UseLargePages && !UseParallelGC) { 191 // in presence of large pages we have to make sure that our 192 // alignment is large page aware 193 alignment = lcm(os::large_page_size(), alignment); 194 } 195 196 assert(alignment >= min_alignment(), "Must be"); 197 198 return alignment; 199 } 200 201 void GenCollectorPolicy::initialize_flags() { 202 // All sizes must be multiples of the generation granularity. 203 set_min_alignment((uintx) Generation::GenGrain); 204 set_max_alignment(compute_max_alignment()); 205 206 CollectorPolicy::initialize_flags(); 207 208 // All generational heaps have a youngest gen; handle those flags here. 209 210 // Adjust max size parameters 211 if (NewSize > MaxNewSize) { 212 MaxNewSize = NewSize; 213 } 214 NewSize = align_size_down(NewSize, min_alignment()); 215 MaxNewSize = align_size_down(MaxNewSize, min_alignment()); 216 217 // Check validity of heap flags |