< prev index next >

src/hotspot/share/compiler/compileBroker.hpp

Print this page
rev 49289 : 8198756: Lazy allocation of compiler threads
Reviewed-by:


 144  public:
 145   enum {
 146     name_buffer_length = 100
 147   };
 148 
 149   // Compile type Information for print_last_compile() and CompilerCounters
 150   enum { no_compile, normal_compile, osr_compile, native_compile };
 151   static int assign_compile_id (const methodHandle& method, int osr_bci);
 152 
 153 
 154  private:
 155   static bool _initialized;
 156   static volatile bool _should_block;
 157 
 158   // This flag can be used to stop compilation or turn it back on
 159   static volatile jint _should_compile_new_jobs;
 160 
 161   // The installed compiler(s)
 162   static AbstractCompiler* _compilers[2];
 163 






 164   // These counters are used for assigning id's to each compilation
 165   static volatile jint _compilation_id;
 166   static volatile jint _osr_compilation_id;
 167 
 168   static int  _last_compile_type;
 169   static int  _last_compile_level;
 170   static char _last_method_compiled[name_buffer_length];
 171 
 172   static CompileQueue* _c2_compile_queue;
 173   static CompileQueue* _c1_compile_queue;
 174 
 175   // performance counters
 176   static PerfCounter* _perf_total_compilation;
 177   static PerfCounter* _perf_native_compilation;
 178   static PerfCounter* _perf_osr_compilation;
 179   static PerfCounter* _perf_standard_compilation;
 180 
 181   static PerfCounter* _perf_total_bailout_count;
 182   static PerfCounter* _perf_total_invalidated_count;
 183   static PerfCounter* _perf_total_compile_count;


 202   static elapsedTimer _t_total_compilation;
 203   static elapsedTimer _t_osr_compilation;
 204   static elapsedTimer _t_standard_compilation;
 205   static elapsedTimer _t_invalidated_compilation;
 206   static elapsedTimer _t_bailedout_compilation;
 207 
 208   static int _total_compile_count;
 209   static int _total_bailout_count;
 210   static int _total_invalidated_count;
 211   static int _total_native_compile_count;
 212   static int _total_osr_compile_count;
 213   static int _total_standard_compile_count;
 214   static int _sum_osr_bytes_compiled;
 215   static int _sum_standard_bytes_compiled;
 216   static int _sum_nmethod_size;
 217   static int _sum_nmethod_code_size;
 218   static long _peak_compilation_time;
 219 
 220   static volatile int _print_compilation_warning;
 221 
 222   static JavaThread* make_thread(const char* name, CompileQueue* queue, CompilerCounters* counters, AbstractCompiler* comp, bool compiler_thread, TRAPS);
 223   static void init_compiler_sweeper_threads(int c1_compiler_count, int c2_compiler_count);



 224   static bool compilation_is_complete  (const methodHandle& method, int osr_bci, int comp_level);
 225   static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded);
 226   static void preload_classes          (const methodHandle& method, TRAPS);
 227 
 228   static CompileTask* create_compile_task(CompileQueue*       queue,
 229                                           int                 compile_id,
 230                                           const methodHandle& method,
 231                                           int                 osr_bci,
 232                                           int                 comp_level,
 233                                           const methodHandle& hot_method,
 234                                           int                 hot_count,
 235                                           CompileTask::CompileReason compile_reason,
 236                                           bool                blocking);
 237   static void wait_for_completion(CompileTask* task);
 238 #if INCLUDE_JVMCI
 239   static bool wait_for_jvmci_completion(JVMCICompiler* comp, CompileTask* task, JavaThread* thread);
 240 #endif
 241 
 242   static void invoke_compiler_on_method(CompileTask* task);
 243   static void post_compile(CompilerThread* thread, CompileTask* task, EventCompilation& event, bool success, ciEnv* ci_env);


 348   static jlong total_compilation_ticks() {
 349     return _perf_total_compilation != NULL ? _perf_total_compilation->get_value() : 0;
 350   }
 351 
 352   // Redefine Classes support
 353   static void mark_on_stack();
 354 
 355 #if INCLUDE_JVMCI
 356   // Print curent compilation time stats for a given compiler
 357   static void print_times(AbstractCompiler* comp);
 358 #endif
 359 
 360   // Print a detailed accounting of compilation time
 361   static void print_times(bool per_compiler = true, bool aggregate = true);
 362 
 363   // Debugging output for failure
 364   static void print_last_compile();
 365 
 366   // compiler name for debugging
 367   static const char* compiler_name(int comp_level);













 368 
 369   static int get_total_compile_count() {          return _total_compile_count; }
 370   static int get_total_bailout_count() {          return _total_bailout_count; }
 371   static int get_total_invalidated_count() {      return _total_invalidated_count; }
 372   static int get_total_native_compile_count() {   return _total_native_compile_count; }
 373   static int get_total_osr_compile_count() {      return _total_osr_compile_count; }
 374   static int get_total_standard_compile_count() { return _total_standard_compile_count; }
 375   static int get_sum_osr_bytes_compiled() {       return _sum_osr_bytes_compiled; }
 376   static int get_sum_standard_bytes_compiled() {  return _sum_standard_bytes_compiled; }
 377   static int get_sum_nmethod_size() {             return _sum_nmethod_size;}
 378   static int get_sum_nmethod_code_size() {        return _sum_nmethod_code_size; }
 379   static long get_peak_compilation_time() {       return _peak_compilation_time; }
 380   static long get_total_compilation_time() {      return _t_total_compilation.milliseconds(); }
 381 
 382   // Log that compilation profiling is skipped because metaspace is full.
 383   static void log_metaspace_failure();
 384 };
 385 
 386 #endif // SHARE_VM_COMPILER_COMPILEBROKER_HPP


 144  public:
 145   enum {
 146     name_buffer_length = 100
 147   };
 148 
 149   // Compile type Information for print_last_compile() and CompilerCounters
 150   enum { no_compile, normal_compile, osr_compile, native_compile };
 151   static int assign_compile_id (const methodHandle& method, int osr_bci);
 152 
 153 
 154  private:
 155   static bool _initialized;
 156   static volatile bool _should_block;
 157 
 158   // This flag can be used to stop compilation or turn it back on
 159   static volatile jint _should_compile_new_jobs;
 160 
 161   // The installed compiler(s)
 162   static AbstractCompiler* _compilers[2];
 163 
 164   // The maximum numbers of compiler threads to be determined during startup.
 165   static int c1_count, c2_count;
 166 
 167   // An array of compiler thread Java objects
 168   static jobject *_compiler1_objects, *_compiler2_objects;
 169 
 170   // These counters are used for assigning id's to each compilation
 171   static volatile jint _compilation_id;
 172   static volatile jint _osr_compilation_id;
 173 
 174   static int  _last_compile_type;
 175   static int  _last_compile_level;
 176   static char _last_method_compiled[name_buffer_length];
 177 
 178   static CompileQueue* _c2_compile_queue;
 179   static CompileQueue* _c1_compile_queue;
 180 
 181   // performance counters
 182   static PerfCounter* _perf_total_compilation;
 183   static PerfCounter* _perf_native_compilation;
 184   static PerfCounter* _perf_osr_compilation;
 185   static PerfCounter* _perf_standard_compilation;
 186 
 187   static PerfCounter* _perf_total_bailout_count;
 188   static PerfCounter* _perf_total_invalidated_count;
 189   static PerfCounter* _perf_total_compile_count;


 208   static elapsedTimer _t_total_compilation;
 209   static elapsedTimer _t_osr_compilation;
 210   static elapsedTimer _t_standard_compilation;
 211   static elapsedTimer _t_invalidated_compilation;
 212   static elapsedTimer _t_bailedout_compilation;
 213 
 214   static int _total_compile_count;
 215   static int _total_bailout_count;
 216   static int _total_invalidated_count;
 217   static int _total_native_compile_count;
 218   static int _total_osr_compile_count;
 219   static int _total_standard_compile_count;
 220   static int _sum_osr_bytes_compiled;
 221   static int _sum_standard_bytes_compiled;
 222   static int _sum_nmethod_size;
 223   static int _sum_nmethod_code_size;
 224   static long _peak_compilation_time;
 225 
 226   static volatile int _print_compilation_warning;
 227 
 228   static oop create_thread_oop(const char* name, TRAPS);
 229   static JavaThread* make_thread(jobject thread_oop, CompileQueue* queue,
 230                                  AbstractCompiler* comp, bool compiler_thread, TRAPS);
 231   static void init_compiler_sweeper_threads();
 232   static void possibly_add_compiler_threads();
 233   static bool compilation_is_complete  (const methodHandle& method, int osr_bci, int comp_level);
 234   static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded);
 235   static void preload_classes          (const methodHandle& method, TRAPS);
 236 
 237   static CompileTask* create_compile_task(CompileQueue*       queue,
 238                                           int                 compile_id,
 239                                           const methodHandle& method,
 240                                           int                 osr_bci,
 241                                           int                 comp_level,
 242                                           const methodHandle& hot_method,
 243                                           int                 hot_count,
 244                                           CompileTask::CompileReason compile_reason,
 245                                           bool                blocking);
 246   static void wait_for_completion(CompileTask* task);
 247 #if INCLUDE_JVMCI
 248   static bool wait_for_jvmci_completion(JVMCICompiler* comp, CompileTask* task, JavaThread* thread);
 249 #endif
 250 
 251   static void invoke_compiler_on_method(CompileTask* task);
 252   static void post_compile(CompilerThread* thread, CompileTask* task, EventCompilation& event, bool success, ciEnv* ci_env);


 357   static jlong total_compilation_ticks() {
 358     return _perf_total_compilation != NULL ? _perf_total_compilation->get_value() : 0;
 359   }
 360 
 361   // Redefine Classes support
 362   static void mark_on_stack();
 363 
 364 #if INCLUDE_JVMCI
 365   // Print curent compilation time stats for a given compiler
 366   static void print_times(AbstractCompiler* comp);
 367 #endif
 368 
 369   // Print a detailed accounting of compilation time
 370   static void print_times(bool per_compiler = true, bool aggregate = true);
 371 
 372   // Debugging output for failure
 373   static void print_last_compile();
 374 
 375   // compiler name for debugging
 376   static const char* compiler_name(int comp_level);
 377 
 378   // Provide access to compiler thread Java objects
 379   static jobject compiler1_object(int idx) {
 380     assert(_compiler1_objects != NULL, "must be initialized");
 381     assert(idx < c1_count, "oob");
 382     return _compiler1_objects[idx];
 383   }
 384 
 385   static jobject compiler2_object(int idx) {
 386     assert(_compiler2_objects != NULL, "must be initialized");
 387     assert(idx < c2_count, "oob");
 388     return _compiler2_objects[idx];
 389   }
 390 
 391   static int get_total_compile_count() {          return _total_compile_count; }
 392   static int get_total_bailout_count() {          return _total_bailout_count; }
 393   static int get_total_invalidated_count() {      return _total_invalidated_count; }
 394   static int get_total_native_compile_count() {   return _total_native_compile_count; }
 395   static int get_total_osr_compile_count() {      return _total_osr_compile_count; }
 396   static int get_total_standard_compile_count() { return _total_standard_compile_count; }
 397   static int get_sum_osr_bytes_compiled() {       return _sum_osr_bytes_compiled; }
 398   static int get_sum_standard_bytes_compiled() {  return _sum_standard_bytes_compiled; }
 399   static int get_sum_nmethod_size() {             return _sum_nmethod_size;}
 400   static int get_sum_nmethod_code_size() {        return _sum_nmethod_code_size; }
 401   static long get_peak_compilation_time() {       return _peak_compilation_time; }
 402   static long get_total_compilation_time() {      return _t_total_compilation.milliseconds(); }
 403 
 404   // Log that compilation profiling is skipped because metaspace is full.
 405   static void log_metaspace_failure();
 406 };
 407 
 408 #endif // SHARE_VM_COMPILER_COMPILEBROKER_HPP
< prev index next >