262 // This is defensive code. As the assertion above says, the number |
262 // This is defensive code. As the assertion above says, the number |
263 // of active threads should be > 0, but in case there is some path |
263 // of active threads should be > 0, but in case there is some path |
264 // or some improperly initialized variable with leads to no |
264 // or some improperly initialized variable with leads to no |
265 // active threads, protect against that in a product build. |
265 // active threads, protect against that in a product build. |
266 n_threads = MAX2(G1CollectedHeap::heap()->workers()->active_workers(), |
266 n_threads = MAX2(G1CollectedHeap::heap()->workers()->active_workers(), |
267 1); |
267 1U); |
268 } |
268 } |
269 size_t max_waste = n_threads * chunkSize; |
269 size_t max_waste = n_threads * chunkSize; |
270 // it should be aligned with respect to chunkSize |
270 // it should be aligned with respect to chunkSize |
271 size_t aligned_n_regions = |
271 size_t aligned_n_regions = |
272 (n_regions + (chunkSize - 1)) / chunkSize * chunkSize; |
272 (n_regions + (chunkSize - 1)) / chunkSize * chunkSize; |