Commit 2d0b17d5 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Do not contribute to concurrent recompilation

If multiple recompilations are triggered at the same time, we cannot
contribute to compilation, because this would bump the number of workers
above the maximum expected concurrency.

This is a quick fix, a better (but more involved) fix would be to make
the number of queues grow dynamically.

R=thibaudm@chromium.org

Bug: chromium:1123471

Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_rel_ng
Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_isolates_rel_ng
Change-Id: I30e4b2a057098ad7267ae942e5845b0cefe60e0b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2387561Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69639}
parent 32435062
...@@ -2849,12 +2849,19 @@ void CompilationStateImpl::InitializeRecompilation( ...@@ -2849,12 +2849,19 @@ void CompilationStateImpl::InitializeRecompilation(
// is disabled). // is disabled).
base::Optional<base::MutexGuard> guard(&callbacks_mutex_); base::Optional<base::MutexGuard> guard(&callbacks_mutex_);
while (NumOutstandingCompilations() > 0) { // For now, we cannot contribute to compilation here, because this would bump
// Take part in compilation, after releasing the mutex. // the number of workers above the expected maximum concurrency. This can be
// fixed once we grow the number of compilation unit queues dynamically.
// TODO(clemensb): Contribute to compilation once the queues grow dynamically.
while (outstanding_recompilation_functions_ > 0) {
auto semaphore = std::make_shared<base::Semaphore>(0);
callbacks_.emplace_back([semaphore](CompilationEvent event) {
if (event == CompilationEvent::kFinishedRecompilation) {
semaphore->Signal();
}
});
guard.reset(); guard.reset();
constexpr JobDelegate* kNoDelegate = nullptr; semaphore->Wait();
ExecuteCompilationUnits(background_compile_token_, async_counters_.get(),
kNoDelegate, kBaselineOrTopTier);
guard.emplace(&callbacks_mutex_); guard.emplace(&callbacks_mutex_);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment