Top


定義場所(file name)

hotspot/src/share/vm/oops/klassVtable.cpp

説明(description)

// Initialization

名前(function name)

void klassItable::initialize_itable(bool checkconstraints, TRAPS) {

本体部(body)

  {- -------------------------------------------
  (1) 起動中の場合 (= Universe::is_bootstrapping() が true の場合) や
      対象がインターフェースである場合, 
      または itable が空の場合は
      (することはないので) ここでリターン.
      ---------------------------------------- -}

      // Cannot be setup doing bootstrapping, interfaces don't have
      // itables, and klass with only ones entry have empty itables
      if (Universe::is_bootstrapping() ||
          _klass->is_interface() ||
          _klass->itable_length() == itableOffsetEntry::size()) return;

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

      // There's alway an extra itable entry so we can null-terminate it.
      guarantee(size_offset_table() >= 1, "too small");
      int num_interfaces = size_offset_table() - 1;

  {- -------------------------------------------
  (1) インターフェースの数だけループし, 
      それぞれに klassItable::initialize_itable_for_interface() を呼んで
      itable の初期化を行う.
      ---------------------------------------- -}

      if (num_interfaces > 0) {
        if (TraceItables) tty->print_cr("%3d: Initializing itables for %s", ++initialize_count,
                                        _klass->name()->as_C_string());


        // Iterate through all interfaces
        int i;
        for(i = 0; i < num_interfaces; i++) {
          itableOffsetEntry* ioe = offset_entry(i);
          KlassHandle interf_h (THREAD, ioe->interface_klass());
          assert(interf_h() != NULL && ioe->offset() != 0, "bad offset entry in itable");
          initialize_itable_for_interface(ioe->offset(), interf_h, checkconstraints, CHECK);
        }

      }

  {- -------------------------------------------
  (1) (guarantee) (≈ assert)
      ---------------------------------------- -}

      // Check that the last entry is empty
      itableOffsetEntry* ioe = offset_entry(size_offset_table() - 1);
      guarantee(ioe->interface_klass() == NULL && ioe->offset() == 0, "terminator entry missing");
    }

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