< prev index next >

src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp

Print this page
rev 8330 : 7012980: PSOldGen is increased if there is no space in Metaspace
Reviewed-by:


 273   ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
 274   GCCause::Cause gc_cause = heap->gc_cause();
 275 
 276   // Check for potential problems.
 277   if (!should_attempt_scavenge()) {
 278     return false;
 279   }
 280 
 281   _gc_tracer.report_gc_start(heap->gc_cause(), _gc_timer.gc_start());
 282 
 283   bool promotion_failure_occurred = false;
 284 
 285   PSYoungGen* young_gen = heap->young_gen();
 286   PSOldGen* old_gen = heap->old_gen();
 287   PSAdaptiveSizePolicy* size_policy = heap->size_policy();
 288 
 289   heap->increment_total_collections();
 290 
 291   AdaptiveSizePolicyOutput(size_policy, heap->total_collections());
 292 
 293   if ((gc_cause != GCCause::_java_lang_system_gc) ||
 294        UseAdaptiveSizePolicyWithSystemGC) {
 295     // Gather the feedback data for eden occupancy.
 296     young_gen->eden_space()->accumulate_statistics();
 297   }
 298 
 299   if (ZapUnusedHeapArea) {
 300     // Save information needed to minimize mangling
 301     heap->record_gen_tops_before_GC();
 302   }
 303 
 304   heap->print_heap_before_gc();
 305   heap->trace_heap_before_gc(&_gc_tracer);
 306 
 307   assert(!NeverTenure || _tenuring_threshold == markOopDesc::max_age + 1, "Sanity");
 308   assert(!AlwaysTenure || _tenuring_threshold == 0, "Sanity");
 309 
 310   size_t prev_used = heap->used();
 311 
 312   // Fill in TLABs
 313   heap->accumulate_statistics_all_tlabs();
 314   heap->ensure_parsability(true);  // retire TLABs


 543                                                            survivor_limit);
 544 
 545        if (PrintTenuringDistribution) {
 546          gclog_or_tty->cr();
 547          gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u"
 548                                 " (max threshold " UINTX_FORMAT ")",
 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 (UseAdaptiveGenerationSizePolicyAtMinorCollection &&
 563             ((gc_cause != GCCause::_java_lang_system_gc) ||
 564               UseAdaptiveSizePolicyWithSystemGC)) {
 565 
 566           // Calculate optimal free space amounts
 567           assert(young_gen->max_size() >
 568             young_gen->from_space()->capacity_in_bytes() +
 569             young_gen->to_space()->capacity_in_bytes(),
 570             "Sizes of space in young gen are out-of-bounds");
 571 
 572           size_t young_live = young_gen->used_in_bytes();
 573           size_t eden_live = young_gen->eden_space()->used_in_bytes();
 574           size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
 575           size_t max_old_gen_size = old_gen->max_gen_size();
 576           size_t max_eden_size = max_young_size -
 577             young_gen->from_space()->capacity_in_bytes() -
 578             young_gen->to_space()->capacity_in_bytes();
 579 
 580           // Used for diagnostics
 581           size_policy->clear_generation_free_space_flags();
 582 
 583           size_policy->compute_eden_space_size(young_live,
 584                                                eden_live,
 585                                                cur_eden,




 273   ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
 274   GCCause::Cause gc_cause = heap->gc_cause();
 275 
 276   // Check for potential problems.
 277   if (!should_attempt_scavenge()) {
 278     return false;
 279   }
 280 
 281   _gc_tracer.report_gc_start(heap->gc_cause(), _gc_timer.gc_start());
 282 
 283   bool promotion_failure_occurred = false;
 284 
 285   PSYoungGen* young_gen = heap->young_gen();
 286   PSOldGen* old_gen = heap->old_gen();
 287   PSAdaptiveSizePolicy* size_policy = heap->size_policy();
 288 
 289   heap->increment_total_collections();
 290 
 291   AdaptiveSizePolicyOutput(size_policy, heap->total_collections());
 292 
 293   if (AdaptiveSizePolicy::should_update_promo_stats(gc_cause)) {

 294     // Gather the feedback data for eden occupancy.
 295     young_gen->eden_space()->accumulate_statistics();
 296   }
 297 
 298   if (ZapUnusedHeapArea) {
 299     // Save information needed to minimize mangling
 300     heap->record_gen_tops_before_GC();
 301   }
 302 
 303   heap->print_heap_before_gc();
 304   heap->trace_heap_before_gc(&_gc_tracer);
 305 
 306   assert(!NeverTenure || _tenuring_threshold == markOopDesc::max_age + 1, "Sanity");
 307   assert(!AlwaysTenure || _tenuring_threshold == 0, "Sanity");
 308 
 309   size_t prev_used = heap->used();
 310 
 311   // Fill in TLABs
 312   heap->accumulate_statistics_all_tlabs();
 313   heap->ensure_parsability(true);  // retire TLABs


 542                                                            survivor_limit);
 543 
 544        if (PrintTenuringDistribution) {
 545          gclog_or_tty->cr();
 546          gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u"
 547                                 " (max threshold " UINTX_FORMAT ")",
 548                                 size_policy->calculated_survivor_size_in_bytes(),
 549                                 _tenuring_threshold, MaxTenuringThreshold);
 550        }
 551 
 552         if (UsePerfData) {
 553           PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters();
 554           counters->update_tenuring_threshold(_tenuring_threshold);
 555           counters->update_survivor_size_counters();
 556         }
 557 
 558         // Do call at minor collections?
 559         // Don't check if the size_policy is ready at this
 560         // level.  Let the size_policy check that internally.
 561         if (UseAdaptiveGenerationSizePolicyAtMinorCollection &&
 562             (AdaptiveSizePolicy::should_update_promo_stats(gc_cause))) {


 563           // Calculate optimal free space amounts
 564           assert(young_gen->max_size() >
 565             young_gen->from_space()->capacity_in_bytes() +
 566             young_gen->to_space()->capacity_in_bytes(),
 567             "Sizes of space in young gen are out-of-bounds");
 568 
 569           size_t young_live = young_gen->used_in_bytes();
 570           size_t eden_live = young_gen->eden_space()->used_in_bytes();
 571           size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
 572           size_t max_old_gen_size = old_gen->max_gen_size();
 573           size_t max_eden_size = max_young_size -
 574             young_gen->from_space()->capacity_in_bytes() -
 575             young_gen->to_space()->capacity_in_bytes();
 576 
 577           // Used for diagnostics
 578           size_policy->clear_generation_free_space_flags();
 579 
 580           size_policy->compute_eden_space_size(young_live,
 581                                                eden_live,
 582                                                cur_eden,


< prev index next >