# HG changeset patch # User anoll # Date 1399363274 0 # Node ID c657ae48974c50a51a81683d8a3c48c8e2a259ee # Parent 616bc709c0e40c5290bfa4398d6f99c2d47005a8# Parent 46eee6f687577aeacc0f7ddbc69adf010fc77ea9 Merge diff -r 616bc709c0e4 -r c657ae48974c hotspot/src/share/vm/compiler/compileBroker.cpp --- a/hotspot/src/share/vm/compiler/compileBroker.cpp Tue May 06 09:17:57 2014 +0200 +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Tue May 06 08:01:14 2014 +0000 @@ -625,17 +625,27 @@ lock()->notify_all(); } +/** + * Empties compilation queue by putting all compilation tasks onto + * a freelist. Furthermore, the method wakes up all threads that are + * waiting on a compilation task to finish. This can happen if background + * compilation is disabled. + */ void CompileQueue::free_all() { MutexLocker mu(lock()); - if (_first != NULL) { - for (CompileTask* task = _first; task != NULL; task = task->next()) { - // Wake up thread that blocks on the compile task. - task->lock()->notify(); - // Puts task back on the freelist. - CompileTask::free(task); - } - _first = NULL; + CompileTask* next = _first; + + // Iterate over all tasks in the compile queue + while (next != NULL) { + CompileTask* current = next; + next = current->next(); + // Wake up thread that blocks on the compile task. + current->lock()->notify(); + // Put the task back on the freelist. + CompileTask::free(current); } + _first = NULL; + // Wake up all threads that block on the queue. lock()->notify_all(); }