hotspot/src/share/vm/runtime/thread.cpp
changeset 20707 b3b658c6d1f8
parent 20282 7f9cbdf89af2
child 21192 e434b13b387c
equal deleted inserted replaced
20703:2de7fe0e9693 20707:b3b658c6d1f8
  1452   _should_post_on_exceptions_flag = JNI_FALSE;
  1452   _should_post_on_exceptions_flag = JNI_FALSE;
  1453   _jvmti_get_loaded_classes_closure = NULL;
  1453   _jvmti_get_loaded_classes_closure = NULL;
  1454   _interp_only_mode    = 0;
  1454   _interp_only_mode    = 0;
  1455   _special_runtime_exit_condition = _no_async_condition;
  1455   _special_runtime_exit_condition = _no_async_condition;
  1456   _pending_async_exception = NULL;
  1456   _pending_async_exception = NULL;
  1457   _is_compiling = false;
       
  1458   _thread_stat = NULL;
  1457   _thread_stat = NULL;
  1459   _thread_stat = new ThreadStatistics();
  1458   _thread_stat = new ThreadStatistics();
  1460   _blocked_on_compilation = false;
  1459   _blocked_on_compilation = false;
  1461   _jni_active_critical = 0;
  1460   _jni_active_critical = 0;
  1462   _do_not_unlock_if_synchronized = false;
  1461   _do_not_unlock_if_synchronized = false;
  1813     EVENT_THREAD_EXIT(this);
  1812     EVENT_THREAD_EXIT(this);
  1814 
  1813 
  1815     // Call Thread.exit(). We try 3 times in case we got another Thread.stop during
  1814     // Call Thread.exit(). We try 3 times in case we got another Thread.stop during
  1816     // the execution of the method. If that is not enough, then we don't really care. Thread.stop
  1815     // the execution of the method. If that is not enough, then we don't really care. Thread.stop
  1817     // is deprecated anyhow.
  1816     // is deprecated anyhow.
  1818     { int count = 3;
  1817     if (!is_Compiler_thread()) {
       
  1818       int count = 3;
  1819       while (java_lang_Thread::threadGroup(threadObj()) != NULL && (count-- > 0)) {
  1819       while (java_lang_Thread::threadGroup(threadObj()) != NULL && (count-- > 0)) {
  1820         EXCEPTION_MARK;
  1820         EXCEPTION_MARK;
  1821         JavaValue result(T_VOID);
  1821         JavaValue result(T_VOID);
  1822         KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass());
  1822         KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass());
  1823         JavaCalls::call_virtual(&result,
  1823         JavaCalls::call_virtual(&result,
  1826                               vmSymbols::void_method_signature(),
  1826                               vmSymbols::void_method_signature(),
  1827                               THREAD);
  1827                               THREAD);
  1828         CLEAR_PENDING_EXCEPTION;
  1828         CLEAR_PENDING_EXCEPTION;
  1829       }
  1829       }
  1830     }
  1830     }
  1831 
       
  1832     // notify JVMTI
  1831     // notify JVMTI
  1833     if (JvmtiExport::should_post_thread_life()) {
  1832     if (JvmtiExport::should_post_thread_life()) {
  1834       JvmtiExport::post_thread_end(this);
  1833       JvmtiExport::post_thread_end(this);
  1835     }
  1834     }
  1836 
  1835 
  3237   _task  = NULL;
  3236   _task  = NULL;
  3238   _queue = queue;
  3237   _queue = queue;
  3239   _counters = counters;
  3238   _counters = counters;
  3240   _buffer_blob = NULL;
  3239   _buffer_blob = NULL;
  3241   _scanned_nmethod = NULL;
  3240   _scanned_nmethod = NULL;
       
  3241   _compiler = NULL;
  3242 
  3242 
  3243 #ifndef PRODUCT
  3243 #ifndef PRODUCT
  3244   _ideal_graph_printer = NULL;
  3244   _ideal_graph_printer = NULL;
  3245 #endif
  3245 #endif
  3246 }
  3246 }
  3252     // process it here to make sure it isn't unloaded in the middle of
  3252     // process it here to make sure it isn't unloaded in the middle of
  3253     // a scan.
  3253     // a scan.
  3254     cf->do_code_blob(_scanned_nmethod);
  3254     cf->do_code_blob(_scanned_nmethod);
  3255   }
  3255   }
  3256 }
  3256 }
       
  3257 
  3257 
  3258 
  3258 // ======= Threads ========
  3259 // ======= Threads ========
  3259 
  3260 
  3260 // The Threads class links together all active threads, and provides
  3261 // The Threads class links together all active threads, and provides
  3261 // operations over all threads.  It is protected by its own Mutex
  3262 // operations over all threads.  It is protected by its own Mutex
  3272 bool        Threads::_vm_complete = false;
  3273 bool        Threads::_vm_complete = false;
  3273 #endif
  3274 #endif
  3274 
  3275 
  3275 // All JavaThreads
  3276 // All JavaThreads
  3276 #define ALL_JAVA_THREADS(X) for (JavaThread* X = _thread_list; X; X = X->next())
  3277 #define ALL_JAVA_THREADS(X) for (JavaThread* X = _thread_list; X; X = X->next())
  3277 
       
  3278 void os_stream();
       
  3279 
  3278 
  3280 // All JavaThreads + all non-JavaThreads (i.e., every thread in the system)
  3279 // All JavaThreads + all non-JavaThreads (i.e., every thread in the system)
  3281 void Threads::threads_do(ThreadClosure* tc) {
  3280 void Threads::threads_do(ThreadClosure* tc) {
  3282   assert_locked_or_safepoint(Threads_lock);
  3281   assert_locked_or_safepoint(Threads_lock);
  3283   // ALL_JAVA_THREADS iterates through all JavaThreads
  3282   // ALL_JAVA_THREADS iterates through all JavaThreads