2139 CompileTask* task() { return _task; }
2140 void set_task(CompileTask* task) { _task = task; }
2141 };
2142
2143 inline CompilerThread* CompilerThread::current() {
2144 return JavaThread::current()->as_CompilerThread();
2145 }
2146
2147 // The active thread queue. It also keeps track of the current used
2148 // thread priorities.
2149 class Threads: AllStatic {
2150 friend class VMStructs;
2151 private:
2152 static JavaThread* _thread_list;
2153 static int _number_of_threads;
2154 static int _number_of_non_daemon_threads;
2155 static int _return_code;
2156 static int _thread_claim_parity;
2157 #ifdef ASSERT
2158 static bool _vm_complete;
2159 static size_t _threads_before_barrier_set;
2160 #endif
2161
2162 static void initialize_java_lang_classes(JavaThread* main_thread, TRAPS);
2163 static void initialize_jsr292_core_classes(TRAPS);
2164
2165 public:
2166 // Thread management
2167 // force_daemon is a concession to JNI, where we may need to add a
2168 // thread to the thread list before allocating its thread object
2169 static void add(JavaThread* p, bool force_daemon = false);
2170 static void remove(JavaThread* p);
2171 static void non_java_threads_do(ThreadClosure* tc);
2172 static void java_threads_do(ThreadClosure* tc);
2173 static void java_threads_and_vm_thread_do(ThreadClosure* tc);
2174 static void threads_do(ThreadClosure* tc);
2175 static void possibly_parallel_threads_do(bool is_par, ThreadClosure* tc);
2176
2177 // Initializes the vm and creates the vm thread
2178 static jint create_vm(JavaVMInitArgs* args, bool* canTryAgain);
2179 static void convert_vm_init_libraries_to_agents();
2209 static void oops_do(OopClosure* f, CodeBlobClosure* cf);
2210 // This version may be called by sequential or parallel code.
2211 static void possibly_parallel_oops_do(bool is_par, OopClosure* f, CodeBlobClosure* cf);
2212
2213 // Apply "f->do_oop" to roots in all threads that
2214 // are part of compiled frames
2215 static void compiled_frame_oops_do(OopClosure* f, CodeBlobClosure* cf);
2216
2217 static void convert_hcode_pointers();
2218 static void restore_hcode_pointers();
2219
2220 // Sweeper
2221 static void nmethods_do(CodeBlobClosure* cf);
2222
2223 // RedefineClasses support
2224 static void metadata_do(void f(Metadata*));
2225 static void metadata_handles_do(void f(Metadata*));
2226
2227 #ifdef ASSERT
2228 static bool is_vm_complete() { return _vm_complete; }
2229
2230 static size_t threads_before_barrier_set() {
2231 return _threads_before_barrier_set;
2232 }
2233
2234 static void inc_threads_before_barrier_set() {
2235 ++_threads_before_barrier_set;
2236 }
2237 #endif // ASSERT
2238
2239 // Verification
2240 static void verify();
2241 static void print_on(outputStream* st, bool print_stacks, bool internal_format, bool print_concurrent_locks, bool print_extended_info);
2242 static void print(bool print_stacks, bool internal_format) {
2243 // this function is only used by debug.cpp
2244 print_on(tty, print_stacks, internal_format, false /* no concurrent lock printed */, false /* simple format */);
2245 }
2246 static void print_on_error(outputStream* st, Thread* current, char* buf, int buflen);
2247 static void print_on_error(Thread* this_thread, outputStream* st, Thread* current, char* buf,
2248 int buflen, bool* found_current);
2249 static void print_threads_compiling(outputStream* st, char* buf, int buflen);
2250
2251 // Get Java threads that are waiting to enter a monitor.
2252 static GrowableArray<JavaThread*>* get_pending_threads(ThreadsList * t_list,
2253 int count, address monitor);
2254
2255 // Get owning Java thread from the monitor's owner field.
2256 static JavaThread *owning_thread_from_monitor_owner(ThreadsList * t_list,
|
2139 CompileTask* task() { return _task; }
2140 void set_task(CompileTask* task) { _task = task; }
2141 };
2142
2143 inline CompilerThread* CompilerThread::current() {
2144 return JavaThread::current()->as_CompilerThread();
2145 }
2146
2147 // The active thread queue. It also keeps track of the current used
2148 // thread priorities.
2149 class Threads: AllStatic {
2150 friend class VMStructs;
2151 private:
2152 static JavaThread* _thread_list;
2153 static int _number_of_threads;
2154 static int _number_of_non_daemon_threads;
2155 static int _return_code;
2156 static int _thread_claim_parity;
2157 #ifdef ASSERT
2158 static bool _vm_complete;
2159 #endif
2160
2161 static void initialize_java_lang_classes(JavaThread* main_thread, TRAPS);
2162 static void initialize_jsr292_core_classes(TRAPS);
2163
2164 public:
2165 // Thread management
2166 // force_daemon is a concession to JNI, where we may need to add a
2167 // thread to the thread list before allocating its thread object
2168 static void add(JavaThread* p, bool force_daemon = false);
2169 static void remove(JavaThread* p);
2170 static void non_java_threads_do(ThreadClosure* tc);
2171 static void java_threads_do(ThreadClosure* tc);
2172 static void java_threads_and_vm_thread_do(ThreadClosure* tc);
2173 static void threads_do(ThreadClosure* tc);
2174 static void possibly_parallel_threads_do(bool is_par, ThreadClosure* tc);
2175
2176 // Initializes the vm and creates the vm thread
2177 static jint create_vm(JavaVMInitArgs* args, bool* canTryAgain);
2178 static void convert_vm_init_libraries_to_agents();
2208 static void oops_do(OopClosure* f, CodeBlobClosure* cf);
2209 // This version may be called by sequential or parallel code.
2210 static void possibly_parallel_oops_do(bool is_par, OopClosure* f, CodeBlobClosure* cf);
2211
2212 // Apply "f->do_oop" to roots in all threads that
2213 // are part of compiled frames
2214 static void compiled_frame_oops_do(OopClosure* f, CodeBlobClosure* cf);
2215
2216 static void convert_hcode_pointers();
2217 static void restore_hcode_pointers();
2218
2219 // Sweeper
2220 static void nmethods_do(CodeBlobClosure* cf);
2221
2222 // RedefineClasses support
2223 static void metadata_do(void f(Metadata*));
2224 static void metadata_handles_do(void f(Metadata*));
2225
2226 #ifdef ASSERT
2227 static bool is_vm_complete() { return _vm_complete; }
2228 #endif // ASSERT
2229
2230 // Verification
2231 static void verify();
2232 static void print_on(outputStream* st, bool print_stacks, bool internal_format, bool print_concurrent_locks, bool print_extended_info);
2233 static void print(bool print_stacks, bool internal_format) {
2234 // this function is only used by debug.cpp
2235 print_on(tty, print_stacks, internal_format, false /* no concurrent lock printed */, false /* simple format */);
2236 }
2237 static void print_on_error(outputStream* st, Thread* current, char* buf, int buflen);
2238 static void print_on_error(Thread* this_thread, outputStream* st, Thread* current, char* buf,
2239 int buflen, bool* found_current);
2240 static void print_threads_compiling(outputStream* st, char* buf, int buflen);
2241
2242 // Get Java threads that are waiting to enter a monitor.
2243 static GrowableArray<JavaThread*>* get_pending_threads(ThreadsList * t_list,
2244 int count, address monitor);
2245
2246 // Get owning Java thread from the monitor's owner field.
2247 static JavaThread *owning_thread_from_monitor_owner(ThreadsList * t_list,
|