Top


定義場所(file name)

hotspot/src/share/vm/interpreter/rewriter.cpp

説明(description)

// Computes a CPC map (new_index -> original_index) for constant pool entries
// that are referred to by the interpreter at runtime via the constant pool cache.
// Also computes a CP map (original_index -> new_index).
// Marks entries in CP which require additional processing.

名前(function name)

void Rewriter::compute_index_maps() {

本体部(body)

  {- -------------------------------------------
  (1) Constant Pool 中の全ての要素を辿り, 
      処理対象の各エントリ (Fieldref, Methodref, etc) に対応する
      新しい constant pool cache index を生成する.
      (この処理は Rewriter::add_cp_cache_entry() を呼び出すことで行われる)

      処理対象のエントリは以下の通り.
      * CONSTANT_InterfaceMethodref:
      * CONSTANT_Fieldref
      * CONSTANT_Methodref
      * CONSTANT_MethodHandle
      * CONSTANT_MethodType
      * CONSTANT_InvokeDynamic
      ---------------------------------------- -}

      const int length  = _pool->length();
      init_cp_map(length);
      jint tag_mask = 0;
      for (int i = 0; i < length; i++) {
        int tag = _pool->tag_at(i).value();
        tag_mask |= (1 << tag);
        switch (tag) {
          case JVM_CONSTANT_InterfaceMethodref:
          case JVM_CONSTANT_Fieldref          : // fall through
          case JVM_CONSTANT_Methodref         : // fall through
          case JVM_CONSTANT_MethodHandle      : // fall through
          case JVM_CONSTANT_MethodType        : // fall through
          case JVM_CONSTANT_InvokeDynamic     : // fall through
            add_cp_cache_entry(i);
            break;
        }
      }

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

      guarantee((int)_cp_cache_map.length()-1 <= (int)((u2)-1),
                "all cp cache indexes fit in a u2");

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

      _have_invoke_dynamic = ((tag_mask & (1 << JVM_CONSTANT_InvokeDynamic)) != 0);
    }

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