Mercurial > hg > graal-jvmci-8
comparison src/share/vm/compiler/compileBroker.cpp @ 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 |
comparison
equal
deleted
inserted
replaced
20589:0c0e68524c17 | 20590:c47fcf523fff |
---|---|
662 | 662 |
663 // Notify CompilerThreads that a task is available. | 663 // Notify CompilerThreads that a task is available. |
664 lock()->notify_all(); | 664 lock()->notify_all(); |
665 } | 665 } |
666 | 666 |
667 /** | |
668 * Empties compilation queue by putting all compilation tasks onto | |
669 * a freelist. Furthermore, the method wakes up all threads that are | |
670 * waiting on a compilation task to finish. This can happen if background | |
671 * compilation is disabled. | |
672 */ | |
667 void CompileQueue::free_all() { | 673 void CompileQueue::free_all() { |
668 MutexLocker mu(lock()); | 674 MutexLocker mu(lock()); |
669 if (_first != NULL) { | 675 CompileTask* next = _first; |
670 for (CompileTask* task = _first; task != NULL; task = task->next()) { | 676 |
671 // Wake up thread that blocks on the compile task. | 677 // Iterate over all tasks in the compile queue |
672 task->lock()->notify(); | 678 while (next != NULL) { |
673 // Puts task back on the freelist. | 679 CompileTask* current = next; |
674 CompileTask::free(task); | 680 next = current->next(); |
675 } | 681 // Wake up thread that blocks on the compile task. |
676 _first = NULL; | 682 current->lock()->notify(); |
677 } | 683 // Put the task back on the freelist. |
684 CompileTask::free(current); | |
685 } | |
686 _first = NULL; | |
687 | |
678 // Wake up all threads that block on the queue. | 688 // Wake up all threads that block on the queue. |
679 lock()->notify_all(); | 689 lock()->notify_all(); |
680 } | 690 } |
681 | 691 |
682 // ------------------------------------------------------------------ | 692 // ------------------------------------------------------------------ |