Top


定義場所(file name)

hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp

名前(function name)

CollectionSetChooser::CollectionSetChooser() :

本体部(body)

  {- -------------------------------------------
  (1) フィールドの初期化

      (なおコメントによると, 
       _markedRegions の初期化部分はかなり hackery.
       やりたいことは "_markedRegions(100, true)" というだけのことなんだが, 
       GenericGrowableArray() 内の assert() をパスするためには 
       allocation_type を ResourceObj::C_HEAP に変えておく必要がある.
       そのためカンマ式にして, 
       ResourceObj::set_allocation_type() で allocation_type を変更してから
       コンストラクタが呼ばれるようにしている, 
       とのこと.
      ---------------------------------------- -}

      // The line below is the worst bit of C++ hackery I've ever written
      // (Detlefs, 11/23).  You should think of it as equivalent to
      // "_regions(100, true)": initialize the growable array and inform it
      // that it should allocate its elem array(s) on the C heap.
      //
      // The first argument, however, is actually a comma expression
      // (set_allocation_type(this, C_HEAP), 100). The purpose of the
      // set_allocation_type() call is to replace the default allocation
      // type for embedded objects STACK_OR_EMBEDDED with C_HEAP. It will
      // allow to pass the assert in GenericGrowableArray() which checks
      // that a growable array object must be on C heap if elements are.
      //
      // Note: containing object is allocated on C heap since it is CHeapObj.
      //
      _markedRegions((ResourceObj::set_allocation_type((address)&_markedRegions,
                                                 ResourceObj::C_HEAP),
                      100),
                     true),
      _curMarkedIndex(0),
      _numMarkedRegions(0),
      _unmarked_age_1_returned_as_new(false),
      _first_par_unreserved_idx(0)
    {}

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