258 // Let the size policy know we're done
259 size_policy->major_collection_end(old_gen->used_in_bytes(), gc_cause);
260
261 if (UseAdaptiveSizePolicy) {
262
263 if (PrintAdaptiveSizePolicy) {
264 gclog_or_tty->print("AdaptiveSizeStart: ");
265 gclog_or_tty->stamp();
266 gclog_or_tty->print_cr(" collection: %d ",
267 heap->total_collections());
268 if (Verbose) {
269 gclog_or_tty->print("old_gen_capacity: " SIZE_FORMAT
270 " young_gen_capacity: " SIZE_FORMAT,
271 old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
272 }
273 }
274
275 // Don't check if the size_policy is ready here. Let
276 // the size_policy check that internally.
277 if (UseAdaptiveGenerationSizePolicyAtMajorCollection &&
278 ((gc_cause != GCCause::_java_lang_system_gc) ||
279 UseAdaptiveSizePolicyWithSystemGC)) {
280 // Swap the survivor spaces if from_space is empty. The
281 // resize_young_gen() called below is normally used after
282 // a successful young GC and swapping of survivor spaces;
283 // otherwise, it will fail to resize the young gen with
284 // the current implementation.
285 if (young_gen->from_space()->is_empty()) {
286 young_gen->from_space()->clear(SpaceDecorator::Mangle);
287 young_gen->swap_spaces();
288 }
289
290 // Calculate optimal free space amounts
291 assert(young_gen->max_size() >
292 young_gen->from_space()->capacity_in_bytes() +
293 young_gen->to_space()->capacity_in_bytes(),
294 "Sizes of space in young gen are out-of-bounds");
295
296 size_t young_live = young_gen->used_in_bytes();
297 size_t eden_live = young_gen->eden_space()->used_in_bytes();
298 size_t old_live = old_gen->used_in_bytes();
|
258 // Let the size policy know we're done
259 size_policy->major_collection_end(old_gen->used_in_bytes(), gc_cause);
260
261 if (UseAdaptiveSizePolicy) {
262
263 if (PrintAdaptiveSizePolicy) {
264 gclog_or_tty->print("AdaptiveSizeStart: ");
265 gclog_or_tty->stamp();
266 gclog_or_tty->print_cr(" collection: %d ",
267 heap->total_collections());
268 if (Verbose) {
269 gclog_or_tty->print("old_gen_capacity: " SIZE_FORMAT
270 " young_gen_capacity: " SIZE_FORMAT,
271 old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
272 }
273 }
274
275 // Don't check if the size_policy is ready here. Let
276 // the size_policy check that internally.
277 if (UseAdaptiveGenerationSizePolicyAtMajorCollection &&
278 (!GCCause::is_user_requested_gc(gc_cause) ||
279 UseAdaptiveSizePolicyWithSystemGC)) {
280 // Swap the survivor spaces if from_space is empty. The
281 // resize_young_gen() called below is normally used after
282 // a successful young GC and swapping of survivor spaces;
283 // otherwise, it will fail to resize the young gen with
284 // the current implementation.
285 if (young_gen->from_space()->is_empty()) {
286 young_gen->from_space()->clear(SpaceDecorator::Mangle);
287 young_gen->swap_spaces();
288 }
289
290 // Calculate optimal free space amounts
291 assert(young_gen->max_size() >
292 young_gen->from_space()->capacity_in_bytes() +
293 young_gen->to_space()->capacity_in_bytes(),
294 "Sizes of space in young gen are out-of-bounds");
295
296 size_t young_live = young_gen->used_in_bytes();
297 size_t eden_live = young_gen->eden_space()->used_in_bytes();
298 size_t old_live = old_gen->used_in_bytes();
|