Top


定義場所(file name)

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

説明(description)

// Creates a constant pool cache given a CPC map

名前(function name)

void Rewriter::make_constant_pool_cache(TRAPS) {

本体部(body)

  {- -------------------------------------------
  (1) 新しい constantPoolCacheOop オブジェクトを生成.
      (領域長として, rewrite 処理で数えた constant pool cache index の数を指定)
      ---------------------------------------- -}

      const int length = _cp_cache_map.length();
      constantPoolCacheOop cache =
          oopFactory::new_constantPoolCache(length, CHECK);

  {- -------------------------------------------
  (1) (No_Safepoint_Verifier)(= このブロック内では Safepoint 停止は起こらないはず)
      ---------------------------------------- -}

      No_Safepoint_Verifier nsv;

  {- -------------------------------------------
  (1) 生成した constantPoolCacheOop を初期化
      (rewrite 処理中に記録しておいた CP (constant pool) の index と 
      CPC (constant pool cache) の index の対応付けを記録)
      ---------------------------------------- -}

      cache->initialize(_cp_cache_map);

  {- -------------------------------------------
  (1) もし invokedynamic 命令が含まれていた場合は, 
      ConstantPoolCacheEntry::initialize_bootstrap_method_index_in_cache() を呼んで
      bootstrap method を指す index を
      対応する constant pool cache の index に置き換えておく.
      ---------------------------------------- -}

      // Don't bother with the next pass if there is no JVM_CONSTANT_InvokeDynamic.
      if (_have_invoke_dynamic) {
        for (int i = 0; i < length; i++) {
          int pool_index = cp_cache_entry_pool_index(i);
          if (pool_index >= 0 &&
              _pool->tag_at(pool_index).is_invoke_dynamic()) {
            int bsm_index = _pool->invoke_dynamic_bootstrap_method_ref_index_at(pool_index);
            assert(_pool->tag_at(bsm_index).is_method_handle(), "must be a MH constant");
            // There is a CP cache entry holding the BSM for these calls.
            int bsm_cache_index = cp_entry_to_cp_cache(bsm_index);
            cache->entry_at(i)->initialize_bootstrap_method_index_in_cache(bsm_cache_index);
          }
        }
      }

  {- -------------------------------------------
  (1) CP と CPC の間に相互参照を張る
      ---------------------------------------- -}

      _pool->set_cache(cache);
      cache->set_constant_pool(_pool());
    }

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