src/share/vm/compiler/compileBroker.hpp

changeset 5919
469216acdb28
parent 5237
f2110083203d
child 6099
78da3894b86f
equal deleted inserted replaced
5915:8b80b262e501 5919:469216acdb28
211 bool is_empty() const { return _first == NULL; } 211 bool is_empty() const { return _first == NULL; }
212 int size() const { return _size; } 212 int size() const { return _size; }
213 213
214 // Redefine Classes support 214 // Redefine Classes support
215 void mark_on_stack(); 215 void mark_on_stack();
216 216 void delete_all();
217 void print(); 217 void print();
218
219 ~CompileQueue() {
220 assert (is_empty(), " Compile Queue must be empty");
221 }
218 }; 222 };
219 223
220 // CompileTaskWrapper 224 // CompileTaskWrapper
221 // 225 //
222 // Assign this task to the current thread. Deallocate the task 226 // Assign this task to the current thread. Deallocate the task
264 268
265 static CompileQueue* _c2_method_queue; 269 static CompileQueue* _c2_method_queue;
266 static CompileQueue* _c1_method_queue; 270 static CompileQueue* _c1_method_queue;
267 static CompileTask* _task_free_list; 271 static CompileTask* _task_free_list;
268 272
269 static GrowableArray<CompilerThread*>* _method_threads; 273 static GrowableArray<CompilerThread*>* _compiler_threads;
270 274
271 // performance counters 275 // performance counters
272 static PerfCounter* _perf_total_compilation; 276 static PerfCounter* _perf_total_compilation;
273 static PerfCounter* _perf_native_compilation; 277 static PerfCounter* _perf_native_compilation;
274 static PerfCounter* _perf_osr_compilation; 278 static PerfCounter* _perf_osr_compilation;
309 static int _sum_standard_bytes_compiled; 313 static int _sum_standard_bytes_compiled;
310 static int _sum_nmethod_size; 314 static int _sum_nmethod_size;
311 static int _sum_nmethod_code_size; 315 static int _sum_nmethod_code_size;
312 static long _peak_compilation_time; 316 static long _peak_compilation_time;
313 317
314 static CompilerThread* make_compiler_thread(const char* name, CompileQueue* queue, CompilerCounters* counters, TRAPS); 318 static CompilerThread* make_compiler_thread(const char* name, CompileQueue* queue, CompilerCounters* counters, AbstractCompiler* comp, TRAPS);
315 static void init_compiler_threads(int c1_compiler_count, int c2_compiler_count); 319 static void init_compiler_threads(int c1_compiler_count, int c2_compiler_count);
316 static bool compilation_is_complete (methodHandle method, int osr_bci, int comp_level); 320 static bool compilation_is_complete (methodHandle method, int osr_bci, int comp_level);
317 static bool compilation_is_prohibited(methodHandle method, int osr_bci, int comp_level); 321 static bool compilation_is_prohibited(methodHandle method, int osr_bci, int comp_level);
318 static uint assign_compile_id (methodHandle method, int osr_bci); 322 static uint assign_compile_id (methodHandle method, int osr_bci);
319 static bool is_compile_blocking (methodHandle method, int osr_bci); 323 static bool is_compile_blocking (methodHandle method, int osr_bci);
349 static CompileQueue* compile_queue(int comp_level) { 353 static CompileQueue* compile_queue(int comp_level) {
350 if (is_c2_compile(comp_level)) return _c2_method_queue; 354 if (is_c2_compile(comp_level)) return _c2_method_queue;
351 if (is_c1_compile(comp_level)) return _c1_method_queue; 355 if (is_c1_compile(comp_level)) return _c1_method_queue;
352 return NULL; 356 return NULL;
353 } 357 }
358 static bool init_compiler_runtime();
359 static void shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread);
360
354 public: 361 public:
355 enum { 362 enum {
356 // The entry bci used for non-OSR compilations. 363 // The entry bci used for non-OSR compilations.
357 standard_entry_bci = InvocationEntryBci 364 standard_entry_bci = InvocationEntryBci
358 }; 365 };
376 methodHandle hot_method, 383 methodHandle hot_method,
377 int hot_count, 384 int hot_count,
378 const char* comment, Thread* thread); 385 const char* comment, Thread* thread);
379 386
380 static void compiler_thread_loop(); 387 static void compiler_thread_loop();
381
382 static uint get_compilation_id() { return _compilation_id; } 388 static uint get_compilation_id() { return _compilation_id; }
383 static bool is_idle();
384 389
385 // Set _should_block. 390 // Set _should_block.
386 // Call this from the VM, with Threads_lock held and a safepoint requested. 391 // Call this from the VM, with Threads_lock held and a safepoint requested.
387 static void set_should_block(); 392 static void set_should_block();
388 393
389 // Call this from the compiler at convenient points, to poll for _should_block. 394 // Call this from the compiler at convenient points, to poll for _should_block.
390 static void maybe_block(); 395 static void maybe_block();
391 396
392 enum { 397 enum {
393 // Flags for toggling compiler activity 398 // Flags for toggling compiler activity
394 stop_compilation = 0, 399 stop_compilation = 0,
395 run_compilation = 1 400 run_compilation = 1,
401 shutdown_compilaton = 2
396 }; 402 };
397 403
398 static bool should_compile_new_jobs() { return UseCompiler && (_should_compile_new_jobs == run_compilation); } 404 static bool should_compile_new_jobs() { return UseCompiler && (_should_compile_new_jobs == run_compilation); }
399 static bool set_should_compile_new_jobs(jint new_state) { 405 static bool set_should_compile_new_jobs(jint new_state) {
400 // Return success if the current caller set it 406 // Return success if the current caller set it
401 jint old = Atomic::cmpxchg(new_state, &_should_compile_new_jobs, 1-new_state); 407 jint old = Atomic::cmpxchg(new_state, &_should_compile_new_jobs, 1-new_state);
402 return (old == (1-new_state)); 408 return (old == (1-new_state));
409 }
410
411 static void disable_compilation_forever() {
412 UseCompiler = false;
413 AlwaysCompileLoopMethods = false;
414 Atomic::xchg(shutdown_compilaton, &_should_compile_new_jobs);
415 }
416
417 static bool is_compilation_disabled_forever() {
418 return _should_compile_new_jobs == shutdown_compilaton;
403 } 419 }
404 static void handle_full_code_cache(); 420 static void handle_full_code_cache();
405 421
406 // Return total compilation ticks 422 // Return total compilation ticks
407 static jlong total_compilation_ticks() { 423 static jlong total_compilation_ticks() {

mercurial