hotspot/src/share/vm/interpreter/linkResolver.cpp
void CallInfo::set_common(KlassHandle resolved_klass, KlassHandle selected_klass, methodHandle resolved_method, methodHandle selected_method, int vtable_index, TRAPS) {
{- -------------------------------------------
(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 コンパイルを開始させる.
(ただし, ... の場合は JIT コンパイルを開始させない)
(コメントによると,
これは普通は使われない実行パスで
主に -Xcomp による stress test mode で使われる処理,
とのこと)
---------------------------------------- -}
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.