534 if (thread->is_Java_thread())
535 ((JavaThread*)thread)->set_thread_state(_thread_in_vm);
536 VMThread::execute(&op);
537 // should never reach here; but in case something wrong with VM Thread.
538 vm_direct_exit(code);
539 } else {
540 // VM thread is gone, just exit
541 vm_direct_exit(code);
542 }
543 ShouldNotReachHere();
544 }
545
546 void notify_vm_shutdown() {
547 // For now, just a dtrace probe.
548 HS_DTRACE_PROBE(hotspot, vm__shutdown);
549 HS_DTRACE_WORKAROUND_TAIL_CALL_BUG();
550 }
551
552 void vm_direct_exit(int code) {
553 notify_vm_shutdown();
554 ::exit(code);
555 }
556
557 void vm_perform_shutdown_actions() {
558 // Warning: do not call 'exit_globals()' here. All threads are still running.
559 // Calling 'exit_globals()' will disable thread-local-storage and cause all
560 // kinds of assertions to trigger in debug mode.
561 if (is_init_completed()) {
562 Thread* thread = ThreadLocalStorage::is_initialized() ?
563 ThreadLocalStorage::get_thread_slow() : NULL;
564 if (thread != NULL && thread->is_Java_thread()) {
565 // We are leaving the VM, set state to native (in case any OS exit
566 // handlers call back to the VM)
567 JavaThread* jt = (JavaThread*)thread;
568 // Must always be walkable or have no last_Java_frame when in
569 // thread_in_native
570 jt->frame_anchor()->make_walkable(jt);
571 jt->set_thread_state(_thread_in_native);
572 }
573 }
574 notify_vm_shutdown();
575 }
576
577 void vm_shutdown()
578 {
579 vm_perform_shutdown_actions();
580 os::shutdown();
581 }
582
583 void vm_abort(bool dump_core) {
584 vm_perform_shutdown_actions();
585 os::abort(dump_core);
586 ShouldNotReachHere();
587 }
588
589 void vm_notify_during_shutdown(const char* error, const char* message) {
590 if (error != NULL) {
591 tty->print_cr("Error occurred during initialization of VM");
592 tty->print("%s", error);
593 if (message != NULL) {
594 tty->print_cr(": %s", message);
595 }
596 else {
597 tty->cr();
598 }
599 }
600 if (ShowMessageBoxOnError && WizardMode) {
601 fatal("Error occurred during initialization of VM");
602 }
603 }
604
|
534 if (thread->is_Java_thread())
535 ((JavaThread*)thread)->set_thread_state(_thread_in_vm);
536 VMThread::execute(&op);
537 // should never reach here; but in case something wrong with VM Thread.
538 vm_direct_exit(code);
539 } else {
540 // VM thread is gone, just exit
541 vm_direct_exit(code);
542 }
543 ShouldNotReachHere();
544 }
545
546 void notify_vm_shutdown() {
547 // For now, just a dtrace probe.
548 HS_DTRACE_PROBE(hotspot, vm__shutdown);
549 HS_DTRACE_WORKAROUND_TAIL_CALL_BUG();
550 }
551
552 void vm_direct_exit(int code) {
553 notify_vm_shutdown();
554 os::check_for_debugger_and_wait();
555 ::exit(code);
556 }
557
558 void vm_perform_shutdown_actions() {
559 // Warning: do not call 'exit_globals()' here. All threads are still running.
560 // Calling 'exit_globals()' will disable thread-local-storage and cause all
561 // kinds of assertions to trigger in debug mode.
562 if (is_init_completed()) {
563 Thread* thread = ThreadLocalStorage::is_initialized() ?
564 ThreadLocalStorage::get_thread_slow() : NULL;
565 if (thread != NULL && thread->is_Java_thread()) {
566 // We are leaving the VM, set state to native (in case any OS exit
567 // handlers call back to the VM)
568 JavaThread* jt = (JavaThread*)thread;
569 // Must always be walkable or have no last_Java_frame when in
570 // thread_in_native
571 jt->frame_anchor()->make_walkable(jt);
572 jt->set_thread_state(_thread_in_native);
573 }
574 }
575 notify_vm_shutdown();
576 }
577
578 void vm_shutdown()
579 {
580 vm_perform_shutdown_actions();
581 os::check_for_debugger_and_wait();
582 os::shutdown();
583 }
584
585 void vm_abort(bool dump_core) {
586 vm_perform_shutdown_actions();
587 os::check_for_debugger_and_wait();
588 os::abort(dump_core);
589 ShouldNotReachHere();
590 }
591
592 void vm_notify_during_shutdown(const char* error, const char* message) {
593 if (error != NULL) {
594 tty->print_cr("Error occurred during initialization of VM");
595 tty->print("%s", error);
596 if (message != NULL) {
597 tty->print_cr(": %s", message);
598 }
599 else {
600 tty->cr();
601 }
602 }
603 if (ShowMessageBoxOnError && WizardMode) {
604 fatal("Error occurred during initialization of VM");
605 }
606 }
607
|