340 tty->cr();
341 }
342
343 if (PrintSystemDictionaryAtExit) {
344 SystemDictionary::print();
345 }
346
347 if (LogTouchedMethods && PrintTouchedMethodsAtExit) {
348 Method::print_touched_methods(tty);
349 }
350
351 if (PrintBiasedLockingStatistics) {
352 BiasedLocking::print_counters();
353 }
354
355 // Native memory tracking data
356 if (PrintNMTStatistics) {
357 MemTracker::final_report(tty);
358 }
359
360 Threads::log_smr_statistics();
361 }
362
363 #else // PRODUCT MODE STATISTICS
364
365 void print_statistics() {
366
367 if (PrintMethodData) {
368 print_method_profiling_data();
369 }
370
371 if (CITime) {
372 CompileBroker::print_times();
373 }
374
375 if (PrintCodeCache) {
376 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
377 CodeCache::print();
378 }
379
380 if (PrintMethodFlushingStatistics) {
382 }
383
384 #ifdef COMPILER2
385 if (PrintPreciseBiasedLockingStatistics || PrintPreciseRTMLockingStatistics) {
386 OptoRuntime::print_named_counters();
387 }
388 #endif
389 if (PrintBiasedLockingStatistics) {
390 BiasedLocking::print_counters();
391 }
392
393 // Native memory tracking data
394 if (PrintNMTStatistics) {
395 MemTracker::final_report(tty);
396 }
397
398 if (LogTouchedMethods && PrintTouchedMethodsAtExit) {
399 Method::print_touched_methods(tty);
400 }
401
402 Threads::log_smr_statistics();
403 }
404
405 #endif
406
407 // Note: before_exit() can be executed only once, if more than one threads
408 // are trying to shutdown the VM at the same time, only one thread
409 // can run before_exit() and all other threads must wait.
410 void before_exit(JavaThread* thread) {
411 #define BEFORE_EXIT_NOT_RUN 0
412 #define BEFORE_EXIT_RUNNING 1
413 #define BEFORE_EXIT_DONE 2
414 static jint volatile _before_exit_status = BEFORE_EXIT_NOT_RUN;
415
416 // Note: don't use a Mutex to guard the entire before_exit(), as
417 // JVMTI post_thread_end_event and post_vm_death_event will run native code.
418 // A CAS or OSMutex would work just fine but then we need to manipulate
419 // thread state for Safepoint. Here we use Monitor wait() and notify_all()
420 // for synchronization.
421 { MutexLocker ml(BeforeExit_lock);
422 switch (_before_exit_status) {
|
340 tty->cr();
341 }
342
343 if (PrintSystemDictionaryAtExit) {
344 SystemDictionary::print();
345 }
346
347 if (LogTouchedMethods && PrintTouchedMethodsAtExit) {
348 Method::print_touched_methods(tty);
349 }
350
351 if (PrintBiasedLockingStatistics) {
352 BiasedLocking::print_counters();
353 }
354
355 // Native memory tracking data
356 if (PrintNMTStatistics) {
357 MemTracker::final_report(tty);
358 }
359
360 ThreadsSMRSupport::log_smr_statistics();
361 }
362
363 #else // PRODUCT MODE STATISTICS
364
365 void print_statistics() {
366
367 if (PrintMethodData) {
368 print_method_profiling_data();
369 }
370
371 if (CITime) {
372 CompileBroker::print_times();
373 }
374
375 if (PrintCodeCache) {
376 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
377 CodeCache::print();
378 }
379
380 if (PrintMethodFlushingStatistics) {
382 }
383
384 #ifdef COMPILER2
385 if (PrintPreciseBiasedLockingStatistics || PrintPreciseRTMLockingStatistics) {
386 OptoRuntime::print_named_counters();
387 }
388 #endif
389 if (PrintBiasedLockingStatistics) {
390 BiasedLocking::print_counters();
391 }
392
393 // Native memory tracking data
394 if (PrintNMTStatistics) {
395 MemTracker::final_report(tty);
396 }
397
398 if (LogTouchedMethods && PrintTouchedMethodsAtExit) {
399 Method::print_touched_methods(tty);
400 }
401
402 ThreadsSMRSupport::log_smr_statistics();
403 }
404
405 #endif
406
407 // Note: before_exit() can be executed only once, if more than one threads
408 // are trying to shutdown the VM at the same time, only one thread
409 // can run before_exit() and all other threads must wait.
410 void before_exit(JavaThread* thread) {
411 #define BEFORE_EXIT_NOT_RUN 0
412 #define BEFORE_EXIT_RUNNING 1
413 #define BEFORE_EXIT_DONE 2
414 static jint volatile _before_exit_status = BEFORE_EXIT_NOT_RUN;
415
416 // Note: don't use a Mutex to guard the entire before_exit(), as
417 // JVMTI post_thread_end_event and post_vm_death_event will run native code.
418 // A CAS or OSMutex would work just fine but then we need to manipulate
419 // thread state for Safepoint. Here we use Monitor wait() and notify_all()
420 // for synchronization.
421 { MutexLocker ml(BeforeExit_lock);
422 switch (_before_exit_status) {
|