src/share/vm/compiler/compileBroker.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/compiler

src/share/vm/compiler/compileBroker.cpp

Print this page
rev 6095 : 8023461: Thread holding lock at safepoint that vm can block on: MethodCompileQueue_lock
Reviewed-by: ?


 592 }
 593 
 594 void CompileQueue::delete_all() {
 595   assert(lock()->owned_by_self(), "must own lock");
 596   if (_first != NULL) {
 597     for (CompileTask* task = _first; task != NULL; task = task->next()) {
 598       delete task;
 599     }
 600     _first = NULL;
 601   }
 602 }
 603 
 604 // ------------------------------------------------------------------
 605 // CompileQueue::get
 606 //
 607 // Get the next CompileTask from a CompileQueue
 608 CompileTask* CompileQueue::get() {
 609   NMethodSweeper::possibly_sweep();
 610 
 611   MutexLocker locker(lock());

 612   // If _first is NULL we have no more compile jobs. There are two reasons for
 613   // having no compile jobs: First, we compiled everything we wanted. Second,
 614   // we ran out of code cache so compilation has been disabled. In the latter
 615   // case we perform code cache sweeps to free memory such that we can re-enable
 616   // compilation.
 617   while (_first == NULL) {
 618     // Exit loop if compilation is disabled forever
 619     if (CompileBroker::is_compilation_disabled_forever()) {
 620       return NULL;
 621     }
 622 
 623     if (UseCodeCacheFlushing && !CompileBroker::should_compile_new_jobs()) {
 624       // Wait a certain amount of time to possibly do another sweep.
 625       // We must wait until stack scanning has happened so that we can
 626       // transition a method's state from 'not_entrant' to 'zombie'.
 627       long wait_time = NmethodSweepCheckInterval * 1000;
 628       if (FLAG_IS_DEFAULT(NmethodSweepCheckInterval)) {
 629         // Only one thread at a time can do sweeping. Scale the
 630         // wait time according to the number of compiler threads.
 631         // As a result, the next sweep is likely to happen every 100ms




 592 }
 593 
 594 void CompileQueue::delete_all() {
 595   assert(lock()->owned_by_self(), "must own lock");
 596   if (_first != NULL) {
 597     for (CompileTask* task = _first; task != NULL; task = task->next()) {
 598       delete task;
 599     }
 600     _first = NULL;
 601   }
 602 }
 603 
 604 // ------------------------------------------------------------------
 605 // CompileQueue::get
 606 //
 607 // Get the next CompileTask from a CompileQueue
 608 CompileTask* CompileQueue::get() {
 609   NMethodSweeper::possibly_sweep();
 610 
 611   MutexLocker locker(lock());
 612   No_Safepoint_Verifier nsv;
 613   // If _first is NULL we have no more compile jobs. There are two reasons for
 614   // having no compile jobs: First, we compiled everything we wanted. Second,
 615   // we ran out of code cache so compilation has been disabled. In the latter
 616   // case we perform code cache sweeps to free memory such that we can re-enable
 617   // compilation.
 618   while (_first == NULL) {
 619     // Exit loop if compilation is disabled forever
 620     if (CompileBroker::is_compilation_disabled_forever()) {
 621       return NULL;
 622     }
 623 
 624     if (UseCodeCacheFlushing && !CompileBroker::should_compile_new_jobs()) {
 625       // Wait a certain amount of time to possibly do another sweep.
 626       // We must wait until stack scanning has happened so that we can
 627       // transition a method's state from 'not_entrant' to 'zombie'.
 628       long wait_time = NmethodSweepCheckInterval * 1000;
 629       if (FLAG_IS_DEFAULT(NmethodSweepCheckInterval)) {
 630         // Only one thread at a time can do sweeping. Scale the
 631         // wait time according to the number of compiler threads.
 632         // As a result, the next sweep is likely to happen every 100ms


src/share/vm/compiler/compileBroker.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File