hotspot/src/share/vm/compiler/compileBroker.cpp
changeset 37296 613278eb2a1e
parent 37267 ad8c0e8de29f
parent 37281 c4e7456d6ae1
child 38036 f51b942d970c
equal deleted inserted replaced
37268:b2c690909eea 37296:613278eb2a1e
   387   {
   387   {
   388     NoSafepointVerifier nsv;
   388     NoSafepointVerifier nsv;
   389     task = CompilationPolicy::policy()->select_task(this);
   389     task = CompilationPolicy::policy()->select_task(this);
   390   }
   390   }
   391 
   391 
   392   // Save method pointers across unlock safepoint.  The task is removed from
   392   if (task != NULL) {
   393   // the compilation queue, which is walked during RedefineClasses.
   393     // Save method pointers across unlock safepoint.  The task is removed from
   394   save_method = methodHandle(task->method());
   394     // the compilation queue, which is walked during RedefineClasses.
   395   save_hot_method = methodHandle(task->hot_method());
   395     save_method = methodHandle(task->method());
   396 
   396     save_hot_method = methodHandle(task->hot_method());
   397   remove(task);
   397 
   398   purge_stale_tasks(); // may temporarily release MCQ lock
   398     remove(task);
       
   399     purge_stale_tasks(); // may temporarily release MCQ lock
       
   400   }
       
   401 
   399   return task;
   402   return task;
   400 }
   403 }
   401 
   404 
   402 // Clean & deallocate stale compile tasks.
   405 // Clean & deallocate stale compile tasks.
   403 // Temporarily releases MethodCompileQueue lock.
   406 // Temporarily releases MethodCompileQueue lock.
  1782   uint compile_id = task->compile_id();
  1785   uint compile_id = task->compile_id();
  1783   int osr_bci = task->osr_bci();
  1786   int osr_bci = task->osr_bci();
  1784   bool is_osr = (osr_bci != standard_entry_bci);
  1787   bool is_osr = (osr_bci != standard_entry_bci);
  1785   bool should_log = (thread->log() != NULL);
  1788   bool should_log = (thread->log() != NULL);
  1786   bool should_break = false;
  1789   bool should_break = false;
  1787   int task_level = task->comp_level();
  1790   const int task_level = task->comp_level();
       
  1791   AbstractCompiler* comp = task->compiler();
  1788 
  1792 
  1789   DirectiveSet* directive;
  1793   DirectiveSet* directive;
  1790   {
  1794   {
  1791     // create the handle inside it's own block so it can't
  1795     // create the handle inside it's own block so it can't
  1792     // accidentally be referenced once the thread transitions to
  1796     // accidentally be referenced once the thread transitions to
  1794     // any cases where this occurs in the future.
  1798     // any cases where this occurs in the future.
  1795     methodHandle method(thread, task->method());
  1799     methodHandle method(thread, task->method());
  1796     assert(!method->is_native(), "no longer compile natives");
  1800     assert(!method->is_native(), "no longer compile natives");
  1797 
  1801 
  1798     // Look up matching directives
  1802     // Look up matching directives
  1799     directive = DirectivesStack::getMatchingDirective(method, compiler(task_level));
  1803     directive = DirectivesStack::getMatchingDirective(method, comp);
  1800 
  1804 
  1801     // Save information about this method in case of failure.
  1805     // Save information about this method in case of failure.
  1802     set_last_compile(thread, method, is_osr, task_level);
  1806     set_last_compile(thread, method, is_osr, task_level);
  1803 
  1807 
  1804     DTRACE_METHOD_COMPILE_BEGIN_PROBE(method, compiler_name(task_level));
  1808     DTRACE_METHOD_COMPILE_BEGIN_PROBE(method, compiler_name(task_level));
  1813   push_jni_handle_block();
  1817   push_jni_handle_block();
  1814   Method* target_handle = task->method();
  1818   Method* target_handle = task->method();
  1815   int compilable = ciEnv::MethodCompilable;
  1819   int compilable = ciEnv::MethodCompilable;
  1816   const char* failure_reason = NULL;
  1820   const char* failure_reason = NULL;
  1817   const char* retry_message = NULL;
  1821   const char* retry_message = NULL;
  1818   AbstractCompiler *comp = compiler(task_level);
       
  1819 
  1822 
  1820   int system_dictionary_modification_counter;
  1823   int system_dictionary_modification_counter;
  1821   {
  1824   {
  1822     MutexLocker locker(Compile_lock, thread);
  1825     MutexLocker locker(Compile_lock, thread);
  1823     system_dictionary_modification_counter = SystemDictionary::number_of_modifications();
  1826     system_dictionary_modification_counter = SystemDictionary::number_of_modifications();
  1824   }
  1827   }
       
  1828 
  1825 #if INCLUDE_JVMCI
  1829 #if INCLUDE_JVMCI
  1826   if (UseJVMCICompiler && comp != NULL && comp->is_jvmci()) {
  1830   if (UseJVMCICompiler && comp != NULL && comp->is_jvmci()) {
  1827     JVMCICompiler* jvmci = (JVMCICompiler*) comp;
  1831     JVMCICompiler* jvmci = (JVMCICompiler*) comp;
  1828 
  1832 
  1829     TraceTime t1("compilation", &time);
  1833     TraceTime t1("compilation", &time);