Commit cfeb66d2 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm][debug] Fix deadlock in recompilation

Triggering recompilation can reduce the number of outstanding
recompilation functions. If it gets reduced to zero, we also need to
trigger other callbacks waiting for recompilation to finish.
This situation can happen if all recompiled code was already
installed in the native module, but the compilation state was not
updated yet via {OnFinishedUnits}.

R=thibaudm@chromium.org

Bug: v8:10557, chromium:1084369, v8:10359
Change-Id: Ib80ff110776cf284632303b0b23e4c6e63426411
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2214828Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67965}
parent 5c05acf7
......@@ -2596,6 +2596,9 @@ void CompilationStateImpl::InitializeRecompilation(
{
base::MutexGuard guard(&callbacks_mutex_);
callbacks_.emplace_back(std::move(recompilation_finished_callback));
tiering_state_ = new_tiering_state;
// If compilation progress is not initialized yet, then compilation didn't
// start yet, and new code will be kept tiered-down from the start. For
// streaming compilation, there is a special path to tier down later, when
......@@ -2624,13 +2627,10 @@ void CompilationStateImpl::InitializeRecompilation(
}
}
// Trigger callback if module needs no recompilation. Add to the list of
// callbacks (to be called later) otherwise.
// Trigger callback if module needs no recompilation.
if (outstanding_recompilation_functions_ == 0) {
recompilation_finished_callback(CompilationEvent::kFinishedRecompilation);
} else {
callbacks_.emplace_back(std::move(recompilation_finished_callback));
tiering_state_ = new_tiering_state;
TriggerCallbacks(base::EnumSet<CompilationEvent>(
{CompilationEvent::kFinishedRecompilation}));
}
}
......
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