< prev index next >

src/share/vm/runtime/java.cpp

Print this page

        

@@ -509,14 +509,14 @@
   #undef BEFORE_EXIT_RUNNING
   #undef BEFORE_EXIT_DONE
 }
 
 void vm_exit(int code) {
-  Thread* thread = ThreadLocalStorage::is_initialized() ?
-    ThreadLocalStorage::get_thread_slow() : NULL;
+  Thread* thread = 
+      ThreadLocalStorage::is_initialized() ? Thread::current_or_null() : NULL;
   if (thread == NULL) {
-    // we have serious problems -- just exit
+    // very early initialization failure -- just exit
     vm_direct_exit(code);
   }
 
   if (VMThread::vm_thread() != NULL) {
     // Fire off a VM_Exit operation to bring VM to a safepoint and exit

@@ -548,12 +548,11 @@
 void vm_perform_shutdown_actions() {
   // Warning: do not call 'exit_globals()' here. All threads are still running.
   // Calling 'exit_globals()' will disable thread-local-storage and cause all
   // kinds of assertions to trigger in debug mode.
   if (is_init_completed()) {
-    Thread* thread = ThreadLocalStorage::is_initialized() ?
-                     ThreadLocalStorage::get_thread_slow() : NULL;
+    Thread* thread = Thread::current_or_null();
     if (thread != NULL && thread->is_Java_thread()) {
       // We are leaving the VM, set state to native (in case any OS exit
       // handlers call back to the VM)
       JavaThread* jt = (JavaThread*)thread;
       // Must always be walkable or have no last_Java_frame when in

@@ -603,11 +602,11 @@
 void vm_exit_during_initialization(Handle exception) {
   tty->print_cr("Error occurred during initialization of VM");
   // If there are exceptions on this thread it must be cleared
   // first and here. Any future calls to EXCEPTION_MARK requires
   // that no pending exceptions exist.
-  Thread *THREAD = Thread::current();
+  Thread *THREAD = Thread::current_or_null();
   if (HAS_PENDING_EXCEPTION) {
     CLEAR_PENDING_EXCEPTION;
   }
   java_lang_Throwable::print(exception, tty);
   tty->cr();
< prev index next >