< prev index next >

src/hotspot/share/compiler/compileBroker.cpp

Print this page

        

@@ -1779,25 +1779,22 @@
             CodeCache::free(thread->get_buffer_blob());
           }
           return; // Stop this thread.
         }
       }
-      continue;
-    }
-
-    if (UseDynamicNumberOfCompilerThreads) {
-      possibly_add_compiler_threads();
-    }
+    } else {
 
     // Give compiler threads an extra quanta.  They tend to be bursty and
     // this helps the compiler to finish up the job.
     if (CompilerThreadHintNoPreempt) {
       os::hint_no_preempt();
     }
 
     // Assign the task to the current thread.  Mark this compilation
     // thread as active for the profiler.
+      // CompileTaskWrapper also keeps the Method* from being deallocated if redefinition
+      // occurs after fetching the compile task off the queue.
     CompileTaskWrapper ctw(task);
     nmethodLocker result_handle;  // (handle for the nmethod produced by this task)
     task->set_code_handle(&result_handle);
     methodHandle method(thread, task->method());
 

@@ -1811,10 +1808,15 @@
         // After compilation is disabled, remove remaining methods from queue
         method->clear_queued_for_compilation();
         task->set_failure_reason("compilation is disabled");
       }
     }
+
+      if (UseDynamicNumberOfCompilerThreads) {
+        possibly_add_compiler_threads();
+      }
+    }
   }
 
   // Shut down compiler runtime
   shutdown_compiler_runtime(thread->compiler(), thread);
 }
< prev index next >