< prev index next >

src/hotspot/share/runtime/thread.cpp

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


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






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




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


< prev index next >