507 }
508
509 // Always call even when there are not JVMTI environments yet, since environments
510 // may be attached late and JVMTI must track phases of VM execution
511 JvmtiExport::post_vm_death();
512 Threads::shutdown_vm_agents();
513
514 // Terminate the signal thread
515 // Note: we don't wait until it actually dies.
516 os::terminate_signal_thread();
517
518 print_statistics();
519 Universe::heap()->print_tracing_info();
520
521 { MutexLocker ml(BeforeExit_lock);
522 _before_exit_status = BEFORE_EXIT_DONE;
523 BeforeExit_lock->notify_all();
524 }
525
526 if (VerifyStringTableAtExit) {
527 int fail_cnt = 0;
528 {
529 MutexLocker ml(StringTable_lock);
530 fail_cnt = StringTable::verify_and_compare_entries();
531 }
532
533 if (fail_cnt != 0) {
534 tty->print_cr("ERROR: fail_cnt=%d", fail_cnt);
535 guarantee(fail_cnt == 0, "unexpected StringTable verification failures");
536 }
537 }
538
539 #undef BEFORE_EXIT_NOT_RUN
540 #undef BEFORE_EXIT_RUNNING
541 #undef BEFORE_EXIT_DONE
542 }
543
544 void vm_exit(int code) {
545 Thread* thread =
546 ThreadLocalStorage::is_initialized() ? Thread::current_or_null() : NULL;
547 if (thread == NULL) {
548 // very early initialization failure -- just exit
549 vm_direct_exit(code);
550 }
551
552 if (VMThread::vm_thread() != NULL) {
553 // Fire off a VM_Exit operation to bring VM to a safepoint and exit
554 VM_Exit op(code);
|
507 }
508
509 // Always call even when there are not JVMTI environments yet, since environments
510 // may be attached late and JVMTI must track phases of VM execution
511 JvmtiExport::post_vm_death();
512 Threads::shutdown_vm_agents();
513
514 // Terminate the signal thread
515 // Note: we don't wait until it actually dies.
516 os::terminate_signal_thread();
517
518 print_statistics();
519 Universe::heap()->print_tracing_info();
520
521 { MutexLocker ml(BeforeExit_lock);
522 _before_exit_status = BEFORE_EXIT_DONE;
523 BeforeExit_lock->notify_all();
524 }
525
526 if (VerifyStringTableAtExit) {
527 size_t fail_cnt = StringTable::verify_and_compare_entries();
528 if (fail_cnt != 0) {
529 tty->print_cr("ERROR: fail_cnt=" SIZE_FORMAT, fail_cnt);
530 guarantee(fail_cnt == 0, "unexpected StringTable verification failures");
531 }
532 }
533
534 #undef BEFORE_EXIT_NOT_RUN
535 #undef BEFORE_EXIT_RUNNING
536 #undef BEFORE_EXIT_DONE
537 }
538
539 void vm_exit(int code) {
540 Thread* thread =
541 ThreadLocalStorage::is_initialized() ? Thread::current_or_null() : NULL;
542 if (thread == NULL) {
543 // very early initialization failure -- just exit
544 vm_direct_exit(code);
545 }
546
547 if (VMThread::vm_thread() != NULL) {
548 // Fire off a VM_Exit operation to bring VM to a safepoint and exit
549 VM_Exit op(code);
|