Top


定義場所(file name)

hotspot/src/share/vm/classfile/dictionary.cpp

説明(description)

// Add a loaded class to the system dictionary.
// Readers of the SystemDictionary aren't always locked, so _buckets
// is volatile. The store of the next field in the constructor is
// also cast to volatile;  we do this to ensure store order is maintained
// by the compilers.

名前(function name)

void Dictionary::add_klass(Symbol* class_name, Handle class_loader,
                           KlassHandle obj) {

本体部(body)

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

      assert_locked_or_safepoint(SystemDictionary_lock);
      assert(obj() != NULL, "adding NULL obj");
      assert(Klass::cast(obj())->name() == class_name, "sanity check on name");

  {- -------------------------------------------
  (1) 新しい DictionaryEntry オブジェクト (obj 引数で指定されたクラスに対応するもの) を作り, 
      この Dictionary オブジェクト内に登録する.
      ---------------------------------------- -}

      unsigned int hash = compute_hash(class_name, class_loader);
      int index = hash_to_index(hash);
      DictionaryEntry* entry = new_entry(hash, obj(), class_loader());
      add_entry(index, entry);
    }

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