Top


定義場所(file name)

hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp

説明(description)

// This method contains all heap specific policy for invoking mark sweep.
// PSMarkSweep::invoke_no_policy() will only attempt to mark-sweep-compact
// the heap. It will do nothing further. If we need to bail out for policy
// reasons, scavenge before full gc, or any other specialized behavior, it
// needs to be added here.
//
// Note that this method should only be called from the vm_thread while
// at a safepoint!
//
// Note that the all_soft_refs_clear flag in the collector policy
// may be true because this method can be called without intervening
// activity.  For example when the heap space is tight and full measure
// are being taken to free space.

名前(function name)

void PSMarkSweep::invoke(bool maximum_heap_compaction) {

本体部(body)

  {- -------------------------------------------
  (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();
      GCCause::Cause gc_cause = heap->gc_cause();
      PSAdaptiveSizePolicy* policy = heap->size_policy();
      IsGCActiveMark mark;

  {- -------------------------------------------
  (1) ScavengeBeforeFullGC オプションが指定されていれば, Major GC を実行する前に
      PSScavenge::invoke_no_policy() を呼んで Minor GC を実行しておく.
      ---------------------------------------- -}

      if (ScavengeBeforeFullGC) {
        PSScavenge::invoke_no_policy();
      }

  {- -------------------------------------------
  (1) (変数宣言など)
      ---------------------------------------- -}

      const bool clear_all_soft_refs =
        heap->collector_policy()->should_clear_all_soft_refs();

      int count = (maximum_heap_compaction)?1:MarkSweepAlwaysCompactCount;
      IntFlagSetting flag_setting(MarkSweepAlwaysCompactCount, count);

  {- -------------------------------------------
  (1) PSMarkSweep::invoke_no_policy() を呼び出す.
      ---------------------------------------- -}

      PSMarkSweep::invoke_no_policy(clear_all_soft_refs || maximum_heap_compaction);
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.