Top


定義場所(file name)

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

名前(function name)

void CallInfo::set_common(KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method, int vtable_index, TRAPS) {

本体部(body)

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

      assert(resolved_method->signature() == selected_method->signature(), "signatures must correspond");

  {- -------------------------------------------
  (1) (フィールドの初期化)
      ---------------------------------------- -}

      _resolved_klass  = resolved_klass;
      _selected_klass  = selected_klass;
      _resolved_method = resolved_method;
      _selected_method = selected_method;
      _vtable_index    = vtable_index;

  {- -------------------------------------------
  (1) 以下の条件が全て成り立つ場合は, CompileBroker::compile_method() を呼んで JIT コンパイルを行う.

      * resolve 対象のメソッドは, 呼び出し前であってもコンパイルするべきメソッド (= CompilationPolicy::must_be_compiled() が true)
      * カレントスレッドが CompilerThread ではない
      * resolve 対象のメソッドが所属するクラスは, 初期化が完了済み
      ---------------------------------------- -}

      if (CompilationPolicy::must_be_compiled(selected_method)) {
        // This path is unusual, mostly used by the '-Xcomp' stress test mode.

        // Note: with several active threads, the must_be_compiled may be true
        //       while can_be_compiled is false; remove assert
        // assert(CompilationPolicy::can_be_compiled(selected_method), "cannot compile");
        if (THREAD->is_Compiler_thread()) {
          // don't force compilation, resolve was on behalf of compiler
          return;
        }
        if (instanceKlass::cast(selected_method->method_holder())->is_not_initialized()) {
          // 'is_not_initialized' means not only '!is_initialized', but also that
          // initialization has not been started yet ('!being_initialized')
          // Do not force compilation of methods in uninitialized classes.
          // Note that doing this would throw an assert later,
          // in CompileBroker::compile_method.
          // We sometimes use the link resolver to do reflective lookups
          // even before classes are initialized.
          return;
        }
        CompileBroker::compile_method(selected_method, InvocationEntryBci,
                                      CompLevel_initial_compile,
                                      methodHandle(), 0, "must_be_compiled", CHECK);
      }
    }

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