506 JvmtiExport::post_thread_end(thread);
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 #undef BEFORE_EXIT_NOT_RUN
527 #undef BEFORE_EXIT_RUNNING
528 #undef BEFORE_EXIT_DONE
529 }
530
531 void vm_exit(int code) {
532 Thread* thread =
533 ThreadLocalStorage::is_initialized() ? Thread::current_or_null() : NULL;
534 if (thread == NULL) {
535 // very early initialization failure -- just exit
536 vm_direct_exit(code);
537 }
538
539 if (VMThread::vm_thread() != NULL) {
540 // Fire off a VM_Exit operation to bring VM to a safepoint and exit
541 VM_Exit op(code);
542 if (thread->is_Java_thread())
543 ((JavaThread*)thread)->set_thread_state(_thread_in_vm);
544 VMThread::execute(&op);
545 // should never reach here; but in case something wrong with VM Thread.
|
506 JvmtiExport::post_thread_end(thread);
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);
550 if (thread->is_Java_thread())
551 ((JavaThread*)thread)->set_thread_state(_thread_in_vm);
552 VMThread::execute(&op);
553 // should never reach here; but in case something wrong with VM Thread.
|