summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp26
-rw-r--r--llvm/lib/ExecutionEngine/GDBRegistrationListener.cpp8
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp4
-rw-r--r--llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp38
-rw-r--r--llvm/lib/ExecutionEngine/OProfileJIT/OProfileWrapper.cpp4
-rw-r--r--llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp6
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp8
7 files changed, 47 insertions, 47 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index 1c6c0406d04..75ac80f4b75 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -32,12 +32,12 @@
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Host.h"
-#include "llvm/Support/MutexGuard.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include <cmath>
#include <cstring>
+#include <mutex>
using namespace llvm;
#define DEBUG_TYPE "jit"
@@ -191,7 +191,7 @@ uint64_t ExecutionEngineState::RemoveMapping(StringRef Name) {
std::string ExecutionEngine::getMangledName(const GlobalValue *GV) {
assert(GV->hasName() && "Global must have name.");
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
SmallString<128> FullName;
const DataLayout &DL =
@@ -204,12 +204,12 @@ std::string ExecutionEngine::getMangledName(const GlobalValue *GV) {
}
void ExecutionEngine::addGlobalMapping(const GlobalValue *GV, void *Addr) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
addGlobalMapping(getMangledName(GV), (uint64_t) Addr);
}
void ExecutionEngine::addGlobalMapping(StringRef Name, uint64_t Addr) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
assert(!Name.empty() && "Empty GlobalMapping symbol name!");
@@ -228,14 +228,14 @@ void ExecutionEngine::addGlobalMapping(StringRef Name, uint64_t Addr) {
}
void ExecutionEngine::clearAllGlobalMappings() {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
EEState.getGlobalAddressMap().clear();
EEState.getGlobalAddressReverseMap().clear();
}
void ExecutionEngine::clearGlobalMappingsFromModule(Module *M) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
for (GlobalObject &GO : M->global_objects())
EEState.RemoveMapping(getMangledName(&GO));
@@ -243,12 +243,12 @@ void ExecutionEngine::clearGlobalMappingsFromModule(Module *M) {
uint64_t ExecutionEngine::updateGlobalMapping(const GlobalValue *GV,
void *Addr) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
return updateGlobalMapping(getMangledName(GV), (uint64_t) Addr);
}
uint64_t ExecutionEngine::updateGlobalMapping(StringRef Name, uint64_t Addr) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
ExecutionEngineState::GlobalAddressMapTy &Map =
EEState.getGlobalAddressMap();
@@ -275,7 +275,7 @@ uint64_t ExecutionEngine::updateGlobalMapping(StringRef Name, uint64_t Addr) {
}
uint64_t ExecutionEngine::getAddressToGlobalIfAvailable(StringRef S) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
uint64_t Address = 0;
ExecutionEngineState::GlobalAddressMapTy::iterator I =
EEState.getGlobalAddressMap().find(S);
@@ -286,19 +286,19 @@ uint64_t ExecutionEngine::getAddressToGlobalIfAvailable(StringRef S) {
void *ExecutionEngine::getPointerToGlobalIfAvailable(StringRef S) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
if (void* Address = (void *) getAddressToGlobalIfAvailable(S))
return Address;
return nullptr;
}
void *ExecutionEngine::getPointerToGlobalIfAvailable(const GlobalValue *GV) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
return getPointerToGlobalIfAvailable(getMangledName(GV));
}
const GlobalValue *ExecutionEngine::getGlobalValueAtAddress(void *Addr) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
// If we haven't computed the reverse mapping yet, do so first.
if (EEState.getGlobalAddressReverseMap().empty()) {
@@ -575,7 +575,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<sys::Mutex> locked(lock);
if (void* P = getPointerToGlobalIfAvailable(GV))
return P;
diff --git a/llvm/lib/ExecutionEngine/GDBRegistrationListener.cpp b/llvm/lib/ExecutionEngine/GDBRegistrationListener.cpp
index 08d20156a59..7ed025fbb48 100644
--- a/llvm/lib/ExecutionEngine/GDBRegistrationListener.cpp
+++ b/llvm/lib/ExecutionEngine/GDBRegistrationListener.cpp
@@ -14,7 +14,7 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Mutex.h"
-#include "llvm/Support/MutexGuard.h"
+#include <mutex>
using namespace llvm;
using namespace llvm::object;
@@ -135,7 +135,7 @@ void NotifyDebugger(jit_code_entry* JITCodeEntry) {
GDBJITRegistrationListener::~GDBJITRegistrationListener() {
// Free all registered object files.
- llvm::MutexGuard locked(*JITDebugLock);
+ std::lock_guard<llvm::sys::Mutex> locked(*JITDebugLock);
for (RegisteredObjectBufferMap::iterator I = ObjectBufferMap.begin(),
E = ObjectBufferMap.end();
I != E; ++I) {
@@ -159,7 +159,7 @@ void GDBJITRegistrationListener::notifyObjectLoaded(
const char *Buffer = DebugObj.getBinary()->getMemoryBufferRef().getBufferStart();
size_t Size = DebugObj.getBinary()->getMemoryBufferRef().getBufferSize();
- llvm::MutexGuard locked(*JITDebugLock);
+ std::lock_guard<llvm::sys::Mutex> locked(*JITDebugLock);
assert(ObjectBufferMap.find(K) == ObjectBufferMap.end() &&
"Second attempt to perform debug registration.");
jit_code_entry* JITCodeEntry = new jit_code_entry();
@@ -178,7 +178,7 @@ void GDBJITRegistrationListener::notifyObjectLoaded(
}
void GDBJITRegistrationListener::notifyFreeingObject(ObjectKey K) {
- llvm::MutexGuard locked(*JITDebugLock);
+ std::lock_guard<llvm::sys::Mutex> locked(*JITDebugLock);
RegisteredObjectBufferMap::iterator I = ObjectBufferMap.find(K);
if (I != ObjectBufferMap.end()) {
diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
index c3a2ccc582c..71b7f893d71 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
@@ -32,7 +32,6 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Mutex.h"
-#include "llvm/Support/UniqueLock.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cmath>
@@ -41,6 +40,7 @@
#include <cstdio>
#include <cstring>
#include <map>
+#include <mutex>
#include <string>
#include <utility>
#include <vector>
@@ -258,7 +258,7 @@ GenericValue Interpreter::callExternalFunction(Function *F,
ArrayRef<GenericValue> ArgVals) {
TheInterpreter = this;
- unique_lock<sys::Mutex> Guard(*FunctionsLock);
+ std::unique_lock<sys::Mutex> Guard(*FunctionsLock);
// Do a lookup to see if the function is in our cache... this should just be a
// deferred annotation!
diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
index 08815b7a80a..94741f5f01d 100644
--- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
+++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
@@ -23,7 +23,7 @@
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/MutexGuard.h"
+#include <mutex>
using namespace llvm;
@@ -88,7 +88,7 @@ MCJIT::MCJIT(std::unique_ptr<Module> M, std::unique_ptr<TargetMachine> TM,
}
MCJIT::~MCJIT() {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
Dyld.deregisterEHFrames();
@@ -100,7 +100,7 @@ MCJIT::~MCJIT() {
}
void MCJIT::addModule(std::unique_ptr<Module> M) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
if (M->getDataLayout().isDefault())
M->setDataLayout(getDataLayout());
@@ -109,7 +109,7 @@ void MCJIT::addModule(std::unique_ptr<Module> M) {
}
bool MCJIT::removeModule(Module *M) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
return OwnedModules.removeModule(M);
}
@@ -136,14 +136,14 @@ void MCJIT::addArchive(object::OwningBinary<object::Archive> A) {
}
void MCJIT::setObjectCache(ObjectCache* NewCache) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
ObjCache = NewCache;
}
std::unique_ptr<MemoryBuffer> MCJIT::emitObject(Module *M) {
assert(M && "Can not emit a null module");
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
// Materialize all globals in the module if they have not been
// materialized already.
@@ -185,7 +185,7 @@ std::unique_ptr<MemoryBuffer> MCJIT::emitObject(Module *M) {
void MCJIT::generateCodeForModule(Module *M) {
// Get a thread lock to make sure we aren't trying to load multiple times
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
// This must be a module which has already been added to this MCJIT instance.
assert(OwnedModules.ownsModule(M) &&
@@ -234,7 +234,7 @@ void MCJIT::generateCodeForModule(Module *M) {
}
void MCJIT::finalizeLoadedModules() {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
// Resolve any outstanding relocations.
Dyld.resolveRelocations();
@@ -250,7 +250,7 @@ void MCJIT::finalizeLoadedModules() {
// FIXME: Rename this.
void MCJIT::finalizeObject() {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
// Generate code for module is going to move objects out of the 'added' list,
// so we need to copy that out before using it:
@@ -265,7 +265,7 @@ void MCJIT::finalizeObject() {
}
void MCJIT::finalizeModule(Module *M) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
// This must be a module which has already been added to this MCJIT instance.
assert(OwnedModules.ownsModule(M) && "MCJIT::finalizeModule: Unknown module.");
@@ -292,7 +292,7 @@ Module *MCJIT::findModuleForSymbol(const std::string &Name,
if (DemangledName[0] == getDataLayout().getGlobalPrefix())
DemangledName = DemangledName.substr(1);
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
// If it hasn't already been generated, see if it's in one of our modules.
for (ModulePtrSet::iterator I = OwnedModules.begin_added(),
@@ -332,7 +332,7 @@ uint64_t MCJIT::getSymbolAddress(const std::string &Name,
JITSymbol MCJIT::findSymbol(const std::string &Name,
bool CheckFunctionsOnly) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
// First, check to see if we already have this symbol.
if (auto Sym = findExistingSymbol(Name))
@@ -388,7 +388,7 @@ JITSymbol MCJIT::findSymbol(const std::string &Name,
}
uint64_t MCJIT::getGlobalValueAddress(const std::string &Name) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
uint64_t Result = getSymbolAddress(Name, false);
if (Result != 0)
finalizeLoadedModules();
@@ -396,7 +396,7 @@ uint64_t MCJIT::getGlobalValueAddress(const std::string &Name) {
}
uint64_t MCJIT::getFunctionAddress(const std::string &Name) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
uint64_t Result = getSymbolAddress(Name, true);
if (Result != 0)
finalizeLoadedModules();
@@ -405,7 +405,7 @@ uint64_t MCJIT::getFunctionAddress(const std::string &Name) {
// Deprecated. Use getFunctionAddress instead.
void *MCJIT::getPointerToFunction(Function *F) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
Mangler Mang;
SmallString<128> Name;
@@ -632,14 +632,14 @@ void *MCJIT::getPointerToNamedFunction(StringRef Name, bool AbortOnFailure) {
void MCJIT::RegisterJITEventListener(JITEventListener *L) {
if (!L)
return;
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
EventListeners.push_back(L);
}
void MCJIT::UnregisterJITEventListener(JITEventListener *L) {
if (!L)
return;
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
auto I = find(reverse(EventListeners), L);
if (I != EventListeners.rend()) {
std::swap(*I, EventListeners.back());
@@ -651,7 +651,7 @@ void MCJIT::notifyObjectLoaded(const object::ObjectFile &Obj,
const RuntimeDyld::LoadedObjectInfo &L) {
uint64_t Key =
static_cast<uint64_t>(reinterpret_cast<uintptr_t>(Obj.getData().data()));
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
MemMgr->notifyObjectLoaded(this, Obj);
for (unsigned I = 0, S = EventListeners.size(); I < S; ++I) {
EventListeners[I]->notifyObjectLoaded(Key, Obj, L);
@@ -661,7 +661,7 @@ void MCJIT::notifyObjectLoaded(const object::ObjectFile &Obj,
void MCJIT::notifyFreeingObject(const object::ObjectFile &Obj) {
uint64_t Key =
static_cast<uint64_t>(reinterpret_cast<uintptr_t>(Obj.getData().data()));
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
for (JITEventListener *L : EventListeners)
L->notifyFreeingObject(Key);
}
diff --git a/llvm/lib/ExecutionEngine/OProfileJIT/OProfileWrapper.cpp b/llvm/lib/ExecutionEngine/OProfileJIT/OProfileWrapper.cpp
index 1a266773692..b78d2531382 100644
--- a/llvm/lib/ExecutionEngine/OProfileJIT/OProfileWrapper.cpp
+++ b/llvm/lib/ExecutionEngine/OProfileJIT/OProfileWrapper.cpp
@@ -17,11 +17,11 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/Mutex.h"
-#include "llvm/Support/MutexGuard.h"
#include "llvm/Support/raw_ostream.h"
#include <cstring>
#include <dirent.h>
#include <fcntl.h>
+#include <mutex>
#include <stddef.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -54,7 +54,7 @@ bool OProfileWrapper::initialize() {
using namespace llvm;
using namespace llvm::sys;
- MutexGuard Guard(OProfileInitializationMutex);
+ std::lock_guard<sys::Mutex> Guard(OProfileInitializationMutex);
if (Initialized)
return OpenAgentFunc != 0;
diff --git a/llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp b/llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp
index 5606421a3cb..5a898d96d7d 100644
--- a/llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp
+++ b/llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp
@@ -26,11 +26,11 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Mutex.h"
-#include "llvm/Support/MutexGuard.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Threading.h"
#include "llvm/Support/raw_ostream.h"
+#include <mutex>
#include <sys/mman.h> // mmap()
#include <sys/types.h> // getpid()
@@ -420,7 +420,7 @@ void PerfJITEventListener::NotifyCode(Expected<llvm::StringRef> &Symbol,
rec.Tid = get_threadid();
// avoid interspersing output
- MutexGuard Guard(Mutex);
+ std::lock_guard<sys::Mutex> Guard(Mutex);
rec.CodeIndex = CodeGeneration++; // under lock!
@@ -462,7 +462,7 @@ void PerfJITEventListener::NotifyDebug(uint64_t CodeAddr,
// * char name[n] : source file name in ASCII, including null termination
// avoid interspersing output
- MutexGuard Guard(Mutex);
+ std::lock_guard<sys::Mutex> Guard(Mutex);
Dumpstream->write(reinterpret_cast<const char *>(&rec), sizeof(rec));
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
index e26e6ce45db..f73d1c61edf 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -20,7 +20,7 @@
#include "llvm/Support/MSVCErrorWorkarounds.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MathExtras.h"
-#include "llvm/Support/MutexGuard.h"
+#include <mutex>
#include <future>
@@ -120,7 +120,7 @@ static void dumpSectionMemory(const SectionEntry &S, StringRef State) {
// Resolve the relocations for all symbols we currently know about.
void RuntimeDyldImpl::resolveRelocations() {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
// Print out the sections prior to relocation.
LLVM_DEBUG(for (int i = 0, e = Sections.size(); i != e; ++i)
@@ -156,7 +156,7 @@ void RuntimeDyldImpl::resolveLocalRelocations() {
void RuntimeDyldImpl::mapSectionAddress(const void *LocalAddress,
uint64_t TargetAddress) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
for (unsigned i = 0, e = Sections.size(); i != e; ++i) {
if (Sections[i].getAddress() == LocalAddress) {
reassignSectionAddress(i, TargetAddress);
@@ -177,7 +177,7 @@ static Error getOffset(const SymbolRef &Sym, SectionRef Sec,
Expected<RuntimeDyldImpl::ObjSectionToIDMap>
RuntimeDyldImpl::loadObjectImpl(const object::ObjectFile &Obj) {
- MutexGuard locked(lock);
+ std::lock_guard<sys::Mutex> locked(lock);
// Save information about our target
Arch = (Triple::ArchType)Obj.getArch();
OpenPOWER on IntegriCloud