518 " perm_gen_capacity: %d ", 519 old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes(), 520 perm_gen->capacity_in_bytes()); 521 } 522 } 523 524 525 if (UsePerfData) { 526 PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters(); 527 counters->update_old_eden_size( 528 size_policy->calculated_eden_size_in_bytes()); 529 counters->update_old_promo_size( 530 size_policy->calculated_promo_size_in_bytes()); 531 counters->update_old_capacity(old_gen->capacity_in_bytes()); 532 counters->update_young_capacity(young_gen->capacity_in_bytes()); 533 counters->update_survived(survived); 534 counters->update_promoted(promoted); 535 counters->update_survivor_overflowed(_survivor_overflow); 536 } 537 538 size_t survivor_limit = 539 size_policy->max_survivor_size(young_gen->max_size()); 540 _tenuring_threshold = 541 size_policy->compute_survivor_space_size_and_threshold( 542 _survivor_overflow, 543 _tenuring_threshold, 544 survivor_limit); 545 546 if (PrintTenuringDistribution) { 547 gclog_or_tty->cr(); 548 gclog_or_tty->print_cr("Desired survivor size %ld bytes, new threshold %d (max %d)", 549 size_policy->calculated_survivor_size_in_bytes(), 550 _tenuring_threshold, MaxTenuringThreshold); 551 } 552 553 if (UsePerfData) { 554 PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters(); 555 counters->update_tenuring_threshold(_tenuring_threshold); 556 counters->update_survivor_size_counters(); 557 } 558 559 // Do call at minor collections? 560 // Don't check if the size_policy is ready at this 561 // level. Let the size_policy check that internally. 562 if (UseAdaptiveSizePolicy && 563 UseAdaptiveGenerationSizePolicyAtMinorCollection && 564 ((gc_cause != GCCause::_java_lang_system_gc) || 565 UseAdaptiveSizePolicyWithSystemGC)) { 566 567 // Calculate optimial free space amounts 568 assert(young_gen->max_size() > 569 young_gen->from_space()->capacity_in_bytes() + 570 young_gen->to_space()->capacity_in_bytes(), 571 "Sizes of space in young gen are out-of-bounds"); 572 size_t max_eden_size = young_gen->max_size() - 573 young_gen->from_space()->capacity_in_bytes() - 574 young_gen->to_space()->capacity_in_bytes(); 575 size_policy->compute_generation_free_space(young_gen->used_in_bytes(), 576 young_gen->eden_space()->used_in_bytes(), 577 old_gen->used_in_bytes(), 578 perm_gen->used_in_bytes(), 579 young_gen->eden_space()->capacity_in_bytes(), 580 old_gen->max_gen_size(), 581 max_eden_size, 582 false /* full gc*/, 583 gc_cause, 584 heap->collector_policy()); 585 586 } 587 // Resize the young generation at every collection 588 // even if new sizes have not been calculated. This is 589 // to allow resizes that may have been inhibited by the 590 // relative location of the "to" and "from" spaces. 591 592 // Resizing the old gen at minor collects can cause increases | 518 " perm_gen_capacity: %d ", 519 old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes(), 520 perm_gen->capacity_in_bytes()); 521 } 522 } 523 524 525 if (UsePerfData) { 526 PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters(); 527 counters->update_old_eden_size( 528 size_policy->calculated_eden_size_in_bytes()); 529 counters->update_old_promo_size( 530 size_policy->calculated_promo_size_in_bytes()); 531 counters->update_old_capacity(old_gen->capacity_in_bytes()); 532 counters->update_young_capacity(young_gen->capacity_in_bytes()); 533 counters->update_survived(survived); 534 counters->update_promoted(promoted); 535 counters->update_survivor_overflowed(_survivor_overflow); 536 } 537 538 size_t max_young_size = young_gen->max_size(); 539 540 // Deciding a free ratio in the young generation is tricky, so if 541 // MinHeapFreeRatio or MaxHeapFreeRatio are in use (implicating 542 // that the old generation size may have been limited because of them) we 543 // should then limit our young generation size using NewRatio to have it 544 // follow the old generation size. 545 if (MinHeapFreeRatio != 0 || MaxHeapFreeRatio != 100) { 546 max_young_size = MIN2(old_gen->capacity_in_bytes() / NewRatio, young_gen->max_size()); 547 } 548 549 size_t survivor_limit = 550 size_policy->max_survivor_size(max_young_size); 551 _tenuring_threshold = 552 size_policy->compute_survivor_space_size_and_threshold( 553 _survivor_overflow, 554 _tenuring_threshold, 555 survivor_limit); 556 557 if (PrintTenuringDistribution) { 558 gclog_or_tty->cr(); 559 gclog_or_tty->print_cr("Desired survivor size %ld bytes, new threshold %d (max %d)", 560 size_policy->calculated_survivor_size_in_bytes(), 561 _tenuring_threshold, MaxTenuringThreshold); 562 } 563 564 if (UsePerfData) { 565 PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters(); 566 counters->update_tenuring_threshold(_tenuring_threshold); 567 counters->update_survivor_size_counters(); 568 } 569 570 // Do call at minor collections? 571 // Don't check if the size_policy is ready at this 572 // level. Let the size_policy check that internally. 573 if (UseAdaptiveGenerationSizePolicyAtMinorCollection && 574 ((gc_cause != GCCause::_java_lang_system_gc) || 575 UseAdaptiveSizePolicyWithSystemGC)) { 576 577 // Calculate optimial free space amounts 578 assert(young_gen->max_size() > 579 young_gen->from_space()->capacity_in_bytes() + 580 young_gen->to_space()->capacity_in_bytes(), 581 "Sizes of space in young gen are out-of-bounds"); 582 size_t max_eden_size = max_young_size - 583 young_gen->from_space()->capacity_in_bytes() - 584 young_gen->to_space()->capacity_in_bytes(); 585 size_policy->compute_generation_free_space(young_gen->used_in_bytes(), 586 young_gen->eden_space()->used_in_bytes(), 587 old_gen->used_in_bytes(), 588 perm_gen->used_in_bytes(), 589 young_gen->eden_space()->capacity_in_bytes(), 590 old_gen->max_gen_size(), 591 max_eden_size, 592 false /* full gc*/, 593 gc_cause, 594 heap->collector_policy()); 595 596 } 597 // Resize the young generation at every collection 598 // even if new sizes have not been calculated. This is 599 // to allow resizes that may have been inhibited by the 600 // relative location of the "to" and "from" spaces. 601 602 // Resizing the old gen at minor collects can cause increases |