Mercurial > hg > graal-jvmci-8
changeset 20590:c47fcf523fff
8042428: CompileQueue::free_all() code is incorrect
Summary: Free task after getting next pointer of freelist.
Reviewed-by: kvn, adlertz
author | anoll |
---|---|
date | Tue, 06 May 2014 09:52:38 +0200 |
parents | 0c0e68524c17 |
children | 28051f14c328 |
files | src/share/vm/compiler/compileBroker.cpp |
diffstat | 1 files changed, 18 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/compiler/compileBroker.cpp Wed May 07 22:06:42 2014 +0200 +++ b/src/share/vm/compiler/compileBroker.cpp Tue May 06 09:52:38 2014 +0200 @@ -664,17 +664,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(); }