hotspot/src/share/vm/compiler/compileBroker.cpp
// ------------------------------------------------------------------
// CompileQueue::add
//
// Add a CompileTask to a CompileQueue
void CompileQueue::add(CompileTask* task) {
{- -------------------------------------------
(1) (assert)
---------------------------------------- -}
assert(lock()->owned_by_self(), "must own lock");
{- -------------------------------------------
(1)
---------------------------------------- -}
task->set_next(NULL);
task->set_prev(NULL);
if (_last == NULL) {
// The compile queue is empty.
assert(_first == NULL, "queue is empty");
_first = task;
_last = task;
} else {
// Append the task to the queue.
assert(_last->next() == NULL, "not last");
_last->set_next(task);
task->set_prev(_last);
_last = task;
}
++_size;
{- -------------------------------------------
(1) methodOopDesc::set_queued_for_compilation() を呼んで,
対象の methodOopDesc には JIT コンパイル要求が既に出ている印を付けておく.
(この情報は, JIT コンパイル要求が既に出ている場合は
同じ JIT コンパイルはせずに省略したりするために使われる.
See: CompileBroker::compilation_is_in_queue())
---------------------------------------- -}
// Mark the method as being in the compile queue.
((methodOop)JNIHandles::resolve(task->method_handle()))->set_queued_for_compilation();
{- -------------------------------------------
(1) (トレース出力)
---------------------------------------- -}
if (CIPrintCompileQueue) {
print();
}
{- -------------------------------------------
(1) (トレース出力)
---------------------------------------- -}
if (LogCompilation && xtty != NULL) {
task->log_task_queued();
}
{- -------------------------------------------
(1) JIT コンパイル要求が来たので, Monitor::notify_all() を呼んで
CompilerThread が(もし寝ていれば)起こしておく.
---------------------------------------- -}
// Notify CompilerThreads that a task is available.
lock()->notify_all();
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.