hotspot/src/share/vm/compiler/compileBroker.cpp
changeset 35592 5814f874d736
parent 35576 1f1cca67a48e
child 35606 d873b64009cc
equal deleted inserted replaced
35591:35ab7c6816e9 35592:5814f874d736
  1796 
  1796 
  1797   // Allocate a new set of JNI handles.
  1797   // Allocate a new set of JNI handles.
  1798   push_jni_handle_block();
  1798   push_jni_handle_block();
  1799   Method* target_handle = task->method();
  1799   Method* target_handle = task->method();
  1800   int compilable = ciEnv::MethodCompilable;
  1800   int compilable = ciEnv::MethodCompilable;
       
  1801   const char* failure_reason = NULL;
       
  1802   const char* retry_message = NULL;
  1801   AbstractCompiler *comp = compiler(task_level);
  1803   AbstractCompiler *comp = compiler(task_level);
  1802 
  1804 
  1803   int system_dictionary_modification_counter;
  1805   int system_dictionary_modification_counter;
  1804   {
  1806   {
  1805     MutexLocker locker(Compile_lock, thread);
  1807     MutexLocker locker(Compile_lock, thread);
  1815     JVMCIEnv env(task, system_dictionary_modification_counter);
  1817     JVMCIEnv env(task, system_dictionary_modification_counter);
  1816     methodHandle method(thread, target_handle);
  1818     methodHandle method(thread, target_handle);
  1817     jvmci->compile_method(method, osr_bci, &env);
  1819     jvmci->compile_method(method, osr_bci, &env);
  1818 
  1820 
  1819     post_compile(thread, task, event, task->code() != NULL, NULL);
  1821     post_compile(thread, task, event, task->code() != NULL, NULL);
       
  1822 
       
  1823     failure_reason = env.failure_reason();
       
  1824     if (!env.retryable()) {
       
  1825       retry_message = "not retryable";
       
  1826       compilable = ciEnv::MethodCompilable_not_at_tier;
       
  1827     }
       
  1828 
  1820   } else
  1829   } else
  1821 #endif // INCLUDE_JVMCI
  1830 #endif // INCLUDE_JVMCI
  1822   {
  1831   {
  1823 
       
  1824     NoHandleMark  nhm;
  1832     NoHandleMark  nhm;
  1825     ThreadToNativeFromVM ttn(thread);
  1833     ThreadToNativeFromVM ttn(thread);
  1826 
  1834 
  1827     ciEnv ci_env(task, system_dictionary_modification_counter);
  1835     ciEnv ci_env(task, system_dictionary_modification_counter);
  1828     if (should_break) {
  1836     if (should_break) {
  1866 
  1874 
  1867     // Copy this bit to the enclosing block:
  1875     // Copy this bit to the enclosing block:
  1868     compilable = ci_env.compilable();
  1876     compilable = ci_env.compilable();
  1869 
  1877 
  1870     if (ci_env.failing()) {
  1878     if (ci_env.failing()) {
  1871       task->set_failure_reason(ci_env.failure_reason());
  1879       failure_reason = ci_env.failure_reason();
  1872       ci_env.report_failure(ci_env.failure_reason());
  1880       retry_message = ci_env.retry_message();
  1873       const char* retry_message = ci_env.retry_message();
  1881       ci_env.report_failure(failure_reason);
  1874       if (_compilation_log != NULL) {
       
  1875         _compilation_log->log_failure(thread, task, ci_env.failure_reason(), retry_message);
       
  1876       }
       
  1877       if (PrintCompilation) {
       
  1878         FormatBufferResource msg = retry_message != NULL ?
       
  1879             FormatBufferResource("COMPILE SKIPPED: %s (%s)", ci_env.failure_reason(), retry_message) :
       
  1880             FormatBufferResource("COMPILE SKIPPED: %s",      ci_env.failure_reason());
       
  1881         task->print(tty, msg);
       
  1882       }
       
  1883     }
  1882     }
  1884 
  1883 
  1885     post_compile(thread, task, event, !ci_env.failing(), &ci_env);
  1884     post_compile(thread, task, event, !ci_env.failing(), &ci_env);
  1886   }
  1885   }
       
  1886   // Remove the JNI handle block after the ciEnv destructor has run in
       
  1887   // the previous block.
  1887   pop_jni_handle_block();
  1888   pop_jni_handle_block();
       
  1889 
       
  1890   if (failure_reason != NULL) {
       
  1891     task->set_failure_reason(failure_reason);
       
  1892     if (_compilation_log != NULL) {
       
  1893       _compilation_log->log_failure(thread, task, failure_reason, retry_message);
       
  1894     }
       
  1895     if (PrintCompilation) {
       
  1896       FormatBufferResource msg = retry_message != NULL ?
       
  1897         FormatBufferResource("COMPILE SKIPPED: %s (%s)", failure_reason, retry_message) :
       
  1898         FormatBufferResource("COMPILE SKIPPED: %s",      failure_reason);
       
  1899       task->print(tty, msg);
       
  1900     }
       
  1901   }
  1888 
  1902 
  1889   methodHandle method(thread, task->method());
  1903   methodHandle method(thread, task->method());
  1890 
  1904 
  1891   DTRACE_METHOD_COMPILE_END_PROBE(method, compiler_name(task_level), task->is_success());
  1905   DTRACE_METHOD_COMPILE_END_PROBE(method, compiler_name(task_level), task->is_success());
  1892 
  1906