313 314 if (PrintVtableStats) { 315 klassVtable::print_statistics(); 316 klassItable::print_statistics(); 317 } 318 if (VerifyOops) { 319 tty->print_cr("+VerifyOops count: %d", StubRoutines::verify_oop_count()); 320 } 321 322 print_bytecode_count(); 323 if (PrintMallocStatistics) { 324 tty->print("allocation stats: "); 325 alloc_stats.print(); 326 tty->cr(); 327 } 328 329 if (PrintSystemDictionaryAtExit) { 330 SystemDictionary::print(); 331 } 332 333 if (PrintBiasedLockingStatistics) { 334 BiasedLocking::print_counters(); 335 } 336 337 #ifdef ENABLE_ZAP_DEAD_LOCALS 338 #ifdef COMPILER2 339 if (ZapDeadCompiledLocals) { 340 tty->print_cr("Compile::CompiledZap_count = %d", Compile::CompiledZap_count); 341 tty->print_cr("OptoRuntime::ZapDeadCompiledLocals_count = %d", OptoRuntime::ZapDeadCompiledLocals_count); 342 } 343 #endif // COMPILER2 344 #endif // ENABLE_ZAP_DEAD_LOCALS 345 // Native memory tracking data 346 if (PrintNMTStatistics) { 347 MemTracker::final_report(tty); 348 } 349 } 350 351 #else // PRODUCT MODE STATISTICS 352 365 CodeCache::print(); 366 } 367 368 if (PrintMethodFlushingStatistics) { 369 NMethodSweeper::print(); 370 } 371 372 #ifdef COMPILER2 373 if (PrintPreciseBiasedLockingStatistics || PrintPreciseRTMLockingStatistics) { 374 OptoRuntime::print_named_counters(); 375 } 376 #endif 377 if (PrintBiasedLockingStatistics) { 378 BiasedLocking::print_counters(); 379 } 380 381 // Native memory tracking data 382 if (PrintNMTStatistics) { 383 MemTracker::final_report(tty); 384 } 385 } 386 387 #endif 388 389 // Note: before_exit() can be executed only once, if more than one threads 390 // are trying to shutdown the VM at the same time, only one thread 391 // can run before_exit() and all other threads must wait. 392 void before_exit(JavaThread * thread) { 393 #define BEFORE_EXIT_NOT_RUN 0 394 #define BEFORE_EXIT_RUNNING 1 395 #define BEFORE_EXIT_DONE 2 396 static jint volatile _before_exit_status = BEFORE_EXIT_NOT_RUN; 397 398 // Note: don't use a Mutex to guard the entire before_exit(), as 399 // JVMTI post_thread_end_event and post_vm_death_event will run native code. 400 // A CAS or OSMutex would work just fine but then we need to manipulate 401 // thread state for Safepoint. Here we use Monitor wait() and notify_all() 402 // for synchronization. 403 { MutexLocker ml(BeforeExit_lock); 404 switch (_before_exit_status) { | 313 314 if (PrintVtableStats) { 315 klassVtable::print_statistics(); 316 klassItable::print_statistics(); 317 } 318 if (VerifyOops) { 319 tty->print_cr("+VerifyOops count: %d", StubRoutines::verify_oop_count()); 320 } 321 322 print_bytecode_count(); 323 if (PrintMallocStatistics) { 324 tty->print("allocation stats: "); 325 alloc_stats.print(); 326 tty->cr(); 327 } 328 329 if (PrintSystemDictionaryAtExit) { 330 SystemDictionary::print(); 331 } 332 333 if (PrintMethodUsageAtExit) { 334 Method::print_usage(tty); 335 } 336 337 if (PrintBiasedLockingStatistics) { 338 BiasedLocking::print_counters(); 339 } 340 341 #ifdef ENABLE_ZAP_DEAD_LOCALS 342 #ifdef COMPILER2 343 if (ZapDeadCompiledLocals) { 344 tty->print_cr("Compile::CompiledZap_count = %d", Compile::CompiledZap_count); 345 tty->print_cr("OptoRuntime::ZapDeadCompiledLocals_count = %d", OptoRuntime::ZapDeadCompiledLocals_count); 346 } 347 #endif // COMPILER2 348 #endif // ENABLE_ZAP_DEAD_LOCALS 349 // Native memory tracking data 350 if (PrintNMTStatistics) { 351 MemTracker::final_report(tty); 352 } 353 } 354 355 #else // PRODUCT MODE STATISTICS 356 369 CodeCache::print(); 370 } 371 372 if (PrintMethodFlushingStatistics) { 373 NMethodSweeper::print(); 374 } 375 376 #ifdef COMPILER2 377 if (PrintPreciseBiasedLockingStatistics || PrintPreciseRTMLockingStatistics) { 378 OptoRuntime::print_named_counters(); 379 } 380 #endif 381 if (PrintBiasedLockingStatistics) { 382 BiasedLocking::print_counters(); 383 } 384 385 // Native memory tracking data 386 if (PrintNMTStatistics) { 387 MemTracker::final_report(tty); 388 } 389 390 if (PrintMethodUsageAtExit) { 391 Method::print_usage(tty); 392 } 393 } 394 395 #endif 396 397 // Note: before_exit() can be executed only once, if more than one threads 398 // are trying to shutdown the VM at the same time, only one thread 399 // can run before_exit() and all other threads must wait. 400 void before_exit(JavaThread * thread) { 401 #define BEFORE_EXIT_NOT_RUN 0 402 #define BEFORE_EXIT_RUNNING 1 403 #define BEFORE_EXIT_DONE 2 404 static jint volatile _before_exit_status = BEFORE_EXIT_NOT_RUN; 405 406 // Note: don't use a Mutex to guard the entire before_exit(), as 407 // JVMTI post_thread_end_event and post_vm_death_event will run native code. 408 // A CAS or OSMutex would work just fine but then we need to manipulate 409 // thread state for Safepoint. Here we use Monitor wait() and notify_all() 410 // for synchronization. 411 { MutexLocker ml(BeforeExit_lock); 412 switch (_before_exit_status) { |