public:
LinkingResolver(OrcMCJITReplacement &M) : M(M) {}
- RuntimeDyld::SymbolInfo findSymbol(const std::string &Name) {
+ RuntimeDyld::SymbolInfo findSymbol(const std::string &Name) override {
return M.findMangledSymbol(Name);
}
- RuntimeDyld::SymbolInfo findSymbolInLogicalDylib(const std::string &Name) {
+ RuntimeDyld::SymbolInfo
+ findSymbolInLogicalDylib(const std::string &Name) override {
return M.ClientResolver->findSymbolInLogicalDylib(Name);
}
}
OrcMCJITReplacement(
- std::shared_ptr<MCJITMemoryManager> MemMgr,
- std::shared_ptr<RuntimeDyld::SymbolResolver> ClientResolver,
- std::unique_ptr<TargetMachine> TM)
- : TM(std::move(TM)), MemMgr(*this, std::move(MemMgr)),
- Resolver(*this), ClientResolver(std::move(ClientResolver)),
- Mang(this->TM->getDataLayout()),
- NotifyObjectLoaded(*this), NotifyFinalized(*this),
+ std::shared_ptr<MCJITMemoryManager> MemMgr,
+ std::shared_ptr<RuntimeDyld::SymbolResolver> ClientResolver,
+ std::unique_ptr<TargetMachine> TM)
+ : ExecutionEngine(*TM->getDataLayout()), TM(std::move(TM)),
+ MemMgr(*this, std::move(MemMgr)), Resolver(*this),
+ ClientResolver(std::move(ClientResolver)), NotifyObjectLoaded(*this),
+ NotifyFinalized(*this),
ObjectLayer(NotifyObjectLoaded, NotifyFinalized),
CompileLayer(ObjectLayer, SimpleCompiler(*this->TM)),
- LazyEmitLayer(CompileLayer) {
- setDataLayout(this->TM->getDataLayout());
- }
+ LazyEmitLayer(CompileLayer) {}
void addModule(std::unique_ptr<Module> M) override {
// If this module doesn't have a DataLayout attached then attach the
// default.
- if (M->getDataLayout().isDefault())
- M->setDataLayout(*getDataLayout());
-
+ if (M->getDataLayout().isDefault()) {
+ M->setDataLayout(getDataLayout());
+ } else {
+ assert(M->getDataLayout() == getDataLayout() && "DataLayout Mismatch");
+ }
Modules.push_back(std::move(M));
std::vector<Module *> Ms;
Ms.push_back(&*Modules.back());
}
GenericValue runFunction(Function *F,
- const std::vector<GenericValue> &ArgValues) override;
+ ArrayRef<GenericValue> ArgValues) override;
void setObjectCache(ObjectCache *NewCache) override {
CompileLayer.setObjectCache(NewCache);
"Incorrect number of Infos for Objects.");
for (unsigned I = 0; I < Objects.size(); ++I)
M.MemMgr.notifyObjectLoaded(&M, *Objects[I]);
- };
+ }
private:
OrcMCJITReplacement &M;
std::string MangledName;
{
raw_string_ostream MangledNameStream(MangledName);
- Mang.getNameWithPrefix(MangledNameStream, Name);
+ Mang.getNameWithPrefix(MangledNameStream, Name, getDataLayout());
}
return MangledName;
}