aboutsummaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/MCJIT/MCJIT.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ExecutionEngine/MCJIT/MCJIT.cpp')
-rw-r--r--lib/ExecutionEngine/MCJIT/MCJIT.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/lib/ExecutionEngine/MCJIT/MCJIT.cpp
index 08815b7a80ae..94741f5f01d5 100644
--- a/lib/ExecutionEngine/MCJIT/MCJIT.cpp
+++ b/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);
}