< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page
rev 49521 : 8198756: Lazy allocation of compiler threads
Reviewed-by: kvn


3338 // Create a CompilerThread
3339 CompilerThread::CompilerThread(CompileQueue* queue,
3340                                CompilerCounters* counters)
3341                                : JavaThread(&compiler_thread_entry) {
3342   _env   = NULL;
3343   _log   = NULL;
3344   _task  = NULL;
3345   _queue = queue;
3346   _counters = counters;
3347   _buffer_blob = NULL;
3348   _compiler = NULL;
3349 
3350   // Compiler uses resource area for compilation, let's bias it to mtCompiler
3351   resource_area()->bias_to(mtCompiler);
3352 
3353 #ifndef PRODUCT
3354   _ideal_graph_printer = NULL;
3355 #endif
3356 }
3357 





3358 bool CompilerThread::can_call_java() const {
3359   return _compiler != NULL && _compiler->is_jvmci();
3360 }
3361 
3362 // Create sweeper thread
3363 CodeCacheSweeperThread::CodeCacheSweeperThread()
3364 : JavaThread(&sweeper_thread_entry) {
3365   _scanned_compiled_method = NULL;
3366 }
3367 
3368 void CodeCacheSweeperThread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
3369   JavaThread::oops_do(f, cf);
3370   if (_scanned_compiled_method != NULL && cf != NULL) {
3371     // Safepoints can occur when the sweeper is scanning an nmethod so
3372     // process it here to make sure it isn't unloaded in the middle of
3373     // a scan.
3374     cf->do_code_blob(_scanned_compiled_method);
3375   }
3376 }
3377 




3338 // Create a CompilerThread
3339 CompilerThread::CompilerThread(CompileQueue* queue,
3340                                CompilerCounters* counters)
3341                                : JavaThread(&compiler_thread_entry) {
3342   _env   = NULL;
3343   _log   = NULL;
3344   _task  = NULL;
3345   _queue = queue;
3346   _counters = counters;
3347   _buffer_blob = NULL;
3348   _compiler = NULL;
3349 
3350   // Compiler uses resource area for compilation, let's bias it to mtCompiler
3351   resource_area()->bias_to(mtCompiler);
3352 
3353 #ifndef PRODUCT
3354   _ideal_graph_printer = NULL;
3355 #endif
3356 }
3357 
3358 CompilerThread::~CompilerThread() {
3359   // Delete objects which were allocated on heap.
3360   delete _counters;
3361 }
3362 
3363 bool CompilerThread::can_call_java() const {
3364   return _compiler != NULL && _compiler->is_jvmci();
3365 }
3366 
3367 // Create sweeper thread
3368 CodeCacheSweeperThread::CodeCacheSweeperThread()
3369 : JavaThread(&sweeper_thread_entry) {
3370   _scanned_compiled_method = NULL;
3371 }
3372 
3373 void CodeCacheSweeperThread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
3374   JavaThread::oops_do(f, cf);
3375   if (_scanned_compiled_method != NULL && cf != NULL) {
3376     // Safepoints can occur when the sweeper is scanning an nmethod so
3377     // process it here to make sure it isn't unloaded in the middle of
3378     // a scan.
3379     cf->do_code_blob(_scanned_compiled_method);
3380   }
3381 }
3382 


< prev index next >