comparison src/share/vm/compiler/compileBroker.hpp @ 13086:096c224171c4

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 20 Nov 2013 00:10:38 +0100
parents 836a62f43af9 78da3894b86f
children 5a4293f24642
comparison
equal deleted inserted replaced
12782:92b7ec34ddfa 13086:096c224171c4
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 volatile jint _print_compilation_warning;
319
320 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); 321 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); 322 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); 323 static bool compilation_is_prohibited(methodHandle method, int osr_bci, int comp_level);
318 static uint assign_compile_id (methodHandle method, int osr_bci); 324 static uint assign_compile_id (methodHandle method, int osr_bci);
319 static bool is_compile_blocking (methodHandle method, int osr_bci); 325 static bool is_compile_blocking (methodHandle method, int osr_bci);
349 static CompileQueue* compile_queue(int comp_level) { 355 static CompileQueue* compile_queue(int comp_level) {
350 if (is_c2_compile(comp_level)) return _c2_method_queue; 356 if (is_c2_compile(comp_level)) return _c2_method_queue;
351 if (is_c1_compile(comp_level)) return _c1_method_queue; 357 if (is_c1_compile(comp_level)) return _c1_method_queue;
352 return NULL; 358 return NULL;
353 } 359 }
360 static bool init_compiler_runtime();
361 static void shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread);
362
354 public: 363 public:
355 enum { 364 enum {
356 // The entry bci used for non-OSR compilations. 365 // The entry bci used for non-OSR compilations.
357 standard_entry_bci = InvocationEntryBci 366 standard_entry_bci = InvocationEntryBci
358 }; 367 };
376 methodHandle hot_method, 385 methodHandle hot_method,
377 int hot_count, 386 int hot_count,
378 const char* comment, Thread* thread); 387 const char* comment, Thread* thread);
379 388
380 static void compiler_thread_loop(); 389 static void compiler_thread_loop();
381
382 static uint get_compilation_id() { return _compilation_id; } 390 static uint get_compilation_id() { return _compilation_id; }
383 static bool is_idle();
384 391
385 // Set _should_block. 392 // Set _should_block.
386 // Call this from the VM, with Threads_lock held and a safepoint requested. 393 // Call this from the VM, with Threads_lock held and a safepoint requested.
387 static void set_should_block(); 394 static void set_should_block();
388 395
389 // Call this from the compiler at convenient points, to poll for _should_block. 396 // Call this from the compiler at convenient points, to poll for _should_block.
390 static void maybe_block(); 397 static void maybe_block();
391 398
392 enum { 399 enum {
393 // Flags for toggling compiler activity 400 // Flags for toggling compiler activity
394 stop_compilation = 0, 401 stop_compilation = 0,
395 run_compilation = 1 402 run_compilation = 1,
403 shutdown_compilaton = 2
396 }; 404 };
397 405
398 static bool should_compile_new_jobs() { return UseCompiler && (_should_compile_new_jobs == run_compilation); } 406 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) { 407 static bool set_should_compile_new_jobs(jint new_state) {
400 // Return success if the current caller set it 408 // Return success if the current caller set it
401 jint old = Atomic::cmpxchg(new_state, &_should_compile_new_jobs, 1-new_state); 409 jint old = Atomic::cmpxchg(new_state, &_should_compile_new_jobs, 1-new_state);
402 return (old == (1-new_state)); 410 return (old == (1-new_state));
403 } 411 }
412
413 static void disable_compilation_forever() {
414 UseCompiler = false;
415 AlwaysCompileLoopMethods = false;
416 Atomic::xchg(shutdown_compilaton, &_should_compile_new_jobs);
417 }
418
419 static bool is_compilation_disabled_forever() {
420 return _should_compile_new_jobs == shutdown_compilaton;
421 }
404 static void handle_full_code_cache(); 422 static void handle_full_code_cache();
405 423 // Ensures that warning is only printed once.
424 static bool should_print_compiler_warning() {
425 jint old = Atomic::cmpxchg(1, &_print_compilation_warning, 0);
426 return old == 0;
427 }
406 // Return total compilation ticks 428 // Return total compilation ticks
407 static jlong total_compilation_ticks() { 429 static jlong total_compilation_ticks() {
408 return _perf_total_compilation != NULL ? _perf_total_compilation->get_value() : 0; 430 return _perf_total_compilation != NULL ? _perf_total_compilation->get_value() : 0;
409 } 431 }
410 432