318 static uint get_compilation_id() { return _compilation_id; } 319 320 // Set _should_block. 321 // Call this from the VM, with Threads_lock held and a safepoint requested. 322 static void set_should_block(); 323 324 // Call this from the compiler at convenient points, to poll for _should_block. 325 static void maybe_block(); 326 327 enum CompilerActivity { 328 // Flags for toggling compiler activity 329 stop_compilation = 0, 330 run_compilation = 1, 331 shutdown_compilation = 2 332 }; 333 334 static jint get_compilation_activity_mode() { return _should_compile_new_jobs; } 335 static bool should_compile_new_jobs() { return UseCompiler && (_should_compile_new_jobs == run_compilation); } 336 static bool set_should_compile_new_jobs(jint new_state) { 337 // Return success if the current caller set it 338 jint old = Atomic::cmpxchg(new_state, &_should_compile_new_jobs, 1-new_state); 339 bool success = (old == (1-new_state)); 340 if (success) { 341 if (new_state == run_compilation) { 342 _total_compiler_restarted_count++; 343 } else { 344 _total_compiler_stopped_count++; 345 } 346 } 347 return success; 348 } 349 350 static void disable_compilation_forever() { 351 UseCompiler = false; 352 AlwaysCompileLoopMethods = false; 353 Atomic::xchg(&_should_compile_new_jobs, jint(shutdown_compilation)); 354 } 355 356 static bool is_compilation_disabled_forever() { 357 return _should_compile_new_jobs == shutdown_compilation; 358 } 359 static void handle_full_code_cache(int code_blob_type); 360 // Ensures that warning is only printed once. 361 static bool should_print_compiler_warning() { 362 jint old = Atomic::cmpxchg(1, &_print_compilation_warning, 0); 363 return old == 0; 364 } 365 // Return total compilation ticks 366 static jlong total_compilation_ticks() { 367 return _perf_total_compilation != NULL ? _perf_total_compilation->get_value() : 0; 368 } 369 370 // Redefine Classes support 371 static void mark_on_stack(); 372 373 #if INCLUDE_JVMCI 374 // Print curent compilation time stats for a given compiler 375 static void print_times(AbstractCompiler* comp); 376 #endif 377 378 // Print a detailed accounting of compilation time 379 static void print_times(bool per_compiler = true, bool aggregate = true); 380 381 // compiler name for debugging 382 static const char* compiler_name(int comp_level); | 318 static uint get_compilation_id() { return _compilation_id; } 319 320 // Set _should_block. 321 // Call this from the VM, with Threads_lock held and a safepoint requested. 322 static void set_should_block(); 323 324 // Call this from the compiler at convenient points, to poll for _should_block. 325 static void maybe_block(); 326 327 enum CompilerActivity { 328 // Flags for toggling compiler activity 329 stop_compilation = 0, 330 run_compilation = 1, 331 shutdown_compilation = 2 332 }; 333 334 static jint get_compilation_activity_mode() { return _should_compile_new_jobs; } 335 static bool should_compile_new_jobs() { return UseCompiler && (_should_compile_new_jobs == run_compilation); } 336 static bool set_should_compile_new_jobs(jint new_state) { 337 // Return success if the current caller set it 338 jint old = Atomic::cmpxchg(&_should_compile_new_jobs, 1-new_state, new_state); 339 bool success = (old == (1-new_state)); 340 if (success) { 341 if (new_state == run_compilation) { 342 _total_compiler_restarted_count++; 343 } else { 344 _total_compiler_stopped_count++; 345 } 346 } 347 return success; 348 } 349 350 static void disable_compilation_forever() { 351 UseCompiler = false; 352 AlwaysCompileLoopMethods = false; 353 Atomic::xchg(&_should_compile_new_jobs, jint(shutdown_compilation)); 354 } 355 356 static bool is_compilation_disabled_forever() { 357 return _should_compile_new_jobs == shutdown_compilation; 358 } 359 static void handle_full_code_cache(int code_blob_type); 360 // Ensures that warning is only printed once. 361 static bool should_print_compiler_warning() { 362 jint old = Atomic::cmpxchg(&_print_compilation_warning, 0, 1); 363 return old == 0; 364 } 365 // Return total compilation ticks 366 static jlong total_compilation_ticks() { 367 return _perf_total_compilation != NULL ? _perf_total_compilation->get_value() : 0; 368 } 369 370 // Redefine Classes support 371 static void mark_on_stack(); 372 373 #if INCLUDE_JVMCI 374 // Print curent compilation time stats for a given compiler 375 static void print_times(AbstractCompiler* comp); 376 #endif 377 378 // Print a detailed accounting of compilation time 379 static void print_times(bool per_compiler = true, bool aggregate = true); 380 381 // compiler name for debugging 382 static const char* compiler_name(int comp_level); |