summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/ExecutionEngine.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2014-06-18 20:17:35 +0000
committerZachary Turner <zturner@google.com>2014-06-18 20:17:35 +0000
commit1f502bd9d7d2c1f98ad93a09ffe435e11a95aedd (patch)
tree82933a5d1d0e64418c721231a411dac3d9267f12 /lib/ExecutionEngine/ExecutionEngine.cpp
parentb2791542c2c5df2912848b8bdf06fb1093d4ac12 (diff)
downloadllvm-1f502bd9d7d2c1f98ad93a09ffe435e11a95aedd.tar.gz
llvm-1f502bd9d7d2c1f98ad93a09ffe435e11a95aedd.tar.bz2
llvm-1f502bd9d7d2c1f98ad93a09ffe435e11a95aedd.tar.xz
Replace Execution Engine's mutex with std::recursive_mutex.
This change has a bit of a trickle down effect due to the fact that there are a number of derived implementations of ExecutionEngine, and that the mutex is not tightly encapsulated so is used by other classes directly. Reviewed by: rnk Differential Revision: http://reviews.llvm.org/D4196 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211214 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r--lib/ExecutionEngine/ExecutionEngine.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp
index 9154fe2f5f..553ceb4575 100644
--- a/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -166,7 +166,7 @@ void *ExecutionEngineState::RemoveMapping(const GlobalValue *ToUnmap) {
}
void ExecutionEngine::addGlobalMapping(const GlobalValue *GV, void *Addr) {
- MutexGuard locked(lock);
+ std::lock_guard<std::recursive_mutex> locked(lock);
DEBUG(dbgs() << "JIT: Map \'" << GV->getName()
<< "\' to [" << Addr << "]\n";);
@@ -184,14 +184,14 @@ void ExecutionEngine::addGlobalMapping(const GlobalValue *GV, void *Addr) {
}
void ExecutionEngine::clearAllGlobalMappings() {
- MutexGuard locked(lock);
+ std::lock_guard<std::recursive_mutex> locked(lock);
EEState.getGlobalAddressMap().clear();
EEState.getGlobalAddressReverseMap().clear();
}
void ExecutionEngine::clearGlobalMappingsFromModule(Module *M) {
- MutexGuard locked(lock);
+ std::lock_guard<std::recursive_mutex> locked(lock);
for (Module::iterator FI = M->begin(), FE = M->end(); FI != FE; ++FI)
EEState.RemoveMapping(FI);
@@ -201,7 +201,7 @@ void ExecutionEngine::clearGlobalMappingsFromModule(Module *M) {
}
void *ExecutionEngine::updateGlobalMapping(const GlobalValue *GV, void *Addr) {
- MutexGuard locked(lock);
+ std::lock_guard<std::recursive_mutex> locked(lock);
ExecutionEngineState::GlobalAddressMapTy &Map =
EEState.getGlobalAddressMap();
@@ -228,7 +228,7 @@ void *ExecutionEngine::updateGlobalMapping(const GlobalValue *GV, void *Addr) {
}
void *ExecutionEngine::getPointerToGlobalIfAvailable(const GlobalValue *GV) {
- MutexGuard locked(lock);
+ std::lock_guard<std::recursive_mutex> locked(lock);
ExecutionEngineState::GlobalAddressMapTy::iterator I =
EEState.getGlobalAddressMap().find(GV);
@@ -236,7 +236,7 @@ void *ExecutionEngine::getPointerToGlobalIfAvailable(const GlobalValue *GV) {
}
const GlobalValue *ExecutionEngine::getGlobalValueAtAddress(void *Addr) {
- MutexGuard locked(lock);
+ std::lock_guard<std::recursive_mutex> locked(lock);
// If we haven't computed the reverse mapping yet, do so first.
if (EEState.getGlobalAddressReverseMap().empty()) {
@@ -555,7 +555,7 @@ void *ExecutionEngine::getPointerToGlobal(const GlobalValue *GV) {
if (Function *F = const_cast<Function*>(dyn_cast<Function>(GV)))
return getPointerToFunction(F);
- MutexGuard locked(lock);
+ std::lock_guard<std::recursive_mutex> locked(lock);
if (void *P = EEState.getGlobalAddressMap()[GV])
return P;
@@ -1346,7 +1346,7 @@ ExecutionEngineState::ExecutionEngineState(ExecutionEngine &EE)
: EE(EE), GlobalAddressMap(this) {
}
-sys::Mutex *
+std::recursive_mutex *
ExecutionEngineState::AddressMapConfig::getMutex(ExecutionEngineState *EES) {
return &EES->EE.lock;
}