[Orc] Reorder operations in ExecutorSharedMemoryMapperService shutdown

Differential Revision: https://reviews.llvm.org/D131510
This commit is contained in:
Anubhab Ghosh 2022-08-09 22:53:43 +05:30
parent efc75a2bae
commit 0aaa74f7e6
1 changed files with 13 additions and 10 deletions

View File

@ -265,18 +265,21 @@ Error ExecutorSharedMemoryMapperService::release(
Error ExecutorSharedMemoryMapperService::shutdown() {
std::vector<ExecutorAddr> ReservationAddrs;
if (!Reservations.empty()) {
{
std::lock_guard<std::mutex> Lock(Mutex);
{
ReservationAddrs.reserve(Reservations.size());
for (const auto &R : Reservations) {
ReservationAddrs.push_back(ExecutorAddr::fromPtr(R.getFirst()));
}
}
}
return release(ReservationAddrs);
return Error::success();
if (Reservations.empty())
return Error::success();
ReservationAddrs.reserve(Reservations.size());
for (const auto &R : Reservations) {
ReservationAddrs.push_back(ExecutorAddr::fromPtr(R.getFirst()));
}
Reservations.clear();
}
return release(ReservationAddrs);
}
void ExecutorSharedMemoryMapperService::addBootstrapSymbols(