Top


定義場所(file name)

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

名前(function name)

void PSMarkSweep::mark_sweep_phase4() {

本体部(body)

  {- -------------------------------------------
  (1) (トレース出力)
      ---------------------------------------- -}

      EventMark m("4 compact heap");
      TraceTime tm("phase 4", PrintGCDetails && Verbose, true, gclog_or_tty);
      trace("4");

  {- -------------------------------------------
  (1) (この段階では, 全てのポインタはコンパクション後の新しいアドレスを指しているはず)

      (この phase4 で実際にオブジェクトを移動させる際には, まず Perm 領域から処理を行う.
       これは, instance の処理の際に class オブジェクト(klassOop)が正しい位置にあることを保証したいため)
      ---------------------------------------- -}

      // All pointers are now adjusted, move objects accordingly

      // It is imperative that we traverse perm_gen first in phase4. All
      // classes must be allocated earlier than their instances, and traversing
      // perm_gen first makes sure that all klassOops have moved to their new
      // location before any instance does a dispatch through it's klass!

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

      ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
      assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");

      PSYoungGen* young_gen = heap->young_gen();
      PSOldGen* old_gen = heap->old_gen();
      PSPermGen* perm_gen = heap->perm_gen();

  {- -------------------------------------------
  (1) 以下の関数を呼んで, 
      それぞれのヒープ領域について, その領域内のコンパクション処理を行う.
      * PSOldGen::compact()   (Perm 領域用)
      * PSOldGen::compact()   (Old 領域用)
      * PSYoungGen::compact() (New 領域用)
      ---------------------------------------- -}

      perm_gen->compact();
      old_gen->compact();
      young_gen->compact();
    }

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