mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 11:58:55 +00:00
Bug 1714141 - Remove unused 'producer' condition variable r=sfink
This is unused since the internal thread pool has its own now. Differential Revision: https://phabricator.services.mozilla.com/D117162
This commit is contained in:
parent
77bd390b78
commit
e19f735ced
@ -101,7 +101,7 @@ void js::GCParallelTask::joinRunningOrFinishedTask(
|
||||
|
||||
// Wait for the task to run to completion.
|
||||
while (!isFinished(lock)) {
|
||||
HelperThreadState().wait(lock, GlobalHelperThreadState::CONSUMER);
|
||||
HelperThreadState().wait(lock);
|
||||
}
|
||||
|
||||
setIdle(lock);
|
||||
|
@ -210,21 +210,9 @@ class GlobalHelperThreadState {
|
||||
void assertIsLockedByCurrentThread() const;
|
||||
#endif
|
||||
|
||||
enum CondVar {
|
||||
// For notifying threads waiting for work that they may be able to make
|
||||
// progress, ie, a work item has been completed by a helper thread and
|
||||
// the thread that created the work item can now consume it.
|
||||
CONSUMER,
|
||||
|
||||
// For notifying helper threads doing the work that they may be able to
|
||||
// make progress, ie, a work item has been enqueued and an idle helper
|
||||
// thread may pick up up the work item and perform it.
|
||||
PRODUCER,
|
||||
};
|
||||
|
||||
void wait(AutoLockHelperThreadState& locked, CondVar which,
|
||||
void wait(AutoLockHelperThreadState& locked,
|
||||
mozilla::TimeDuration timeout = mozilla::TimeDuration::Forever());
|
||||
void notifyAll(CondVar which, const AutoLockHelperThreadState&);
|
||||
void notifyAll(const AutoLockHelperThreadState&);
|
||||
|
||||
bool useInternalThreadPool(const AutoLockHelperThreadState& lock) const {
|
||||
return useInternalThreadPool_;
|
||||
@ -235,7 +223,7 @@ class GlobalHelperThreadState {
|
||||
}
|
||||
|
||||
private:
|
||||
void notifyOne(CondVar which, const AutoLockHelperThreadState&);
|
||||
void notifyOne(const AutoLockHelperThreadState&);
|
||||
|
||||
public:
|
||||
// Helper method for removing items from the vectors below while iterating
|
||||
@ -424,20 +412,9 @@ class GlobalHelperThreadState {
|
||||
void triggerFreeUnusedMemory();
|
||||
|
||||
private:
|
||||
/* Condvars for threads waiting/notifying each other. */
|
||||
// Condition variable for notifiying the main thread that a helper task has
|
||||
// completed some work.
|
||||
js::ConditionVariable consumerWakeup;
|
||||
js::ConditionVariable producerWakeup;
|
||||
|
||||
js::ConditionVariable& whichWakeup(CondVar which) {
|
||||
switch (which) {
|
||||
case CONSUMER:
|
||||
return consumerWakeup;
|
||||
case PRODUCER:
|
||||
return producerWakeup;
|
||||
default:
|
||||
MOZ_CRASH("Invalid CondVar in |whichWakeup|");
|
||||
}
|
||||
}
|
||||
|
||||
void dispatch(const AutoLockHelperThreadState& locked);
|
||||
|
||||
|
@ -235,7 +235,7 @@ static void CancelOffThreadWasmTier2GeneratorLocked(
|
||||
HelperThreadState().wasmTier2GeneratorsFinished(lock);
|
||||
while (HelperThreadState().wasmTier2GeneratorsFinished(lock) ==
|
||||
oldFinishedCount) {
|
||||
HelperThreadState().wait(lock, GlobalHelperThreadState::CONSUMER);
|
||||
HelperThreadState().wait(lock);
|
||||
}
|
||||
|
||||
// At most one of these tasks.
|
||||
@ -398,7 +398,7 @@ static void CancelOffThreadIonCompileLocked(const CompilationSelector& selector,
|
||||
}
|
||||
}
|
||||
if (cancelled) {
|
||||
HelperThreadState().wait(lock, GlobalHelperThreadState::CONSUMER);
|
||||
HelperThreadState().wait(lock);
|
||||
}
|
||||
} while (cancelled);
|
||||
|
||||
@ -926,7 +926,7 @@ static void WaitForOffThreadParses(JSRuntime* rt,
|
||||
break;
|
||||
}
|
||||
}
|
||||
HelperThreadState().wait(lock, GlobalHelperThreadState::CONSUMER);
|
||||
HelperThreadState().wait(lock);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -1438,19 +1438,17 @@ void GlobalHelperThreadState::dispatch(
|
||||
}
|
||||
|
||||
void GlobalHelperThreadState::wait(
|
||||
AutoLockHelperThreadState& locked, CondVar which,
|
||||
AutoLockHelperThreadState& locked,
|
||||
TimeDuration timeout /* = TimeDuration::Forever() */) {
|
||||
whichWakeup(which).wait_for(locked, timeout);
|
||||
consumerWakeup.wait_for(locked, timeout);
|
||||
}
|
||||
|
||||
void GlobalHelperThreadState::notifyAll(CondVar which,
|
||||
const AutoLockHelperThreadState&) {
|
||||
whichWakeup(which).notify_all();
|
||||
void GlobalHelperThreadState::notifyAll(const AutoLockHelperThreadState&) {
|
||||
consumerWakeup.notify_all();
|
||||
}
|
||||
|
||||
void GlobalHelperThreadState::notifyOne(CondVar which,
|
||||
const AutoLockHelperThreadState&) {
|
||||
whichWakeup(which).notify_one();
|
||||
void GlobalHelperThreadState::notifyOne(const AutoLockHelperThreadState&) {
|
||||
consumerWakeup.notify_one();
|
||||
}
|
||||
|
||||
bool GlobalHelperThreadState::hasActiveThreads(
|
||||
@ -1475,7 +1473,7 @@ void GlobalHelperThreadState::waitForAllTasksLocked(
|
||||
|
||||
while (canStartTasks(lock) || tasksPending_ ||
|
||||
hasActiveThreads(lock)) {
|
||||
wait(lock, CONSUMER);
|
||||
wait(lock);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(gcParallelWorklist(lock).isEmpty());
|
||||
@ -2368,7 +2366,7 @@ void GlobalHelperThreadState::cancelParseTask(JSRuntime* rt, ParseTaskKind kind,
|
||||
break;
|
||||
}
|
||||
|
||||
HelperThreadState().wait(lock, GlobalHelperThreadState::CONSUMER);
|
||||
HelperThreadState().wait(lock);
|
||||
}
|
||||
|
||||
auto& finished = HelperThreadState().parseFinishedList(lock);
|
||||
@ -2497,7 +2495,7 @@ void js::CancelOffThreadCompressions(JSRuntime* runtime) {
|
||||
break;
|
||||
}
|
||||
|
||||
HelperThreadState().wait(lock, GlobalHelperThreadState::CONSUMER);
|
||||
HelperThreadState().wait(lock);
|
||||
}
|
||||
|
||||
// Clean up finished tasks.
|
||||
@ -2538,7 +2536,7 @@ void js::RunPendingSourceCompressions(JSRuntime* runtime) {
|
||||
|
||||
// Wait until all tasks have started compression.
|
||||
while (!HelperThreadState().compressionWorklist(lock).empty()) {
|
||||
HelperThreadState().wait(lock, GlobalHelperThreadState::CONSUMER);
|
||||
HelperThreadState().wait(lock);
|
||||
}
|
||||
|
||||
// Wait for all in-process compression tasks to complete.
|
||||
@ -2703,7 +2701,7 @@ void GlobalHelperThreadState::runOneTask(AutoLockHelperThreadState& lock) {
|
||||
dispatch(lock);
|
||||
}
|
||||
|
||||
notifyAll(GlobalHelperThreadState::CONSUMER, lock);
|
||||
notifyAll(lock);
|
||||
}
|
||||
|
||||
HelperThreadTask* GlobalHelperThreadState::findHighestPriorityTask(
|
||||
|
@ -72,7 +72,8 @@ class Module::Tier2GeneratorTaskImpl : public Tier2GeneratorTask {
|
||||
|
||||
// During shutdown the main thread will wait for any ongoing (cancelled)
|
||||
// tier-2 generation to shut down normally. To do so, it waits on the
|
||||
// CONSUMER condition for the count of finished generators to rise.
|
||||
// HelperThreadState's condition variable for the count of finished
|
||||
// generators to rise.
|
||||
HelperThreadState().incWasmTier2GeneratorsFinished(locked);
|
||||
|
||||
// The task is finished, release it.
|
||||
|
Loading…
x
Reference in New Issue
Block a user