hotspot/src/share/vm/runtime/java.cpp
changeset 34633 2a6c7c7b30a7
parent 34230 b9c64b7c06c9
child 34657 c2e1cc3f503f
equal deleted inserted replaced
34632:bf3518bba285 34633:2a6c7c7b30a7
   510   #undef BEFORE_EXIT_RUNNING
   510   #undef BEFORE_EXIT_RUNNING
   511   #undef BEFORE_EXIT_DONE
   511   #undef BEFORE_EXIT_DONE
   512 }
   512 }
   513 
   513 
   514 void vm_exit(int code) {
   514 void vm_exit(int code) {
   515   Thread* thread = ThreadLocalStorage::is_initialized() ?
   515   Thread* thread =
   516     ThreadLocalStorage::get_thread_slow() : NULL;
   516       ThreadLocalStorage::is_initialized() ? Thread::current_or_null() : NULL;
   517   if (thread == NULL) {
   517   if (thread == NULL) {
   518     // we have serious problems -- just exit
   518     // very early initialization failure -- just exit
   519     vm_direct_exit(code);
   519     vm_direct_exit(code);
   520   }
   520   }
   521 
   521 
   522   if (VMThread::vm_thread() != NULL) {
   522   if (VMThread::vm_thread() != NULL) {
   523     // Fire off a VM_Exit operation to bring VM to a safepoint and exit
   523     // Fire off a VM_Exit operation to bring VM to a safepoint and exit
   549 void vm_perform_shutdown_actions() {
   549 void vm_perform_shutdown_actions() {
   550   // Warning: do not call 'exit_globals()' here. All threads are still running.
   550   // Warning: do not call 'exit_globals()' here. All threads are still running.
   551   // Calling 'exit_globals()' will disable thread-local-storage and cause all
   551   // Calling 'exit_globals()' will disable thread-local-storage and cause all
   552   // kinds of assertions to trigger in debug mode.
   552   // kinds of assertions to trigger in debug mode.
   553   if (is_init_completed()) {
   553   if (is_init_completed()) {
   554     Thread* thread = ThreadLocalStorage::is_initialized() ?
   554     Thread* thread = Thread::current_or_null();
   555                      ThreadLocalStorage::get_thread_slow() : NULL;
       
   556     if (thread != NULL && thread->is_Java_thread()) {
   555     if (thread != NULL && thread->is_Java_thread()) {
   557       // We are leaving the VM, set state to native (in case any OS exit
   556       // We are leaving the VM, set state to native (in case any OS exit
   558       // handlers call back to the VM)
   557       // handlers call back to the VM)
   559       JavaThread* jt = (JavaThread*)thread;
   558       JavaThread* jt = (JavaThread*)thread;
   560       // Must always be walkable or have no last_Java_frame when in
   559       // Must always be walkable or have no last_Java_frame when in
   604 void vm_exit_during_initialization(Handle exception) {
   603 void vm_exit_during_initialization(Handle exception) {
   605   tty->print_cr("Error occurred during initialization of VM");
   604   tty->print_cr("Error occurred during initialization of VM");
   606   // If there are exceptions on this thread it must be cleared
   605   // If there are exceptions on this thread it must be cleared
   607   // first and here. Any future calls to EXCEPTION_MARK requires
   606   // first and here. Any future calls to EXCEPTION_MARK requires
   608   // that no pending exceptions exist.
   607   // that no pending exceptions exist.
   609   Thread *THREAD = Thread::current();
   608   Thread *THREAD = Thread::current(); // can't be NULL
   610   if (HAS_PENDING_EXCEPTION) {
   609   if (HAS_PENDING_EXCEPTION) {
   611     CLEAR_PENDING_EXCEPTION;
   610     CLEAR_PENDING_EXCEPTION;
   612   }
   611   }
   613   java_lang_Throwable::print(exception, tty);
   612   java_lang_Throwable::print(exception, tty);
   614   tty->cr();
   613   tty->cr();