< prev index next >

src/share/vm/compiler/compileBroker.cpp

Print this page
rev 9941 : 8147432: JVMCI should report bailouts in PrintCompilation output

@@ -1792,14 +1792,14 @@
   should_break = directive->BreakAtExecuteOption || task->check_break_at_flags();
   if (should_log && !directive->LogOption) {
     should_log = false;
   }
 
-  // Allocate a new set of JNI handles.
-  push_jni_handle_block();
   Method* target_handle = task->method();
   int compilable = ciEnv::MethodCompilable;
+  const char* failure_reason = NULL;
+  const char* retry_message = NULL;
   AbstractCompiler *comp = compiler(task_level);
 
   int system_dictionary_modification_counter;
   {
     MutexLocker locker(Compile_lock, thread);

@@ -1815,13 +1815,22 @@
     JVMCIEnv env(task, system_dictionary_modification_counter);
     methodHandle method(thread, target_handle);
     jvmci->compile_method(method, osr_bci, &env);
 
     post_compile(thread, task, event, task->code() != NULL, NULL);
+
+    failure_reason = env.failure_reason();
+    if (!env.retryable()) {
+      retry_message = "not retryable";
+      compilable = ciEnv::MethodCompilable_not_at_tier;
+    }
+
   } else
 #endif // INCLUDE_JVMCI
   {
+    // Allocate a new set of JNI handles.
+    push_jni_handle_block();
 
     NoHandleMark  nhm;
     ThreadToNativeFromVM ttn(thread);
 
     ciEnv ci_env(task, system_dictionary_modification_counter);

@@ -1866,28 +1875,33 @@
 
     // Copy this bit to the enclosing block:
     compilable = ci_env.compilable();
 
     if (ci_env.failing()) {
-      task->set_failure_reason(ci_env.failure_reason());
+      failure_reason = ci_env.failure_reason();
+      retry_message = ci_env.retry_message();
       ci_env.report_failure(ci_env.failure_reason());
-      const char* retry_message = ci_env.retry_message();
+    }
+
+    post_compile(thread, task, event, !ci_env.failing(), &ci_env);
+
+    pop_jni_handle_block();
+  }
+
+  if (failure_reason != NULL) {
+    task->set_failure_reason(failure_reason);
       if (_compilation_log != NULL) {
-        _compilation_log->log_failure(thread, task, ci_env.failure_reason(), retry_message);
+      _compilation_log->log_failure(thread, task, failure_reason, retry_message);
       }
       if (PrintCompilation) {
         FormatBufferResource msg = retry_message != NULL ?
-            FormatBufferResource("COMPILE SKIPPED: %s (%s)", ci_env.failure_reason(), retry_message) :
-            FormatBufferResource("COMPILE SKIPPED: %s",      ci_env.failure_reason());
+        FormatBufferResource("COMPILE SKIPPED: %s (%s)", failure_reason, retry_message) :
+        FormatBufferResource("COMPILE SKIPPED: %s",      failure_reason);
         task->print(tty, msg);
       }
     }
 
-    post_compile(thread, task, event, !ci_env.failing(), &ci_env);
-  }
-  pop_jni_handle_block();
-
   methodHandle method(thread, task->method());
 
   DTRACE_METHOD_COMPILE_END_PROBE(method, compiler_name(task_level), task->is_success());
 
   collect_statistics(thread, time, task);
< prev index next >