475 // Swap the survivor spaces.
476
477
478 young_gen->eden_space()->clear(SpaceDecorator::Mangle);
479 young_gen->from_space()->clear(SpaceDecorator::Mangle);
480 young_gen->swap_spaces();
481
482 size_t survived = young_gen->from_space()->used_in_bytes();
483 size_t promoted = old_gen->used_in_bytes() - old_gen_used_before;
484 size_policy->update_averages(_survivor_overflow, survived, promoted);
485
486 // A successful scavenge should restart the GC time limit count which is
487 // for full GC's.
488 size_policy->reset_gc_overhead_limit_count();
489 if (UseAdaptiveSizePolicy) {
490 // Calculate the new survivor size and tenuring threshold
491
492 if (PrintAdaptiveSizePolicy) {
493 gclog_or_tty->print("AdaptiveSizeStart: ");
494 gclog_or_tty->stamp();
495 gclog_or_tty->print_cr(" collection: %d ",
496 heap->total_collections());
497
498 if (Verbose) {
499 gclog_or_tty->print("old_gen_capacity: %d young_gen_capacity: %d",
500 old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
501 }
502 }
503
504
505 if (UsePerfData) {
506 PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters();
507 counters->update_old_eden_size(
508 size_policy->calculated_eden_size_in_bytes());
509 counters->update_old_promo_size(
510 size_policy->calculated_promo_size_in_bytes());
511 counters->update_old_capacity(old_gen->capacity_in_bytes());
512 counters->update_young_capacity(young_gen->capacity_in_bytes());
513 counters->update_survived(survived);
514 counters->update_promoted(promoted);
515 counters->update_survivor_overflowed(_survivor_overflow);
527 gclog_or_tty->cr();
528 gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u (max %u)",
529 size_policy->calculated_survivor_size_in_bytes(),
530 _tenuring_threshold, MaxTenuringThreshold);
531 }
532
533 if (UsePerfData) {
534 PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters();
535 counters->update_tenuring_threshold(_tenuring_threshold);
536 counters->update_survivor_size_counters();
537 }
538
539 // Do call at minor collections?
540 // Don't check if the size_policy is ready at this
541 // level. Let the size_policy check that internally.
542 if (UseAdaptiveSizePolicy &&
543 UseAdaptiveGenerationSizePolicyAtMinorCollection &&
544 ((gc_cause != GCCause::_java_lang_system_gc) ||
545 UseAdaptiveSizePolicyWithSystemGC)) {
546
547 // Calculate optimial free space amounts
548 assert(young_gen->max_size() >
549 young_gen->from_space()->capacity_in_bytes() +
550 young_gen->to_space()->capacity_in_bytes(),
551 "Sizes of space in young gen are out-of-bounds");
552
553 size_t young_live = young_gen->used_in_bytes();
554 size_t eden_live = young_gen->eden_space()->used_in_bytes();
555 size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
556 size_t max_old_gen_size = old_gen->max_gen_size();
557 size_t max_eden_size = young_gen->max_size() -
558 young_gen->from_space()->capacity_in_bytes() -
559 young_gen->to_space()->capacity_in_bytes();
560
561 // Used for diagnostics
562 size_policy->clear_generation_free_space_flags();
563
564 size_policy->compute_eden_space_size(young_live,
565 eden_live,
566 cur_eden,
567 max_eden_size,
|
475 // Swap the survivor spaces.
476
477
478 young_gen->eden_space()->clear(SpaceDecorator::Mangle);
479 young_gen->from_space()->clear(SpaceDecorator::Mangle);
480 young_gen->swap_spaces();
481
482 size_t survived = young_gen->from_space()->used_in_bytes();
483 size_t promoted = old_gen->used_in_bytes() - old_gen_used_before;
484 size_policy->update_averages(_survivor_overflow, survived, promoted);
485
486 // A successful scavenge should restart the GC time limit count which is
487 // for full GC's.
488 size_policy->reset_gc_overhead_limit_count();
489 if (UseAdaptiveSizePolicy) {
490 // Calculate the new survivor size and tenuring threshold
491
492 if (PrintAdaptiveSizePolicy) {
493 gclog_or_tty->print("AdaptiveSizeStart: ");
494 gclog_or_tty->stamp();
495 gclog_or_tty->print(" collection: %d ",
496 heap->total_collections());
497
498 if (Verbose) {
499 gclog_or_tty->print("old_gen_capacity: %d young_gen_capacity: %d",
500 old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
501 }
502 }
503
504
505 if (UsePerfData) {
506 PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters();
507 counters->update_old_eden_size(
508 size_policy->calculated_eden_size_in_bytes());
509 counters->update_old_promo_size(
510 size_policy->calculated_promo_size_in_bytes());
511 counters->update_old_capacity(old_gen->capacity_in_bytes());
512 counters->update_young_capacity(young_gen->capacity_in_bytes());
513 counters->update_survived(survived);
514 counters->update_promoted(promoted);
515 counters->update_survivor_overflowed(_survivor_overflow);
527 gclog_or_tty->cr();
528 gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u (max %u)",
529 size_policy->calculated_survivor_size_in_bytes(),
530 _tenuring_threshold, MaxTenuringThreshold);
531 }
532
533 if (UsePerfData) {
534 PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters();
535 counters->update_tenuring_threshold(_tenuring_threshold);
536 counters->update_survivor_size_counters();
537 }
538
539 // Do call at minor collections?
540 // Don't check if the size_policy is ready at this
541 // level. Let the size_policy check that internally.
542 if (UseAdaptiveSizePolicy &&
543 UseAdaptiveGenerationSizePolicyAtMinorCollection &&
544 ((gc_cause != GCCause::_java_lang_system_gc) ||
545 UseAdaptiveSizePolicyWithSystemGC)) {
546
547 // Calculate optimal free space amounts
548 assert(young_gen->max_size() >
549 young_gen->from_space()->capacity_in_bytes() +
550 young_gen->to_space()->capacity_in_bytes(),
551 "Sizes of space in young gen are out-of-bounds");
552
553 size_t young_live = young_gen->used_in_bytes();
554 size_t eden_live = young_gen->eden_space()->used_in_bytes();
555 size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
556 size_t max_old_gen_size = old_gen->max_gen_size();
557 size_t max_eden_size = young_gen->max_size() -
558 young_gen->from_space()->capacity_in_bytes() -
559 young_gen->to_space()->capacity_in_bytes();
560
561 // Used for diagnostics
562 size_policy->clear_generation_free_space_flags();
563
564 size_policy->compute_eden_space_size(young_live,
565 eden_live,
566 cur_eden,
567 max_eden_size,
|