hotspot/src/share/vm/runtime/java.cpp
changeset 35143 33daaea9d5c2
parent 35061 be6025ebffea
child 35557 029dcb9bfa8b
equal deleted inserted replaced
35142:11e71310edae 35143:33daaea9d5c2
   396 #endif
   396 #endif
   397 
   397 
   398 // Note: before_exit() can be executed only once, if more than one threads
   398 // Note: before_exit() can be executed only once, if more than one threads
   399 //       are trying to shutdown the VM at the same time, only one thread
   399 //       are trying to shutdown the VM at the same time, only one thread
   400 //       can run before_exit() and all other threads must wait.
   400 //       can run before_exit() and all other threads must wait.
   401 void before_exit(JavaThread * thread) {
   401 void before_exit(JavaThread* thread) {
   402   #define BEFORE_EXIT_NOT_RUN 0
   402   #define BEFORE_EXIT_NOT_RUN 0
   403   #define BEFORE_EXIT_RUNNING 1
   403   #define BEFORE_EXIT_RUNNING 1
   404   #define BEFORE_EXIT_DONE    2
   404   #define BEFORE_EXIT_DONE    2
   405   static jint volatile _before_exit_status = BEFORE_EXIT_NOT_RUN;
   405   static jint volatile _before_exit_status = BEFORE_EXIT_NOT_RUN;
   406 
   406 
   424       return;
   424       return;
   425     }
   425     }
   426   }
   426   }
   427 
   427 
   428 #if INCLUDE_JVMCI
   428 #if INCLUDE_JVMCI
   429   JVMCIRuntime::shutdown();
   429   // We are not using CATCH here because we want the exit to continue normally.
       
   430   Thread* THREAD = thread;
       
   431   JVMCIRuntime::shutdown(THREAD);
       
   432   if (HAS_PENDING_EXCEPTION) {
       
   433     Handle exception(THREAD, PENDING_EXCEPTION);
       
   434     CLEAR_PENDING_EXCEPTION;
       
   435     ttyLocker ttyl;
       
   436     java_lang_Throwable::print_stack_trace(exception, tty);
       
   437   }
   430 #endif
   438 #endif
   431 
   439 
   432   // Hang forever on exit if we're reporting an error.
   440   // Hang forever on exit if we're reporting an error.
   433   if (ShowMessageBoxOnError && is_error_reported()) {
   441   if (ShowMessageBoxOnError && is_error_reported()) {
   434     os::infinite_sleep();
   442     os::infinite_sleep();
   610   // that no pending exceptions exist.
   618   // that no pending exceptions exist.
   611   Thread *THREAD = Thread::current(); // can't be NULL
   619   Thread *THREAD = Thread::current(); // can't be NULL
   612   if (HAS_PENDING_EXCEPTION) {
   620   if (HAS_PENDING_EXCEPTION) {
   613     CLEAR_PENDING_EXCEPTION;
   621     CLEAR_PENDING_EXCEPTION;
   614   }
   622   }
   615   java_lang_Throwable::print(exception, tty);
   623   java_lang_Throwable::print_stack_trace(exception, tty);
   616   tty->cr();
       
   617   java_lang_Throwable::print_stack_trace(exception(), tty);
       
   618   tty->cr();
   624   tty->cr();
   619   vm_notify_during_shutdown(NULL, NULL);
   625   vm_notify_during_shutdown(NULL, NULL);
   620 
   626 
   621   // Failure during initialization, we don't want to dump core
   627   // Failure during initialization, we don't want to dump core
   622   vm_abort(false);
   628   vm_abort(false);