Top


定義場所(file name)

hotspot/src/share/vm/memory/defNewGeneration.cpp

名前(function name)

DefNewGeneration::DefNewGeneration(ReservedSpace rs,
                                   size_t initial_size,
                                   int level,
                                   const char* policy)

本体部(body)

  {- -------------------------------------------
  (1) スーパークラスの初期化
      ---------------------------------------- -}

      : Generation(rs, initial_size, level),

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

        _promo_failure_drain_in_progress(false),
        _should_allocate_from_space(false)
    {

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

      MemRegion cmr((HeapWord*)_virtual_space.low(),
                    (HeapWord*)_virtual_space.high());

  {- -------------------------------------------
  (1) 
      ---------------------------------------- -}

      Universe::heap()->barrier_set()->resize_covered_region(cmr);

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

      (失敗したら, ここで異常終了させる)
      ---------------------------------------- -}

      if (GenCollectedHeap::heap()->collector_policy()->has_soft_ended_eden()) {
        _eden_space = new ConcEdenSpace(this);
      } else {
        _eden_space = new EdenSpace(this);
      }
      _from_space = new ContiguousSpace();
      _to_space   = new ContiguousSpace();

      if (_eden_space == NULL || _from_space == NULL || _to_space == NULL)
        vm_exit_during_initialization("Could not allocate a new gen space");

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

      // Compute the maximum eden and survivor space sizes. These sizes
      // are computed assuming the entire reserved space is committed.
      // These values are exported as performance counters.
      uintx alignment = GenCollectedHeap::heap()->collector_policy()->min_alignment();
      uintx size = _virtual_space.reserved_size();
      _max_survivor_size = compute_survivor_size(size, alignment);
      _max_eden_size = size - (2*_max_survivor_size);

      // allocate the performance counters

      // Generation counters -- generation 0, 3 subspaces
      _gen_counters = new GenerationCounters("new", 0, 3, &_virtual_space);
      _gc_counters = new CollectorCounters(policy, 0);

      _eden_counters = new CSpaceCounters("eden", 0, _max_eden_size, _eden_space,
                                          _gen_counters);
      _from_counters = new CSpaceCounters("s0", 1, _max_survivor_size, _from_space,
                                          _gen_counters);
      _to_counters = new CSpaceCounters("s1", 2, _max_survivor_size, _to_space,
                                        _gen_counters);

      compute_space_boundaries(0, SpaceDecorator::Clear, SpaceDecorator::Mangle);
      update_counters();
      _next_gen = NULL;
      _tenuring_threshold = MaxTenuringThreshold;
      _pretenure_size_threshold_words = PretenureSizeThreshold >> LogHeapWordSize;
    }

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