< prev index next >

src/hotspot/share/runtime/thread.cpp

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


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




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


< prev index next >