}
void ExecutionEngine::addGlobalMapping(const GlobalValue *GV, void *Addr) {
- std::lock_guard<std::recursive_mutex> locked(lock);
+ MutexGuard locked(lock);
DEBUG(dbgs() << "JIT: Map \'" << GV->getName()
<< "\' to [" << Addr << "]\n";);
}
void ExecutionEngine::clearAllGlobalMappings() {
- std::lock_guard<std::recursive_mutex> locked(lock);
+ MutexGuard locked(lock);
EEState.getGlobalAddressMap().clear();
EEState.getGlobalAddressReverseMap().clear();
}
void ExecutionEngine::clearGlobalMappingsFromModule(Module *M) {
- std::lock_guard<std::recursive_mutex> locked(lock);
+ MutexGuard locked(lock);
for (Module::iterator FI = M->begin(), FE = M->end(); FI != FE; ++FI)
EEState.RemoveMapping(FI);
}
void *ExecutionEngine::updateGlobalMapping(const GlobalValue *GV, void *Addr) {
- std::lock_guard<std::recursive_mutex> locked(lock);
+ MutexGuard locked(lock);
ExecutionEngineState::GlobalAddressMapTy &Map =
EEState.getGlobalAddressMap();
}
void *ExecutionEngine::getPointerToGlobalIfAvailable(const GlobalValue *GV) {
- std::lock_guard<std::recursive_mutex> locked(lock);
+ MutexGuard locked(lock);
ExecutionEngineState::GlobalAddressMapTy::iterator I =
EEState.getGlobalAddressMap().find(GV);
}
const GlobalValue *ExecutionEngine::getGlobalValueAtAddress(void *Addr) {
- std::lock_guard<std::recursive_mutex> locked(lock);
+ MutexGuard locked(lock);
// If we haven't computed the reverse mapping yet, do so first.
if (EEState.getGlobalAddressReverseMap().empty()) {
std::string *ErrorStr,
CodeGenOpt::Level OptLevel,
bool GVsWithCode) {
- EngineBuilder EB = EngineBuilder(M)
- .setEngineKind(ForceInterpreter
- ? EngineKind::Interpreter
- : EngineKind::JIT)
- .setErrorStr(ErrorStr)
- .setOptLevel(OptLevel)
- .setAllocateGVsWithCode(GVsWithCode);
+
+ EngineBuilder EB =
+ EngineBuilder(M)
+ .setEngineKind(ForceInterpreter ? EngineKind::Interpreter
+ : EngineKind::Either)
+ .setErrorStr(ErrorStr)
+ .setOptLevel(OptLevel)
+ .setAllocateGVsWithCode(GVsWithCode);
return EB.create();
}
if (Function *F = const_cast<Function*>(dyn_cast<Function>(GV)))
return getPointerToFunction(F);
- std::lock_guard<std::recursive_mutex> locked(lock);
+ MutexGuard locked(lock);
if (void *P = EEState.getGlobalAddressMap()[GV])
return P;
: EE(EE), GlobalAddressMap(this) {
}
-std::recursive_mutex *
+sys::Mutex *
ExecutionEngineState::AddressMapConfig::getMutex(ExecutionEngineState *EES) {
return &EES->EE.lock;
}