202 static PerfStringVariable* _perf_last_failed_method;
203 static PerfStringVariable* _perf_last_invalidated_method;
204 static PerfVariable* _perf_last_compile_type;
205 static PerfVariable* _perf_last_compile_size;
206 static PerfVariable* _perf_last_failed_type;
207 static PerfVariable* _perf_last_invalidated_type;
208
209 // Timers and counters for generating statistics
210 static elapsedTimer _t_total_compilation;
211 static elapsedTimer _t_osr_compilation;
212 static elapsedTimer _t_standard_compilation;
213 static elapsedTimer _t_invalidated_compilation;
214 static elapsedTimer _t_bailedout_compilation;
215
216 static int _total_compile_count;
217 static int _total_bailout_count;
218 static int _total_invalidated_count;
219 static int _total_native_compile_count;
220 static int _total_osr_compile_count;
221 static int _total_standard_compile_count;
222 static int _sum_osr_bytes_compiled;
223 static int _sum_standard_bytes_compiled;
224 static int _sum_nmethod_size;
225 static int _sum_nmethod_code_size;
226 static long _peak_compilation_time;
227
228 static volatile int _print_compilation_warning;
229
230 static Handle create_thread_oop(const char* name, TRAPS);
231 static JavaThread* make_thread(jobject thread_oop, CompileQueue* queue,
232 AbstractCompiler* comp, bool compiler_thread, TRAPS);
233 static void init_compiler_sweeper_threads();
234 static void possibly_add_compiler_threads();
235 static bool compilation_is_complete (const methodHandle& method, int osr_bci, int comp_level);
236 static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded);
237 static void preload_classes (const methodHandle& method, TRAPS);
238
239 static CompileTask* create_compile_task(CompileQueue* queue,
240 int compile_id,
241 const methodHandle& method,
321
322 // Set _should_block.
323 // Call this from the VM, with Threads_lock held and a safepoint requested.
324 static void set_should_block();
325
326 // Call this from the compiler at convenient points, to poll for _should_block.
327 static void maybe_block();
328
329 enum CompilerActivity {
330 // Flags for toggling compiler activity
331 stop_compilation = 0,
332 run_compilation = 1,
333 shutdown_compilation = 2
334 };
335
336 static jint get_compilation_activity_mode() { return _should_compile_new_jobs; }
337 static bool should_compile_new_jobs() { return UseCompiler && (_should_compile_new_jobs == run_compilation); }
338 static bool set_should_compile_new_jobs(jint new_state) {
339 // Return success if the current caller set it
340 jint old = Atomic::cmpxchg(new_state, &_should_compile_new_jobs, 1-new_state);
341 return (old == (1-new_state));
342 }
343
344 static void disable_compilation_forever() {
345 UseCompiler = false;
346 AlwaysCompileLoopMethods = false;
347 Atomic::xchg(jint(shutdown_compilation), &_should_compile_new_jobs);
348 }
349
350 static bool is_compilation_disabled_forever() {
351 return _should_compile_new_jobs == shutdown_compilation;
352 }
353 static void handle_full_code_cache(int code_blob_type);
354 // Ensures that warning is only printed once.
355 static bool should_print_compiler_warning() {
356 jint old = Atomic::cmpxchg(1, &_print_compilation_warning, 0);
357 return old == 0;
358 }
359 // Return total compilation ticks
360 static jlong total_compilation_ticks() {
361 return _perf_total_compilation != NULL ? _perf_total_compilation->get_value() : 0;
382 static jobject compiler1_object(int idx) {
383 assert(_compiler1_objects != NULL, "must be initialized");
384 assert(idx < _c1_count, "oob");
385 return _compiler1_objects[idx];
386 }
387
388 static jobject compiler2_object(int idx) {
389 assert(_compiler2_objects != NULL, "must be initialized");
390 assert(idx < _c2_count, "oob");
391 return _compiler2_objects[idx];
392 }
393
394 static CompileLog* get_log(CompilerThread* ct);
395
396 static int get_total_compile_count() { return _total_compile_count; }
397 static int get_total_bailout_count() { return _total_bailout_count; }
398 static int get_total_invalidated_count() { return _total_invalidated_count; }
399 static int get_total_native_compile_count() { return _total_native_compile_count; }
400 static int get_total_osr_compile_count() { return _total_osr_compile_count; }
401 static int get_total_standard_compile_count() { return _total_standard_compile_count; }
402 static int get_sum_osr_bytes_compiled() { return _sum_osr_bytes_compiled; }
403 static int get_sum_standard_bytes_compiled() { return _sum_standard_bytes_compiled; }
404 static int get_sum_nmethod_size() { return _sum_nmethod_size;}
405 static int get_sum_nmethod_code_size() { return _sum_nmethod_code_size; }
406 static long get_peak_compilation_time() { return _peak_compilation_time; }
407 static long get_total_compilation_time() { return _t_total_compilation.milliseconds(); }
408
409 // Log that compilation profiling is skipped because metaspace is full.
410 static void log_metaspace_failure();
411
412 // CodeHeap State Analytics.
413 static void print_info(outputStream *out);
414 static void print_heapinfo(outputStream *out, const char* function, const char* granularity );
415 };
416
417 #endif // SHARE_VM_COMPILER_COMPILEBROKER_HPP
|
202 static PerfStringVariable* _perf_last_failed_method;
203 static PerfStringVariable* _perf_last_invalidated_method;
204 static PerfVariable* _perf_last_compile_type;
205 static PerfVariable* _perf_last_compile_size;
206 static PerfVariable* _perf_last_failed_type;
207 static PerfVariable* _perf_last_invalidated_type;
208
209 // Timers and counters for generating statistics
210 static elapsedTimer _t_total_compilation;
211 static elapsedTimer _t_osr_compilation;
212 static elapsedTimer _t_standard_compilation;
213 static elapsedTimer _t_invalidated_compilation;
214 static elapsedTimer _t_bailedout_compilation;
215
216 static int _total_compile_count;
217 static int _total_bailout_count;
218 static int _total_invalidated_count;
219 static int _total_native_compile_count;
220 static int _total_osr_compile_count;
221 static int _total_standard_compile_count;
222 static int _total_compiler_stopped_count;
223 static int _total_compiler_restarted_count;
224 static int _sum_osr_bytes_compiled;
225 static int _sum_standard_bytes_compiled;
226 static int _sum_nmethod_size;
227 static int _sum_nmethod_code_size;
228 static long _peak_compilation_time;
229
230 static volatile int _print_compilation_warning;
231
232 static Handle create_thread_oop(const char* name, TRAPS);
233 static JavaThread* make_thread(jobject thread_oop, CompileQueue* queue,
234 AbstractCompiler* comp, bool compiler_thread, TRAPS);
235 static void init_compiler_sweeper_threads();
236 static void possibly_add_compiler_threads();
237 static bool compilation_is_complete (const methodHandle& method, int osr_bci, int comp_level);
238 static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded);
239 static void preload_classes (const methodHandle& method, TRAPS);
240
241 static CompileTask* create_compile_task(CompileQueue* queue,
242 int compile_id,
243 const methodHandle& method,
323
324 // Set _should_block.
325 // Call this from the VM, with Threads_lock held and a safepoint requested.
326 static void set_should_block();
327
328 // Call this from the compiler at convenient points, to poll for _should_block.
329 static void maybe_block();
330
331 enum CompilerActivity {
332 // Flags for toggling compiler activity
333 stop_compilation = 0,
334 run_compilation = 1,
335 shutdown_compilation = 2
336 };
337
338 static jint get_compilation_activity_mode() { return _should_compile_new_jobs; }
339 static bool should_compile_new_jobs() { return UseCompiler && (_should_compile_new_jobs == run_compilation); }
340 static bool set_should_compile_new_jobs(jint new_state) {
341 // Return success if the current caller set it
342 jint old = Atomic::cmpxchg(new_state, &_should_compile_new_jobs, 1-new_state);
343 bool success = (old == (1-new_state));
344 if (success) {
345 if (new_state == run_compilation) {
346 _total_compiler_restarted_count += 1;
347 } else {
348 _total_compiler_stopped_count += 1;
349 }
350 }
351 return success;
352 }
353
354 static void disable_compilation_forever() {
355 UseCompiler = false;
356 AlwaysCompileLoopMethods = false;
357 Atomic::xchg(jint(shutdown_compilation), &_should_compile_new_jobs);
358 }
359
360 static bool is_compilation_disabled_forever() {
361 return _should_compile_new_jobs == shutdown_compilation;
362 }
363 static void handle_full_code_cache(int code_blob_type);
364 // Ensures that warning is only printed once.
365 static bool should_print_compiler_warning() {
366 jint old = Atomic::cmpxchg(1, &_print_compilation_warning, 0);
367 return old == 0;
368 }
369 // Return total compilation ticks
370 static jlong total_compilation_ticks() {
371 return _perf_total_compilation != NULL ? _perf_total_compilation->get_value() : 0;
392 static jobject compiler1_object(int idx) {
393 assert(_compiler1_objects != NULL, "must be initialized");
394 assert(idx < _c1_count, "oob");
395 return _compiler1_objects[idx];
396 }
397
398 static jobject compiler2_object(int idx) {
399 assert(_compiler2_objects != NULL, "must be initialized");
400 assert(idx < _c2_count, "oob");
401 return _compiler2_objects[idx];
402 }
403
404 static CompileLog* get_log(CompilerThread* ct);
405
406 static int get_total_compile_count() { return _total_compile_count; }
407 static int get_total_bailout_count() { return _total_bailout_count; }
408 static int get_total_invalidated_count() { return _total_invalidated_count; }
409 static int get_total_native_compile_count() { return _total_native_compile_count; }
410 static int get_total_osr_compile_count() { return _total_osr_compile_count; }
411 static int get_total_standard_compile_count() { return _total_standard_compile_count; }
412 static int get_total_compiler_stopped_count() { return _total_compiler_stopped_count; }
413 static int get_total_compiler_restarted_count() { return _total_compiler_restarted_count; }
414 static int get_sum_osr_bytes_compiled() { return _sum_osr_bytes_compiled; }
415 static int get_sum_standard_bytes_compiled() { return _sum_standard_bytes_compiled; }
416 static int get_sum_nmethod_size() { return _sum_nmethod_size;}
417 static int get_sum_nmethod_code_size() { return _sum_nmethod_code_size; }
418 static long get_peak_compilation_time() { return _peak_compilation_time; }
419 static long get_total_compilation_time() { return _t_total_compilation.milliseconds(); }
420
421 // Log that compilation profiling is skipped because metaspace is full.
422 static void log_metaspace_failure();
423
424 // CodeHeap State Analytics.
425 static void print_info(outputStream *out);
426 static void print_heapinfo(outputStream *out, const char* function, const char* granularity );
427 };
428
429 #endif // SHARE_VM_COMPILER_COMPILEBROKER_HPP
|