Top


定義場所(file name)

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

名前(function name)

void ReferenceProcessor::init_statics() {

本体部(body)

  {- -------------------------------------------
  (1) 番兵(_sentinelRef)用のオブジェクトと 
      ReferencePolicy オブジェクト(_always_clear_soft_ref_policy, _default_soft_ref_policy) を生成し, 
      java_lang_ref_SoftReference::set_clock() で clock フィールドの値を初期化しておく.

      なお, この初期化処理中で何かが失敗したら, vm_exit_during_initialization().
      ---------------------------------------- -}

      assert(_sentinelRef == NULL, "should be initialized precisely once");
      EXCEPTION_MARK;
      _sentinelRef = instanceKlass::cast(
                        SystemDictionary::Reference_klass())->
                          allocate_permanent_instance(THREAD);

      // Initialize the master soft ref clock.
      java_lang_ref_SoftReference::set_clock(os::javaTimeMillis());

      if (HAS_PENDING_EXCEPTION) {
          Handle ex(THREAD, PENDING_EXCEPTION);
          vm_exit_during_initialization(ex);
      }
      assert(_sentinelRef != NULL && _sentinelRef->is_oop(),
             "Just constructed it!");
      _always_clear_soft_ref_policy = new AlwaysClearPolicy();
      _default_soft_ref_policy      = new COMPILER2_PRESENT(LRUMaxHeapPolicy())
                                          NOT_COMPILER2(LRUCurrentHeapPolicy());
      if (_always_clear_soft_ref_policy == NULL || _default_soft_ref_policy == NULL) {
        vm_exit_during_initialization("Could not allocate reference policy object");
      }
      guarantee(RefDiscoveryPolicy == ReferenceBasedDiscovery ||
                RefDiscoveryPolicy == ReferentBasedDiscovery,
                "Unrecongnized RefDiscoveryPolicy");
    }

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