< prev index next >

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

Print this page




2061 
2062     if (TraceGen1Time) accumulated_time()->start();
2063 
2064     // Let the size policy know we're starting
2065     size_policy->major_collection_begin();
2066 
2067     CodeCache::gc_prologue();
2068     Threads::gc_prologue();
2069 
2070     COMPILER2_PRESENT(DerivedPointerTable::clear());
2071 
2072     ref_processor()->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/);
2073     ref_processor()->setup_policy(maximum_heap_compaction);
2074 
2075     bool marked_for_unloading = false;
2076 
2077     marking_start.update();
2078     marking_phase(vmthread_cm, maximum_heap_compaction, &_gc_tracer);
2079 
2080     bool max_on_system_gc = UseMaximumCompactionOnSystemGC
2081       && gc_cause == GCCause::_java_lang_system_gc;
2082     summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc);
2083 
2084     COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity"));
2085     COMPILER2_PRESENT(DerivedPointerTable::set_active(false));
2086 
2087     // adjust_roots() updates Universe::_intArrayKlassObj which is
2088     // needed by the compaction for filling holes in the dense prefix.
2089     adjust_roots();
2090 
2091     compaction_start.update();
2092     compact();
2093 
2094     // Reset the mark bitmap, summary data, and do other bookkeeping.  Must be
2095     // done before resizing.
2096     post_compact();
2097 
2098     // Let the size policy know we're done
2099     size_policy->major_collection_end(old_gen->used_in_bytes(), gc_cause);
2100 
2101     if (UseAdaptiveSizePolicy) {
2102       if (PrintAdaptiveSizePolicy) {
2103         gclog_or_tty->print("AdaptiveSizeStart: ");
2104         gclog_or_tty->stamp();
2105         gclog_or_tty->print_cr(" collection: %d ",
2106                        heap->total_collections());
2107         if (Verbose) {
2108           gclog_or_tty->print("old_gen_capacity: %d young_gen_capacity: %d",
2109             old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
2110         }
2111       }
2112 
2113       // Don't check if the size_policy is ready here.  Let
2114       // the size_policy check that internally.
2115       if (UseAdaptiveGenerationSizePolicyAtMajorCollection &&
2116           ((gc_cause != GCCause::_java_lang_system_gc) ||
2117             UseAdaptiveSizePolicyWithSystemGC)) {
2118         // Calculate optimal free space amounts
2119         assert(young_gen->max_size() >
2120           young_gen->from_space()->capacity_in_bytes() +
2121           young_gen->to_space()->capacity_in_bytes(),
2122           "Sizes of space in young gen are out-of-bounds");
2123 
2124         size_t young_live = young_gen->used_in_bytes();
2125         size_t eden_live = young_gen->eden_space()->used_in_bytes();
2126         size_t old_live = old_gen->used_in_bytes();
2127         size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
2128         size_t max_old_gen_size = old_gen->max_gen_size();
2129         size_t max_eden_size = young_gen->max_size() -
2130           young_gen->from_space()->capacity_in_bytes() -
2131           young_gen->to_space()->capacity_in_bytes();
2132 
2133         // Used for diagnostics
2134         size_policy->clear_generation_free_space_flags();
2135 
2136         size_policy->compute_generations_free_space(young_live,




2061 
2062     if (TraceGen1Time) accumulated_time()->start();
2063 
2064     // Let the size policy know we're starting
2065     size_policy->major_collection_begin();
2066 
2067     CodeCache::gc_prologue();
2068     Threads::gc_prologue();
2069 
2070     COMPILER2_PRESENT(DerivedPointerTable::clear());
2071 
2072     ref_processor()->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/);
2073     ref_processor()->setup_policy(maximum_heap_compaction);
2074 
2075     bool marked_for_unloading = false;
2076 
2077     marking_start.update();
2078     marking_phase(vmthread_cm, maximum_heap_compaction, &_gc_tracer);
2079 
2080     bool max_on_system_gc = UseMaximumCompactionOnSystemGC
2081       && GCCause::is_user_requested_gc(gc_cause);
2082     summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc);
2083 
2084     COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity"));
2085     COMPILER2_PRESENT(DerivedPointerTable::set_active(false));
2086 
2087     // adjust_roots() updates Universe::_intArrayKlassObj which is
2088     // needed by the compaction for filling holes in the dense prefix.
2089     adjust_roots();
2090 
2091     compaction_start.update();
2092     compact();
2093 
2094     // Reset the mark bitmap, summary data, and do other bookkeeping.  Must be
2095     // done before resizing.
2096     post_compact();
2097 
2098     // Let the size policy know we're done
2099     size_policy->major_collection_end(old_gen->used_in_bytes(), gc_cause);
2100 
2101     if (UseAdaptiveSizePolicy) {
2102       if (PrintAdaptiveSizePolicy) {
2103         gclog_or_tty->print("AdaptiveSizeStart: ");
2104         gclog_or_tty->stamp();
2105         gclog_or_tty->print_cr(" collection: %d ",
2106                        heap->total_collections());
2107         if (Verbose) {
2108           gclog_or_tty->print("old_gen_capacity: %d young_gen_capacity: %d",
2109             old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
2110         }
2111       }
2112 
2113       // Don't check if the size_policy is ready here.  Let
2114       // the size_policy check that internally.
2115       if (UseAdaptiveGenerationSizePolicyAtMajorCollection &&
2116           (!GCCause::is_user_requested_gc(gc_cause) ||
2117             UseAdaptiveSizePolicyWithSystemGC)) {
2118         // Calculate optimal free space amounts
2119         assert(young_gen->max_size() >
2120           young_gen->from_space()->capacity_in_bytes() +
2121           young_gen->to_space()->capacity_in_bytes(),
2122           "Sizes of space in young gen are out-of-bounds");
2123 
2124         size_t young_live = young_gen->used_in_bytes();
2125         size_t eden_live = young_gen->eden_space()->used_in_bytes();
2126         size_t old_live = old_gen->used_in_bytes();
2127         size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
2128         size_t max_old_gen_size = old_gen->max_gen_size();
2129         size_t max_eden_size = young_gen->max_size() -
2130           young_gen->from_space()->capacity_in_bytes() -
2131           young_gen->to_space()->capacity_in_bytes();
2132 
2133         // Used for diagnostics
2134         size_policy->clear_generation_free_space_flags();
2135 
2136         size_policy->compute_generations_free_space(young_live,


< prev index next >