584 VM_Exit op(code);
585 if (thread->is_Java_thread())
586 ((JavaThread*)thread)->set_thread_state(_thread_in_vm);
587 VMThread::execute(&op);
588 // should never reach here; but in case something wrong with VM Thread.
589 vm_direct_exit(code);
590 } else {
591 // VM thread is gone, just exit
592 vm_direct_exit(code);
593 }
594 ShouldNotReachHere();
595 }
596
597 void notify_vm_shutdown() {
598 // For now, just a dtrace probe.
599 #ifndef USDT2
600 HS_DTRACE_PROBE(hotspot, vm__shutdown);
601 HS_DTRACE_WORKAROUND_TAIL_CALL_BUG();
602 #else /* USDT2 */
603 HOTSPOT_VM_SHUTDOWN();
604 #endif /* USDT2 */
605 }
606
607 void vm_direct_exit(int code) {
608 notify_vm_shutdown();
609 os::wait_for_keypress_at_exit();
610 ::exit(code);
611 }
612
613 void vm_perform_shutdown_actions() {
614 // Warning: do not call 'exit_globals()' here. All threads are still running.
615 // Calling 'exit_globals()' will disable thread-local-storage and cause all
616 // kinds of assertions to trigger in debug mode.
617 if (is_init_completed()) {
618 Thread* thread = ThreadLocalStorage::is_initialized() ?
619 ThreadLocalStorage::get_thread_slow() : NULL;
620 if (thread != NULL && thread->is_Java_thread()) {
621 // We are leaving the VM, set state to native (in case any OS exit
622 // handlers call back to the VM)
623 JavaThread* jt = (JavaThread*)thread;
|
584 VM_Exit op(code);
585 if (thread->is_Java_thread())
586 ((JavaThread*)thread)->set_thread_state(_thread_in_vm);
587 VMThread::execute(&op);
588 // should never reach here; but in case something wrong with VM Thread.
589 vm_direct_exit(code);
590 } else {
591 // VM thread is gone, just exit
592 vm_direct_exit(code);
593 }
594 ShouldNotReachHere();
595 }
596
597 void notify_vm_shutdown() {
598 // For now, just a dtrace probe.
599 #ifndef USDT2
600 HS_DTRACE_PROBE(hotspot, vm__shutdown);
601 HS_DTRACE_WORKAROUND_TAIL_CALL_BUG();
602 #else /* USDT2 */
603 HOTSPOT_VM_SHUTDOWN();
604 HS_DTRACE_WORKAROUND_TAIL_CALL_BUG();
605 #endif /* USDT2 */
606 }
607
608 void vm_direct_exit(int code) {
609 notify_vm_shutdown();
610 os::wait_for_keypress_at_exit();
611 ::exit(code);
612 }
613
614 void vm_perform_shutdown_actions() {
615 // Warning: do not call 'exit_globals()' here. All threads are still running.
616 // Calling 'exit_globals()' will disable thread-local-storage and cause all
617 // kinds of assertions to trigger in debug mode.
618 if (is_init_completed()) {
619 Thread* thread = ThreadLocalStorage::is_initialized() ?
620 ThreadLocalStorage::get_thread_slow() : NULL;
621 if (thread != NULL && thread->is_Java_thread()) {
622 // We are leaving the VM, set state to native (in case any OS exit
623 // handlers call back to the VM)
624 JavaThread* jt = (JavaThread*)thread;
|