src/hotspot/share/compiler/compileBroker.cpp
changeset 55635 0fb70c9118ce
parent 55294 3493c1bc59fd
child 57758 91a758925be7
equal deleted inserted replaced
55634:0f1e29c77e50 55635:0fb70c9118ce
  1593   CompilerThread* thread = CompilerThread::current();
  1593   CompilerThread* thread = CompilerThread::current();
  1594   AbstractCompiler* comp = thread->compiler();
  1594   AbstractCompiler* comp = thread->compiler();
  1595   // Final sanity check - the compiler object must exist
  1595   // Final sanity check - the compiler object must exist
  1596   guarantee(comp != NULL, "Compiler object must exist");
  1596   guarantee(comp != NULL, "Compiler object must exist");
  1597 
  1597 
  1598   int system_dictionary_modification_counter;
       
  1599   {
       
  1600     MutexLocker locker(Compile_lock, thread);
       
  1601     system_dictionary_modification_counter = SystemDictionary::number_of_modifications();
       
  1602   }
       
  1603 
       
  1604   {
  1598   {
  1605     // Must switch to native to allocate ci_env
  1599     // Must switch to native to allocate ci_env
  1606     ThreadToNativeFromVM ttn(thread);
  1600     ThreadToNativeFromVM ttn(thread);
  1607     ciEnv ci_env(NULL, system_dictionary_modification_counter);
  1601     ciEnv ci_env((CompileTask*)NULL);
  1608     // Cache Jvmti state
  1602     // Cache Jvmti state
  1609     ci_env.cache_jvmti_state();
  1603     ci_env.cache_jvmti_state();
  1610     // Cache DTrace flags
  1604     // Cache DTrace flags
  1611     ci_env.cache_dtrace_flags();
  1605     ci_env.cache_dtrace_flags();
  1612 
  1606 
  2043   int compilable = ciEnv::MethodCompilable;
  2037   int compilable = ciEnv::MethodCompilable;
  2044   const char* failure_reason = NULL;
  2038   const char* failure_reason = NULL;
  2045   bool failure_reason_on_C_heap = false;
  2039   bool failure_reason_on_C_heap = false;
  2046   const char* retry_message = NULL;
  2040   const char* retry_message = NULL;
  2047 
  2041 
  2048   int system_dictionary_modification_counter;
       
  2049   {
       
  2050     MutexLocker locker(Compile_lock, thread);
       
  2051     system_dictionary_modification_counter = SystemDictionary::number_of_modifications();
       
  2052   }
       
  2053 
       
  2054 #if INCLUDE_JVMCI
  2042 #if INCLUDE_JVMCI
  2055   if (UseJVMCICompiler && comp != NULL && comp->is_jvmci()) {
  2043   if (UseJVMCICompiler && comp != NULL && comp->is_jvmci()) {
  2056     JVMCICompiler* jvmci = (JVMCICompiler*) comp;
  2044     JVMCICompiler* jvmci = (JVMCICompiler*) comp;
  2057 
  2045 
  2058     TraceTime t1("compilation", &time);
  2046     TraceTime t1("compilation", &time);
  2062     if (target_handle->is_old()) {
  2050     if (target_handle->is_old()) {
  2063       failure_reason = "redefined method";
  2051       failure_reason = "redefined method";
  2064       retry_message = "not retryable";
  2052       retry_message = "not retryable";
  2065       compilable = ciEnv::MethodCompilable_never;
  2053       compilable = ciEnv::MethodCompilable_never;
  2066     } else {
  2054     } else {
  2067       JVMCICompileState compile_state(task, system_dictionary_modification_counter);
  2055       JVMCICompileState compile_state(task);
  2068       JVMCIEnv env(thread, &compile_state, __FILE__, __LINE__);
  2056       JVMCIEnv env(thread, &compile_state, __FILE__, __LINE__);
  2069       methodHandle method(thread, target_handle);
  2057       methodHandle method(thread, target_handle);
  2070       env.runtime()->compile_method(&env, jvmci, method, osr_bci);
  2058       env.runtime()->compile_method(&env, jvmci, method, osr_bci);
  2071 
  2059 
  2072       failure_reason = compile_state.failure_reason();
  2060       failure_reason = compile_state.failure_reason();
  2088 #endif // INCLUDE_JVMCI
  2076 #endif // INCLUDE_JVMCI
  2089   {
  2077   {
  2090     NoHandleMark  nhm;
  2078     NoHandleMark  nhm;
  2091     ThreadToNativeFromVM ttn(thread);
  2079     ThreadToNativeFromVM ttn(thread);
  2092 
  2080 
  2093     ciEnv ci_env(task, system_dictionary_modification_counter);
  2081     ciEnv ci_env(task);
  2094     if (should_break) {
  2082     if (should_break) {
  2095       ci_env.set_break_at_compile(true);
  2083       ci_env.set_break_at_compile(true);
  2096     }
  2084     }
  2097     if (should_log) {
  2085     if (should_log) {
  2098       ci_env.set_log(thread->log());
  2086       ci_env.set_log(thread->log());