[llvm] 1c25ce1 - [Orc] Fix the SharedMemoryMapper dtor

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 5 09:17:23 PDT 2022


Author: Alexandre Ganea
Date: 2022-10-05T12:16:54-04:00
New Revision: 1c25ce1738df68516d47c30d7962ef5f4cc09826

URL: https://github.com/llvm/llvm-project/commit/1c25ce1738df68516d47c30d7962ef5f4cc09826
DIFF: https://github.com/llvm/llvm-project/commit/1c25ce1738df68516d47c30d7962ef5f4cc09826.diff

LOG: [Orc] Fix the SharedMemoryMapper dtor

As briefly discussed on https://reviews.llvm.org/rG1134d3a03facccd75efc5385ba46918bef94fcb6, fix the unintended copy while iterating on Reservations and add a mutex guard, to be symmetric with other usages of Reservations.

Differential revision: https://reviews.llvm.org/D134212

Added: 
    

Modified: 
    llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp b/llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp
index ecdf773d04697..bb4568b991956 100644
--- a/llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp
@@ -412,6 +412,7 @@ void SharedMemoryMapper::release(ArrayRef<ExecutorAddr> Bases,
 }
 
 SharedMemoryMapper::~SharedMemoryMapper() {
+  std::lock_guard<std::mutex> Lock(Mutex);
   for (const auto &R : Reservations) {
 
 #if defined(LLVM_ON_UNIX) && !defined(__ANDROID__)


        


More information about the llvm-commits mailing list