hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
// This method contains all heap specific policy for invoking scavenge.
// PSScavenge::invoke_no_policy() will do nothing but attempt to
// scavenge. It will not clean up after failed promotions, bail out if
// we've exceeded policy time limits, or any other special behavior.
// All such policy should be placed here.
//
// Note that this method should only be called from the vm_thread while
// at a safepoint!
void PSScavenge::invoke() {
{- -------------------------------------------
(1) (assert)
---------------------------------------- -}
assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread");
assert(!Universe::heap()->is_gc_active(), "not reentrant");
{- -------------------------------------------
(1) (変数宣言など)
---------------------------------------- -}
ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
PSAdaptiveSizePolicy* policy = heap->size_policy();
IsGCActiveMark mark;
{- -------------------------------------------
(1) PSScavenge::invoke_no_policy() を呼び出して Minor GC 処理を行う.
---------------------------------------- -}
bool scavenge_was_done = PSScavenge::invoke_no_policy();
{- -------------------------------------------
(1) (変数宣言など)
---------------------------------------- -}
PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters();
{- -------------------------------------------
(1) (プロファイル情報の記録) (See: PSGCAdaptivePolicyCounters)
---------------------------------------- -}
if (UsePerfData)
counters->update_full_follows_scavenge(0);
{- -------------------------------------------
(1) もし, Minor GC 処理が失敗していたり, あるいは... #TODO であれば, Full GC 処理も行う.
---------------------------------------- -}
if (!scavenge_was_done ||
policy->should_full_GC(heap->old_gen()->free_in_bytes())) {
{- -------------------------------------------
(1.1) (プロファイル情報の記録) (See: PSGCAdaptivePolicyCounters)
---------------------------------------- -}
if (UsePerfData)
counters->update_full_follows_scavenge(full_follows_scavenge);
{- -------------------------------------------
(1.1)
---------------------------------------- -}
GCCauseSetter gccs(heap, GCCause::_adaptive_size_policy);
CollectorPolicy* cp = heap->collector_policy();
const bool clear_all_softrefs = cp->should_clear_all_soft_refs();
{- -------------------------------------------
(1.1) Full GC の実行
---------------------------------------- -}
if (UseParallelOldGC) {
PSParallelCompact::invoke_no_policy(clear_all_softrefs);
} else {
PSMarkSweep::invoke_no_policy(clear_all_softrefs);
}
}
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.