< prev index next >

src/share/vm/compiler/compileBroker.cpp

Print this page




 356     }
 357 
 358     // If there are no compilation tasks and we can compile new jobs
 359     // (i.e., there is enough free space in the code cache) there is
 360     // no need to invoke the sweeper. As a result, the hotness of methods
 361     // remains unchanged. This behavior is desired, since we want to keep
 362     // the stable state, i.e., we do not want to evict methods from the
 363     // code cache if it is unnecessary.
 364     // We need a timed wait here, since compiler threads can exit if compilation
 365     // is disabled forever. We use 5 seconds wait time; the exiting of compiler threads
 366     // is not critical and we do not want idle compiler threads to wake up too often.
 367     MethodCompileQueue_lock->wait(!Mutex::_no_safepoint_check_flag, 5*1000);
 368   }
 369 
 370   if (CompileBroker::is_compilation_disabled_forever()) {
 371     return NULL;
 372   }
 373 
 374   CompileTask* task;
 375   {
 376     No_Safepoint_Verifier nsv;
 377     task = CompilationPolicy::policy()->select_task(this);
 378   }
 379 
 380   // Save method pointers across unlock safepoint.  The task is removed from
 381   // the compilation queue, which is walked during RedefineClasses.
 382   save_method = methodHandle(task->method());
 383   save_hot_method = methodHandle(task->hot_method());
 384 
 385   remove(task);
 386   purge_stale_tasks(); // may temporarily release MCQ lock
 387   return task;
 388 }
 389 
 390 // Clean & deallocate stale compile tasks.
 391 // Temporarily releases MethodCompileQueue lock.
 392 void CompileQueue::purge_stale_tasks() {
 393   assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
 394   if (_first_stale != NULL) {
 395     // Stale tasks are purged when MCQ lock is released,
 396     // but _first_stale updates are protected by MCQ lock.




 356     }
 357 
 358     // If there are no compilation tasks and we can compile new jobs
 359     // (i.e., there is enough free space in the code cache) there is
 360     // no need to invoke the sweeper. As a result, the hotness of methods
 361     // remains unchanged. This behavior is desired, since we want to keep
 362     // the stable state, i.e., we do not want to evict methods from the
 363     // code cache if it is unnecessary.
 364     // We need a timed wait here, since compiler threads can exit if compilation
 365     // is disabled forever. We use 5 seconds wait time; the exiting of compiler threads
 366     // is not critical and we do not want idle compiler threads to wake up too often.
 367     MethodCompileQueue_lock->wait(!Mutex::_no_safepoint_check_flag, 5*1000);
 368   }
 369 
 370   if (CompileBroker::is_compilation_disabled_forever()) {
 371     return NULL;
 372   }
 373 
 374   CompileTask* task;
 375   {
 376     NoSafepointVerifier nsv;
 377     task = CompilationPolicy::policy()->select_task(this);
 378   }
 379 
 380   // Save method pointers across unlock safepoint.  The task is removed from
 381   // the compilation queue, which is walked during RedefineClasses.
 382   save_method = methodHandle(task->method());
 383   save_hot_method = methodHandle(task->hot_method());
 384 
 385   remove(task);
 386   purge_stale_tasks(); // may temporarily release MCQ lock
 387   return task;
 388 }
 389 
 390 // Clean & deallocate stale compile tasks.
 391 // Temporarily releases MethodCompileQueue lock.
 392 void CompileQueue::purge_stale_tasks() {
 393   assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
 394   if (_first_stale != NULL) {
 395     // Stale tasks are purged when MCQ lock is released,
 396     // but _first_stale updates are protected by MCQ lock.


< prev index next >