src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-gc-gccause-full-gc Sdiff src/share/vm/gc_implementation/parallelScavenge

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

Print this page




2030   // miscellaneous bookkeeping.
2031   PreGCValues pre_gc_values;
2032   pre_compact(&pre_gc_values);
2033 
2034   // Get the compaction manager reserved for the VM thread.
2035   ParCompactionManager* const vmthread_cm =
2036     ParCompactionManager::manager_array(gc_task_manager()->workers());
2037 
2038   // Place after pre_compact() where the number of invocations is incremented.
2039   AdaptiveSizePolicyOutput(size_policy, heap->total_collections());
2040 
2041   {
2042     ResourceMark rm;
2043     HandleMark hm;
2044 
2045     // Set the number of GC threads to be used in this collection
2046     gc_task_manager()->set_active_gang();
2047     gc_task_manager()->task_idle_workers();
2048     heap->set_par_threads(gc_task_manager()->active_workers());
2049 
2050     const bool is_system_gc = gc_cause == GCCause::_java_lang_system_gc;
2051 
2052     // This is useful for debugging but don't change the output the
2053     // the customer sees.
2054     const char* gc_cause_str = "Full GC";
2055     if (is_system_gc && PrintGCDetails) {
2056       gc_cause_str = "Full GC (System)";
2057     }
2058     gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
2059     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
2060     TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty);
2061     TraceCollectorStats tcs(counters());
2062     TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
2063 
2064     if (TraceGen1Time) accumulated_time()->start();
2065 
2066     // Let the size policy know we're starting
2067     size_policy->major_collection_begin();
2068 
2069     // When collecting the permanent generation methodOops may be moving,
2070     // so we either have to flush all bcp data or convert it into bci.
2071     CodeCache::gc_prologue();
2072     Threads::gc_prologue();
2073 
2074     COMPILER2_PRESENT(DerivedPointerTable::clear());
2075 
2076     ref_processor()->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/);
2077     ref_processor()->setup_policy(maximum_heap_compaction);
2078 
2079     bool marked_for_unloading = false;
2080 
2081     marking_start.update();
2082     marking_phase(vmthread_cm, maximum_heap_compaction);
2083 
2084 #ifndef PRODUCT
2085     if (TraceParallelOldGCMarkingPhase) {
2086       gclog_or_tty->print_cr("marking_phase: cas_tries %d  cas_retries %d "
2087         "cas_by_another %d",
2088         mark_bitmap()->cas_tries(), mark_bitmap()->cas_retries(),
2089         mark_bitmap()->cas_by_another());
2090     }
2091 #endif  // #ifndef PRODUCT
2092 
2093     bool max_on_system_gc = UseMaximumCompactionOnSystemGC && is_system_gc;

2094     summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc);
2095 
2096     COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity"));
2097     COMPILER2_PRESENT(DerivedPointerTable::set_active(false));
2098 
2099     // adjust_roots() updates Universe::_intArrayKlassObj which is
2100     // needed by the compaction for filling holes in the dense prefix.
2101     adjust_roots();
2102 
2103     compaction_start.update();
2104     // Does the perm gen always have to be done serially because
2105     // klasses are used in the update of an object?
2106     compact_perm(vmthread_cm);
2107 
2108     compact();
2109 
2110     // Reset the mark bitmap, summary data, and do other bookkeeping.  Must be
2111     // done before resizing.
2112     post_compact();
2113 




2030   // miscellaneous bookkeeping.
2031   PreGCValues pre_gc_values;
2032   pre_compact(&pre_gc_values);
2033 
2034   // Get the compaction manager reserved for the VM thread.
2035   ParCompactionManager* const vmthread_cm =
2036     ParCompactionManager::manager_array(gc_task_manager()->workers());
2037 
2038   // Place after pre_compact() where the number of invocations is incremented.
2039   AdaptiveSizePolicyOutput(size_policy, heap->total_collections());
2040 
2041   {
2042     ResourceMark rm;
2043     HandleMark hm;
2044 
2045     // Set the number of GC threads to be used in this collection
2046     gc_task_manager()->set_active_gang();
2047     gc_task_manager()->task_idle_workers();
2048     heap->set_par_threads(gc_task_manager()->active_workers());
2049 








2050     gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
2051     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
2052     TraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty);
2053     TraceCollectorStats tcs(counters());
2054     TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
2055 
2056     if (TraceGen1Time) accumulated_time()->start();
2057 
2058     // Let the size policy know we're starting
2059     size_policy->major_collection_begin();
2060 
2061     // When collecting the permanent generation methodOops may be moving,
2062     // so we either have to flush all bcp data or convert it into bci.
2063     CodeCache::gc_prologue();
2064     Threads::gc_prologue();
2065 
2066     COMPILER2_PRESENT(DerivedPointerTable::clear());
2067 
2068     ref_processor()->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/);
2069     ref_processor()->setup_policy(maximum_heap_compaction);
2070 
2071     bool marked_for_unloading = false;
2072 
2073     marking_start.update();
2074     marking_phase(vmthread_cm, maximum_heap_compaction);
2075 
2076 #ifndef PRODUCT
2077     if (TraceParallelOldGCMarkingPhase) {
2078       gclog_or_tty->print_cr("marking_phase: cas_tries %d  cas_retries %d "
2079         "cas_by_another %d",
2080         mark_bitmap()->cas_tries(), mark_bitmap()->cas_retries(),
2081         mark_bitmap()->cas_by_another());
2082     }
2083 #endif  // #ifndef PRODUCT
2084 
2085     bool max_on_system_gc = UseMaximumCompactionOnSystemGC
2086       && gc_cause == GCCause::_java_lang_system_gc;
2087     summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc);
2088 
2089     COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity"));
2090     COMPILER2_PRESENT(DerivedPointerTable::set_active(false));
2091 
2092     // adjust_roots() updates Universe::_intArrayKlassObj which is
2093     // needed by the compaction for filling holes in the dense prefix.
2094     adjust_roots();
2095 
2096     compaction_start.update();
2097     // Does the perm gen always have to be done serially because
2098     // klasses are used in the update of an object?
2099     compact_perm(vmthread_cm);
2100 
2101     compact();
2102 
2103     // Reset the mark bitmap, summary data, and do other bookkeeping.  Must be
2104     // done before resizing.
2105     post_compact();
2106 


src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File