8049530: Provide descriptive failure reason for compilation tasks removed for the queue
authorvlivanov
Mon, 14 Jul 2014 03:26:52 -0700
changeset 25642 9d809ea074d9
parent 25641 d99065e4572b
child 25643 4ff52a1e3a23
8049530: Provide descriptive failure reason for compilation tasks removed for the queue Reviewed-by: roland, iveresov
hotspot/src/share/vm/ci/ciEnv.cpp
hotspot/src/share/vm/compiler/compileBroker.cpp
hotspot/src/share/vm/compiler/compileBroker.hpp
--- a/hotspot/src/share/vm/ci/ciEnv.cpp	Mon Jul 14 03:25:40 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp	Mon Jul 14 03:26:52 2014 -0700
@@ -1125,9 +1125,6 @@
 // ------------------------------------------------------------------
 // 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;
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Mon Jul 14 03:25:40 2014 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Mon Jul 14 03:26:52 2014 -0700
@@ -297,6 +297,7 @@
   _hot_count = hot_count;
   _time_queued = 0;  // tidy
   _comment = comment;
+  _failure_reason = NULL;
 
   if (LogCompilation) {
     _time_queued = os::elapsed_counter();
@@ -566,6 +567,11 @@
   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);
+  }
+
   // <task_done ... stamp='1.234'>  </task>
   nmethod* nm = code();
   log->begin_elem("task_done success='%d' nmsize='%d' count='%d'",
@@ -733,6 +739,7 @@
       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;
       }
     }
@@ -1786,6 +1793,7 @@
       } else {
         // After compilation is disabled, remove remaining methods from queue
         method->clear_queued_for_compilation();
+        task->set_failure_reason("compilation is disabled");
       }
     }
   }
@@ -1973,6 +1981,7 @@
     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);
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp	Mon Jul 14 03:25:40 2014 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp	Mon Jul 14 03:26:52 2014 -0700
@@ -64,6 +64,7 @@
   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() {
@@ -138,6 +139,10 @@
   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