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

Print this page




2077         gclog_or_tty->print("AdaptiveSizeStart: ");
2078         gclog_or_tty->stamp();
2079         gclog_or_tty->print_cr(" collection: %d ",
2080                        heap->total_collections());
2081         if (Verbose) {
2082           gclog_or_tty->print("old_gen_capacity: %d young_gen_capacity: %d",
2083             old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
2084         }
2085       }
2086 
2087       // Don't check if the size_policy is ready here.  Let
2088       // the size_policy check that internally.
2089       if (UseAdaptiveGenerationSizePolicyAtMajorCollection &&
2090           ((gc_cause != GCCause::_java_lang_system_gc) ||
2091             UseAdaptiveSizePolicyWithSystemGC)) {
2092         // Calculate optimal free space amounts
2093         assert(young_gen->max_size() >
2094           young_gen->from_space()->capacity_in_bytes() +
2095           young_gen->to_space()->capacity_in_bytes(),
2096           "Sizes of space in young gen are out-of-bounds");






2097         size_t max_eden_size = young_gen->max_size() -
2098           young_gen->from_space()->capacity_in_bytes() -
2099           young_gen->to_space()->capacity_in_bytes();
2100         size_policy->compute_generation_free_space(
2101                               young_gen->used_in_bytes(),
2102                               young_gen->eden_space()->used_in_bytes(),
2103                               old_gen->used_in_bytes(),
2104                               young_gen->eden_space()->capacity_in_bytes(),
2105                               old_gen->max_gen_size(),









2106                               max_eden_size,
2107                               true /* full gc*/,
2108                               gc_cause,
2109                               heap->collector_policy());
2110 


2111         heap->resize_old_gen(
2112           size_policy->calculated_old_free_size_in_bytes());
2113 
2114         // Don't resize the young generation at an major collection.  A
2115         // desired young generation size may have been calculated but
2116         // resizing the young generation complicates the code because the
2117         // resizing of the old generation may have moved the boundary
2118         // between the young generation and the old generation.  Let the
2119         // young generation resizing happen at the minor collections.
2120       }
2121       if (PrintAdaptiveSizePolicy) {
2122         gclog_or_tty->print_cr("AdaptiveSizeStop: collection: %d ",
2123                        heap->total_collections());
2124       }
2125     }
2126 
2127     if (UsePerfData) {
2128       PSGCAdaptivePolicyCounters* const counters = heap->gc_policy_counters();
2129       counters->update_counters();
2130       counters->update_old_capacity(old_gen->capacity_in_bytes());




2077         gclog_or_tty->print("AdaptiveSizeStart: ");
2078         gclog_or_tty->stamp();
2079         gclog_or_tty->print_cr(" collection: %d ",
2080                        heap->total_collections());
2081         if (Verbose) {
2082           gclog_or_tty->print("old_gen_capacity: %d young_gen_capacity: %d",
2083             old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
2084         }
2085       }
2086 
2087       // Don't check if the size_policy is ready here.  Let
2088       // the size_policy check that internally.
2089       if (UseAdaptiveGenerationSizePolicyAtMajorCollection &&
2090           ((gc_cause != GCCause::_java_lang_system_gc) ||
2091             UseAdaptiveSizePolicyWithSystemGC)) {
2092         // Calculate optimal free space amounts
2093         assert(young_gen->max_size() >
2094           young_gen->from_space()->capacity_in_bytes() +
2095           young_gen->to_space()->capacity_in_bytes(),
2096           "Sizes of space in young gen are out-of-bounds");
2097 
2098         size_t young_live = young_gen->used_in_bytes();
2099         size_t eden_live = young_gen->eden_space()->used_in_bytes();
2100         size_t old_live = old_gen->used_in_bytes();
2101         size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
2102         size_t max_old_gen_size = old_gen->max_gen_size();
2103         size_t max_eden_size = young_gen->max_size() -
2104           young_gen->from_space()->capacity_in_bytes() -
2105           young_gen->to_space()->capacity_in_bytes();
2106 
2107         // Used for diagnostics
2108         size_policy->clear_generation_free_space_flags();
2109 
2110         size_policy->compute_generation_free_space(young_live,
2111                                                    eden_live,
2112                                                    old_live,
2113                                                    cur_eden,
2114                                                    max_old_gen_size,
2115                                                    max_eden_size,
2116                                                    true /* full gc*/);
2117 
2118         size_policy->check_gc_overhead_limit(young_live,
2119                                              eden_live,
2120                                              max_old_gen_size,
2121                                              max_eden_size,
2122                                              true /* full gc*/,
2123                                              gc_cause,
2124                                              heap->collector_policy());
2125 
2126         size_policy->decay_supplemental_growth(true /* full gc*/);
2127 
2128         heap->resize_old_gen(
2129           size_policy->calculated_old_free_size_in_bytes());
2130 
2131         // Don't resize the young generation at an major collection.  A
2132         // desired young generation size may have been calculated but
2133         // resizing the young generation complicates the code because the
2134         // resizing of the old generation may have moved the boundary
2135         // between the young generation and the old generation.  Let the
2136         // young generation resizing happen at the minor collections.
2137       }
2138       if (PrintAdaptiveSizePolicy) {
2139         gclog_or_tty->print_cr("AdaptiveSizeStop: collection: %d ",
2140                        heap->total_collections());
2141       }
2142     }
2143 
2144     if (UsePerfData) {
2145       PSGCAdaptivePolicyCounters* const counters = heap->gc_policy_counters();
2146       counters->update_counters();
2147       counters->update_old_capacity(old_gen->capacity_in_bytes());