mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
Merge
This commit is contained in:
commit
622a5ae6f0
112 changed files with 2044 additions and 803 deletions
|
@ -169,6 +169,8 @@ long CompileBroker::_peak_compilation_time = 0;
|
|||
CompileQueue* CompileBroker::_c2_compile_queue = NULL;
|
||||
CompileQueue* CompileBroker::_c1_compile_queue = NULL;
|
||||
|
||||
|
||||
|
||||
class CompilationLog : public StringEventLog {
|
||||
public:
|
||||
CompilationLog() : StringEventLog("Compilation events") {
|
||||
|
@ -844,7 +846,7 @@ void CompileBroker::compile_method_base(const methodHandle& method,
|
|||
int comp_level,
|
||||
const methodHandle& hot_method,
|
||||
int hot_count,
|
||||
const char* comment,
|
||||
CompileTask::CompileReason compile_reason,
|
||||
bool blocking,
|
||||
Thread* thread) {
|
||||
guarantee(!method->is_abstract(), "cannot compile abstract methods");
|
||||
|
@ -860,7 +862,7 @@ void CompileBroker::compile_method_base(const methodHandle& method,
|
|||
if (osr_bci != InvocationEntryBci) {
|
||||
tty->print(" osr_bci: %d", osr_bci);
|
||||
}
|
||||
tty->print(" level: %d comment: %s count: %d", comp_level, comment, hot_count);
|
||||
tty->print(" level: %d comment: %s count: %d", comp_level, CompileTask::reason_name(compile_reason), hot_count);
|
||||
if (!hot_method.is_null()) {
|
||||
tty->print(" hot: ");
|
||||
if (hot_method() != method()) {
|
||||
|
@ -1024,7 +1026,7 @@ void CompileBroker::compile_method_base(const methodHandle& method,
|
|||
task = create_compile_task(queue,
|
||||
compile_id, method,
|
||||
osr_bci, comp_level,
|
||||
hot_method, hot_count, comment,
|
||||
hot_method, hot_count, compile_reason,
|
||||
blocking);
|
||||
}
|
||||
|
||||
|
@ -1036,15 +1038,18 @@ void CompileBroker::compile_method_base(const methodHandle& method,
|
|||
nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
|
||||
int comp_level,
|
||||
const methodHandle& hot_method, int hot_count,
|
||||
const char* comment, Thread* THREAD) {
|
||||
// do nothing if compilebroker is not available
|
||||
if (!_initialized) {
|
||||
CompileTask::CompileReason compile_reason,
|
||||
Thread* THREAD) {
|
||||
// Do nothing if compilebroker is not initalized or compiles are submitted on level none
|
||||
if (!_initialized || comp_level == CompLevel_none) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AbstractCompiler *comp = CompileBroker::compiler(comp_level);
|
||||
assert(comp != NULL, "Ensure we don't compile before compilebroker init");
|
||||
assert(comp != NULL, "Ensure we have a compiler");
|
||||
|
||||
DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, comp);
|
||||
nmethod* nm = CompileBroker::compile_method(method, osr_bci, comp_level, hot_method, hot_count, comment, directive, THREAD);
|
||||
nmethod* nm = CompileBroker::compile_method(method, osr_bci, comp_level, hot_method, hot_count, compile_reason, directive, THREAD);
|
||||
DirectivesStack::release(directive);
|
||||
return nm;
|
||||
}
|
||||
|
@ -1052,7 +1057,8 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
|
|||
nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
|
||||
int comp_level,
|
||||
const methodHandle& hot_method, int hot_count,
|
||||
const char* comment, DirectiveSet* directive,
|
||||
CompileTask::CompileReason compile_reason,
|
||||
DirectiveSet* directive,
|
||||
Thread* THREAD) {
|
||||
|
||||
// make sure arguments make sense
|
||||
|
@ -1178,7 +1184,7 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
|
|||
return NULL;
|
||||
}
|
||||
bool is_blocking = !directive->BackgroundCompilationOption || CompileTheWorld || ReplayCompiles;
|
||||
compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, is_blocking, THREAD);
|
||||
compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, compile_reason, is_blocking, THREAD);
|
||||
}
|
||||
|
||||
// return requested nmethod
|
||||
|
@ -1342,11 +1348,11 @@ CompileTask* CompileBroker::create_compile_task(CompileQueue* queue,
|
|||
int comp_level,
|
||||
const methodHandle& hot_method,
|
||||
int hot_count,
|
||||
const char* comment,
|
||||
CompileTask::CompileReason compile_reason,
|
||||
bool blocking) {
|
||||
CompileTask* new_task = CompileTask::allocate();
|
||||
new_task->initialize(compile_id, method, osr_bci, comp_level,
|
||||
hot_method, hot_count, comment,
|
||||
hot_method, hot_count, compile_reason,
|
||||
blocking);
|
||||
queue->add(new_task);
|
||||
return new_task;
|
||||
|
|
|
@ -232,7 +232,7 @@ class CompileBroker: AllStatic {
|
|||
int comp_level,
|
||||
const methodHandle& hot_method,
|
||||
int hot_count,
|
||||
const char* comment,
|
||||
CompileTask::CompileReason compile_reason,
|
||||
bool blocking);
|
||||
static void wait_for_completion(CompileTask* task);
|
||||
#if INCLUDE_JVMCI
|
||||
|
@ -251,7 +251,7 @@ class CompileBroker: AllStatic {
|
|||
int comp_level,
|
||||
const methodHandle& hot_method,
|
||||
int hot_count,
|
||||
const char* comment,
|
||||
CompileTask::CompileReason compile_reason,
|
||||
bool blocking,
|
||||
Thread* thread);
|
||||
|
||||
|
@ -289,14 +289,15 @@ public:
|
|||
int comp_level,
|
||||
const methodHandle& hot_method,
|
||||
int hot_count,
|
||||
const char* comment, Thread* thread);
|
||||
CompileTask::CompileReason compile_reason,
|
||||
Thread* thread);
|
||||
|
||||
static nmethod* compile_method(const methodHandle& method,
|
||||
int osr_bci,
|
||||
int comp_level,
|
||||
const methodHandle& hot_method,
|
||||
int hot_count,
|
||||
const char* comment,
|
||||
CompileTask::CompileReason compile_reason,
|
||||
DirectiveSet* directive,
|
||||
Thread* thread);
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ void CompileTask::initialize(int compile_id,
|
|||
int comp_level,
|
||||
const methodHandle& hot_method,
|
||||
int hot_count,
|
||||
const char* comment,
|
||||
CompileTask::CompileReason compile_reason,
|
||||
bool is_blocking) {
|
||||
assert(!_lock->is_locked(), "bad locking");
|
||||
|
||||
|
@ -104,7 +104,7 @@ void CompileTask::initialize(int compile_id,
|
|||
_hot_method_holder = NULL;
|
||||
_hot_count = hot_count;
|
||||
_time_queued = 0; // tidy
|
||||
_comment = comment;
|
||||
_compile_reason = compile_reason;
|
||||
_failure_reason = NULL;
|
||||
|
||||
if (LogCompilation) {
|
||||
|
@ -309,9 +309,9 @@ void CompileTask::log_task_queued() {
|
|||
|
||||
xtty->begin_elem("task_queued");
|
||||
log_task(xtty);
|
||||
if (_comment != NULL) {
|
||||
xtty->print(" comment='%s'", _comment);
|
||||
}
|
||||
assert(_compile_reason > CompileTask::Reason_None && _compile_reason < CompileTask::Reason_Count, "Valid values");
|
||||
xtty->print(" comment='%s'", reason_name(_compile_reason));
|
||||
|
||||
if (_hot_method != NULL) {
|
||||
methodHandle hot(thread, _hot_method);
|
||||
methodHandle method(thread, _method);
|
||||
|
@ -440,3 +440,5 @@ void CompileTask::print_inlining_inner(outputStream* st, ciMethod* method, int i
|
|||
}
|
||||
st->cr();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,39 @@ class CompileTask : public CHeapObj<mtCompiler> {
|
|||
friend class VMStructs;
|
||||
friend class JVMCIVMStructs;
|
||||
|
||||
public:
|
||||
// Different reasons for a compilation
|
||||
// The order is important - Reason_Whitebox and higher can not become
|
||||
// stale, see CompileTask::can_become_stale()
|
||||
// Also mapped to reason_names[]
|
||||
enum CompileReason {
|
||||
Reason_None,
|
||||
Reason_InvocationCount, // Simple/StackWalk-policy
|
||||
Reason_BackedgeCount, // Simple/StackWalk-policy
|
||||
Reason_Tiered, // Tiered-policy
|
||||
Reason_CTW, // Compile the world
|
||||
Reason_Replay, // ciReplay
|
||||
Reason_Whitebox, // Whitebox API
|
||||
Reason_MustBeCompiled, // Java callHelper, LinkResolver
|
||||
Reason_Bootstrap, // JVMCI bootstrap
|
||||
Reason_Count
|
||||
};
|
||||
|
||||
static const char* reason_name(CompileTask::CompileReason compile_reason) {
|
||||
static const char* reason_names[] = {
|
||||
"no_reason",
|
||||
"count",
|
||||
"backedge_count",
|
||||
"tiered",
|
||||
"CTW",
|
||||
"replay",
|
||||
"whitebox",
|
||||
"must_be_compiled",
|
||||
"bootstrap"
|
||||
};
|
||||
return reason_names[compile_reason];
|
||||
}
|
||||
|
||||
private:
|
||||
static CompileTask* _task_free_list;
|
||||
#ifdef ASSERT
|
||||
|
@ -69,7 +102,7 @@ class CompileTask : public CHeapObj<mtCompiler> {
|
|||
Method* _hot_method; // which method actually triggered this task
|
||||
jobject _hot_method_holder;
|
||||
int _hot_count; // information about its invocation counter
|
||||
const char* _comment; // more info about the task
|
||||
CompileReason _compile_reason; // more info about the task
|
||||
const char* _failure_reason;
|
||||
|
||||
public:
|
||||
|
@ -78,8 +111,8 @@ class CompileTask : public CHeapObj<mtCompiler> {
|
|||
}
|
||||
|
||||
void initialize(int compile_id, const methodHandle& method, int osr_bci, int comp_level,
|
||||
const methodHandle& hot_method, int hot_count, const char* comment,
|
||||
bool is_blocking);
|
||||
const methodHandle& hot_method, int hot_count,
|
||||
CompileTask::CompileReason compile_reason, bool is_blocking);
|
||||
|
||||
static CompileTask* allocate();
|
||||
static void free(CompileTask* task);
|
||||
|
@ -91,6 +124,15 @@ class CompileTask : public CHeapObj<mtCompiler> {
|
|||
bool is_complete() const { return _is_complete; }
|
||||
bool is_blocking() const { return _is_blocking; }
|
||||
bool is_success() const { return _is_success; }
|
||||
bool can_become_stale() const {
|
||||
switch (_compile_reason) {
|
||||
case Reason_BackedgeCount:
|
||||
case Reason_InvocationCount:
|
||||
case Reason_Tiered:
|
||||
return !_is_blocking;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#if INCLUDE_JVMCI
|
||||
bool has_waiter() const { return _has_waiter; }
|
||||
void clear_waiter() { _has_waiter = false; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue