From 2d134422f9d6a3925d2e9b1ed373aea1eb78fd80 Mon Sep 17 00:00:00 2001 From: vlivanov Date: Mon, 14 Jul 2014 03:26:52 -0700 Subject: [PATCH] 8049530: Provide descriptive failure reason for compilation tasks removed for the queue Reviewed-by: roland, iveresov --- src/share/vm/ci/ciEnv.cpp | 3 --- src/share/vm/compiler/compileBroker.cpp | 9 +++++++++ src/share/vm/compiler/compileBroker.hpp | 5 +++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/share/vm/ci/ciEnv.cpp b/src/share/vm/ci/ciEnv.cpp index 00e6d09f2..a76999019 100644 --- a/src/share/vm/ci/ciEnv.cpp +++ b/src/share/vm/ci/ciEnv.cpp @@ -1112,9 +1112,6 @@ int ciEnv::num_inlined_bytecodes() const { // ------------------------------------------------------------------ // ciEnv::record_failure() void ciEnv::record_failure(const char* reason) { - if (log() != NULL) { - log()->elem("failure reason='%s'", reason); - } if (_failure_reason == NULL) { // Record the first failure reason. _failure_reason = reason; diff --git a/src/share/vm/compiler/compileBroker.cpp b/src/share/vm/compiler/compileBroker.cpp index cb3737aaf..89563ef69 100644 --- a/src/share/vm/compiler/compileBroker.cpp +++ b/src/share/vm/compiler/compileBroker.cpp @@ -287,6 +287,7 @@ void CompileTask::initialize(int compile_id, _hot_count = hot_count; _time_queued = 0; // tidy _comment = comment; + _failure_reason = NULL; if (LogCompilation) { _time_queued = os::elapsed_counter(); @@ -565,6 +566,11 @@ void CompileTask::log_task_done(CompileLog* log) { methodHandle method(thread, this->method()); ResourceMark rm(thread); + if (!_is_success) { + const char* reason = _failure_reason != NULL ? _failure_reason : "unknown"; + log->elem("failure reason='%s'", reason); + } + // nmethod* nm = code(); log->begin_elem("task_done success='%d' nmsize='%d' count='%d'", @@ -714,6 +720,7 @@ void CompileQueue::purge_stale_tasks() { for (CompileTask* task = head; task != NULL; ) { CompileTask* next_task = task->next(); CompileTaskWrapper ctw(task); // Frees the task + task->set_failure_reason("stale task"); task = next_task; } } @@ -1788,6 +1795,7 @@ void CompileBroker::compiler_thread_loop() { } else { // After compilation is disabled, remove remaining methods from queue method->clear_queued_for_compilation(); + task->set_failure_reason("compilation is disabled"); } } } @@ -1975,6 +1983,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { compilable = ci_env.compilable(); if (ci_env.failing()) { + task->set_failure_reason(ci_env.failure_reason()); const char* retry_message = ci_env.retry_message(); if (_compilation_log != NULL) { _compilation_log->log_failure(thread, task, ci_env.failure_reason(), retry_message); diff --git a/src/share/vm/compiler/compileBroker.hpp b/src/share/vm/compiler/compileBroker.hpp index 68fa9c790..49b6da1a4 100644 --- a/src/share/vm/compiler/compileBroker.hpp +++ b/src/share/vm/compiler/compileBroker.hpp @@ -59,6 +59,7 @@ class CompileTask : public CHeapObj { jobject _hot_method_holder; int _hot_count; // information about its invocation counter const char* _comment; // more info about the task + const char* _failure_reason; public: CompileTask() { @@ -130,6 +131,10 @@ public: void log_task_queued(); void log_task_start(CompileLog* log); void log_task_done(CompileLog* log); + + void set_failure_reason(const char* reason) { + _failure_reason = reason; + } }; // CompilerCounters -- GitLab