summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp17
-rw-r--r--llvm/lib/ExecutionEngine/Orc/Core.cpp308
-rw-r--r--llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp15
-rw-r--r--llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp6
-rw-r--r--llvm/lib/ExecutionEngine/Orc/LLJIT.cpp16
-rw-r--r--llvm/lib/ExecutionEngine/Orc/Layer.cpp13
-rw-r--r--llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp22
7 files changed, 204 insertions, 193 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp b/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
index d42e7b05ba6..b731814293f 100644
--- a/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
@@ -202,7 +202,7 @@ private:
std::move(ExtractedFunctionsModule));
}
- void discard(const VSO &V, SymbolStringPtr Name) override {
+ void discard(const JITDylib &V, SymbolStringPtr Name) override {
// All original symbols were materialized by the CODLayer and should be
// final. The function bodies provided by M should never be overridden.
llvm_unreachable("Discard should never be called on an "
@@ -221,7 +221,7 @@ CompileOnDemandLayer2::CompileOnDemandLayer2(
BuildIndirectStubsManager(std::move(BuildIndirectStubsManager)),
GetAvailableContext(std::move(GetAvailableContext)) {}
-Error CompileOnDemandLayer2::add(VSO &V, VModuleKey K,
+Error CompileOnDemandLayer2::add(JITDylib &V, VModuleKey K,
std::unique_ptr<Module> M) {
return IRLayer::add(V, K, std::move(M));
}
@@ -245,7 +245,7 @@ void CompileOnDemandLayer2::emit(MaterializationResponsibility R, VModuleKey K,
// rest, and build the compile callbacks.
std::map<SymbolStringPtr, std::pair<JITTargetAddress, JITSymbolFlags>>
StubCallbacksAndLinkages;
- auto &TargetVSO = R.getTargetVSO();
+ auto &TargetJD = R.getTargetJITDylib();
for (auto &F : M->functions()) {
if (F.isDeclaration())
@@ -269,8 +269,8 @@ void CompileOnDemandLayer2::emit(MaterializationResponsibility R, VModuleKey K,
auto StubName = Mangle(StubUnmangledName);
auto BodyName = Mangle(F.getName());
if (auto CallbackAddr = CCMgr.getCompileCallback(
- [BodyName, &TargetVSO, &ES]() -> JITTargetAddress {
- if (auto Sym = lookup({&TargetVSO}, BodyName))
+ [BodyName, &TargetJD, &ES]() -> JITTargetAddress {
+ if (auto Sym = lookup({&TargetJD}, BodyName))
return Sym->getAddress();
else {
ES.reportError(Sym.takeError());
@@ -294,7 +294,7 @@ void CompileOnDemandLayer2::emit(MaterializationResponsibility R, VModuleKey K,
StubInits[*KV.first] = KV.second;
// Build the function-body-extracting materialization unit.
- if (auto Err = R.getTargetVSO().define(
+ if (auto Err = R.getTargetJITDylib().define(
llvm::make_unique<ExtractingIRMaterializationUnit>(ES, *this,
std::move(M)))) {
ES.reportError(std::move(Err));
@@ -304,7 +304,7 @@ void CompileOnDemandLayer2::emit(MaterializationResponsibility R, VModuleKey K,
// Build the stubs.
// FIXME: Remove function bodies materialization unit if stub creation fails.
- auto &StubsMgr = getStubsManager(TargetVSO);
+ auto &StubsMgr = getStubsManager(TargetJD);
if (auto Err = StubsMgr.createStubs(StubInits)) {
ES.reportError(std::move(Err));
R.failMaterialization();
@@ -325,7 +325,8 @@ void CompileOnDemandLayer2::emit(MaterializationResponsibility R, VModuleKey K,
BaseLayer.emit(std::move(R), std::move(K), std::move(GlobalsModule));
}
-IndirectStubsManager &CompileOnDemandLayer2::getStubsManager(const VSO &V) {
+IndirectStubsManager &
+CompileOnDemandLayer2::getStubsManager(const JITDylib &V) {
std::lock_guard<std::mutex> Lock(CODLayerMutex);
StubManagersMap::iterator I = StubsMgrs.find(&V);
if (I == StubsMgrs.end())
diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp
index 00f4b91cdef..b610878b7cf 100644
--- a/llvm/lib/ExecutionEngine/Orc/Core.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp
@@ -1,4 +1,4 @@
-//===----- Core.cpp - Core ORC APIs (MaterializationUnit, VSO, etc.) ------===//
+//===--- Core.cpp - Core ORC APIs (MaterializationUnit, JITDylib, etc.) ---===//
//
// The LLVM Compiler Infrastructure
//
@@ -102,14 +102,14 @@ raw_ostream &operator<<(raw_ostream &OS, const SymbolDependenceMap &Deps) {
return OS;
}
-raw_ostream &operator<<(raw_ostream &OS, const VSOList &VSOs) {
+raw_ostream &operator<<(raw_ostream &OS, const JITDylibList &JDs) {
OS << "[";
- if (!VSOs.empty()) {
- assert(VSOs.front() && "VSOList entries must not be null");
- OS << " " << VSOs.front()->getName();
- for (auto *V : make_range(std::next(VSOs.begin()), VSOs.end())) {
- assert(V && "VSOList entries must not be null");
- OS << ", " << V->getName();
+ if (!JDs.empty()) {
+ assert(JDs.front() && "JITDylibList entries must not be null");
+ OS << " " << JDs.front()->getName();
+ for (auto *JD : make_range(std::next(JDs.begin()), JDs.end())) {
+ assert(JD && "JITDylibList entries must not be null");
+ OS << ", " << JD->getName();
}
}
OS << " ]";
@@ -291,7 +291,7 @@ Expected<SymbolMap> ExecutionSessionBase::legacyLookup(
}
void ExecutionSessionBase::lookup(
- const VSOList &VSOs, const SymbolNameSet &Symbols,
+ const JITDylibList &JDs, const SymbolNameSet &Symbols,
SymbolsResolvedCallback OnResolve, SymbolsReadyCallback OnReady,
RegisterDependenciesFunction RegisterDependencies) {
@@ -301,7 +301,7 @@ void ExecutionSessionBase::lookup(
runOutstandingMUs();
auto Unresolved = std::move(Symbols);
- std::map<VSO *, MaterializationUnitList> MUsMap;
+ std::map<JITDylib *, MaterializationUnitList> MUsMap;
auto Q = std::make_shared<AsynchronousSymbolQuery>(
Symbols, std::move(OnResolve), std::move(OnReady));
bool QueryIsFullyResolved = false;
@@ -309,11 +309,11 @@ void ExecutionSessionBase::lookup(
bool QueryFailed = false;
runSessionLocked([&]() {
- for (auto *V : VSOs) {
- assert(V && "VSOList entries must not be null");
- assert(!MUsMap.count(V) &&
- "VSOList should not contain duplicate entries");
- V->lodgeQuery(Q, Unresolved, MUsMap[V]);
+ for (auto *JD : JDs) {
+ assert(JD && "JITDylibList entries must not be null");
+ assert(!MUsMap.count(JD) &&
+ "JITDylibList should not contain duplicate entries");
+ JD->lodgeQuery(Q, Unresolved, MUsMap[JD]);
}
if (Unresolved.empty()) {
@@ -364,10 +364,9 @@ void ExecutionSessionBase::lookup(
runOutstandingMUs();
}
-Expected<SymbolMap>
-ExecutionSessionBase::lookup(const VSOList &VSOs, const SymbolNameSet &Symbols,
- RegisterDependenciesFunction RegisterDependencies,
- bool WaitUntilReady) {
+Expected<SymbolMap> ExecutionSessionBase::lookup(
+ const JITDylibList &JDs, const SymbolNameSet &Symbols,
+ RegisterDependenciesFunction RegisterDependencies, bool WaitUntilReady) {
#if LLVM_ENABLE_THREADS
// In the threaded case we use promises to return the results.
std::promise<SymbolMap> PromisedResult;
@@ -434,7 +433,7 @@ ExecutionSessionBase::lookup(const VSOList &VSOs, const SymbolNameSet &Symbols,
#endif
// Perform the asynchronous lookup.
- lookup(VSOs, Symbols, OnResolve, OnReady, RegisterDependencies);
+ lookup(JDs, Symbols, OnResolve, OnReady, RegisterDependencies);
#if LLVM_ENABLE_THREADS
auto ResultFuture = PromisedResult.get_future();
@@ -479,19 +478,20 @@ ExecutionSessionBase::lookup(const VSOList &VSOs, const SymbolNameSet &Symbols,
void ExecutionSessionBase::runOutstandingMUs() {
while (1) {
- std::pair<VSO *, std::unique_ptr<MaterializationUnit>> VSOAndMU;
+ std::pair<JITDylib *, std::unique_ptr<MaterializationUnit>> JITDylibAndMU;
{
std::lock_guard<std::recursive_mutex> Lock(OutstandingMUsMutex);
if (!OutstandingMUs.empty()) {
- VSOAndMU = std::move(OutstandingMUs.back());
+ JITDylibAndMU = std::move(OutstandingMUs.back());
OutstandingMUs.pop_back();
}
}
- if (VSOAndMU.first) {
- assert(VSOAndMU.second && "VSO, but no MU?");
- dispatchMaterialization(*VSOAndMU.first, std::move(VSOAndMU.second));
+ if (JITDylibAndMU.first) {
+ assert(JITDylibAndMU.second && "JITDylib, but no MU?");
+ dispatchMaterialization(*JITDylibAndMU.first,
+ std::move(JITDylibAndMU.second));
} else
break;
}
@@ -557,17 +557,19 @@ void AsynchronousSymbolQuery::handleFailed(Error Err) {
NotifySymbolsReady = SymbolsReadyCallback();
}
-void AsynchronousSymbolQuery::addQueryDependence(VSO &V, SymbolStringPtr Name) {
- bool Added = QueryRegistrations[&V].insert(std::move(Name)).second;
+void AsynchronousSymbolQuery::addQueryDependence(JITDylib &JD,
+ SymbolStringPtr Name) {
+ bool Added = QueryRegistrations[&JD].insert(std::move(Name)).second;
(void)Added;
assert(Added && "Duplicate dependence notification?");
}
void AsynchronousSymbolQuery::removeQueryDependence(
- VSO &V, const SymbolStringPtr &Name) {
- auto QRI = QueryRegistrations.find(&V);
- assert(QRI != QueryRegistrations.end() && "No dependencies registered for V");
- assert(QRI->second.count(Name) && "No dependency on Name in V");
+ JITDylib &JD, const SymbolStringPtr &Name) {
+ auto QRI = QueryRegistrations.find(&JD);
+ assert(QRI != QueryRegistrations.end() &&
+ "No dependencies registered for JD");
+ assert(QRI->second.count(Name) && "No dependency on Name in JD");
QRI->second.erase(Name);
if (QRI->second.empty())
QueryRegistrations.erase(QRI);
@@ -583,8 +585,8 @@ void AsynchronousSymbolQuery::detach() {
}
MaterializationResponsibility::MaterializationResponsibility(
- VSO &V, SymbolFlagsMap SymbolFlags)
- : V(V), SymbolFlags(std::move(SymbolFlags)) {
+ JITDylib &JD, SymbolFlagsMap SymbolFlags)
+ : JD(JD), SymbolFlags(std::move(SymbolFlags)) {
assert(!this->SymbolFlags.empty() && "Materializing nothing?");
#ifndef NDEBUG
@@ -599,7 +601,7 @@ MaterializationResponsibility::~MaterializationResponsibility() {
}
SymbolNameSet MaterializationResponsibility::getRequestedSymbols() {
- return V.getRequestedSymbols(SymbolFlags);
+ return JD.getRequestedSymbols(SymbolFlags);
}
void MaterializationResponsibility::resolve(const SymbolMap &Symbols) {
@@ -619,7 +621,7 @@ void MaterializationResponsibility::resolve(const SymbolMap &Symbols) {
}
#endif
- V.resolve(Symbols);
+ JD.resolve(Symbols);
}
void MaterializationResponsibility::finalize() {
@@ -629,7 +631,7 @@ void MaterializationResponsibility::finalize() {
"Failed to resolve symbol before finalization");
#endif // NDEBUG
- V.finalize(SymbolFlags);
+ JD.finalize(SymbolFlags);
SymbolFlags.clear();
}
@@ -637,8 +639,8 @@ Error MaterializationResponsibility::defineMaterializing(
const SymbolFlagsMap &NewSymbolFlags) {
// Add the given symbols to this responsibility object.
// It's ok if we hit a duplicate here: In that case the new version will be
- // discarded, and the VSO::defineMaterializing method will return a duplicate
- // symbol error.
+ // discarded, and the JITDylib::defineMaterializing method will return a
+ // duplicate symbol error.
for (auto &KV : NewSymbolFlags) {
auto I = SymbolFlags.insert(KV).first;
(void)I;
@@ -647,7 +649,7 @@ Error MaterializationResponsibility::defineMaterializing(
#endif
}
- return V.defineMaterializing(NewSymbolFlags);
+ return JD.defineMaterializing(NewSymbolFlags);
}
void MaterializationResponsibility::failMaterialization() {
@@ -656,7 +658,7 @@ void MaterializationResponsibility::failMaterialization() {
for (auto &KV : SymbolFlags)
FailedSymbols.insert(KV.first);
- V.notifyFailed(FailedSymbols);
+ JD.notifyFailed(FailedSymbols);
SymbolFlags.clear();
}
@@ -665,7 +667,7 @@ void MaterializationResponsibility::replace(
for (auto &KV : MU->getSymbols())
SymbolFlags.erase(KV.first);
- V.replace(std::move(MU));
+ JD.replace(std::move(MU));
}
MaterializationResponsibility
@@ -682,20 +684,20 @@ MaterializationResponsibility::delegate(const SymbolNameSet &Symbols) {
SymbolFlags.erase(I);
}
- return MaterializationResponsibility(V, std::move(DelegatedFlags));
+ return MaterializationResponsibility(JD, std::move(DelegatedFlags));
}
void MaterializationResponsibility::addDependencies(
const SymbolStringPtr &Name, const SymbolDependenceMap &Dependencies) {
assert(SymbolFlags.count(Name) &&
"Symbol not covered by this MaterializationResponsibility instance");
- V.addDependencies(Name, Dependencies);
+ JD.addDependencies(Name, Dependencies);
}
void MaterializationResponsibility::addDependenciesForAll(
const SymbolDependenceMap &Dependencies) {
for (auto &KV : SymbolFlags)
- V.addDependencies(KV.first, Dependencies);
+ JD.addDependencies(KV.first, Dependencies);
}
AbsoluteSymbolsMaterializationUnit::AbsoluteSymbolsMaterializationUnit(
@@ -708,7 +710,7 @@ void AbsoluteSymbolsMaterializationUnit::materialize(
R.finalize();
}
-void AbsoluteSymbolsMaterializationUnit::discard(const VSO &V,
+void AbsoluteSymbolsMaterializationUnit::discard(const JITDylib &JD,
SymbolStringPtr Name) {
assert(Symbols.count(Name) && "Symbol is not part of this MU");
Symbols.erase(Name);
@@ -723,19 +725,20 @@ AbsoluteSymbolsMaterializationUnit::extractFlags(const SymbolMap &Symbols) {
}
ReExportsMaterializationUnit::ReExportsMaterializationUnit(
- VSO *SourceVSO, SymbolAliasMap Aliases)
- : MaterializationUnit(extractFlags(Aliases)), SourceVSO(SourceVSO),
+ JITDylib *SourceJD, SymbolAliasMap Aliases)
+ : MaterializationUnit(extractFlags(Aliases)), SourceJD(SourceJD),
Aliases(std::move(Aliases)) {}
void ReExportsMaterializationUnit::materialize(
MaterializationResponsibility R) {
- auto &ES = R.getTargetVSO().getExecutionSession();
- VSO &TgtV = R.getTargetVSO();
- VSO &SrcV = SourceVSO ? *SourceVSO : TgtV;
+ auto &ES = R.getTargetJITDylib().getExecutionSession();
+ JITDylib &TgtJD = R.getTargetJITDylib();
+ JITDylib &SrcJD = SourceJD ? *SourceJD : TgtJD;
// Find the set of requested aliases and aliasees. Return any unrequested
- // aliases back to the VSO so as to not prematurely materialize any aliasees.
+ // aliases back to the JITDylib so as to not prematurely materialize any
+ // aliasees.
auto RequestedSymbols = R.getRequestedSymbols();
SymbolAliasMap RequestedAliases;
@@ -747,8 +750,8 @@ void ReExportsMaterializationUnit::materialize(
}
if (!Aliases.empty()) {
- if (SourceVSO)
- R.replace(reexports(*SourceVSO, std::move(Aliases)));
+ if (SourceJD)
+ R.replace(reexports(*SourceJD, std::move(Aliases)));
else
R.replace(symbolAliases(std::move(Aliases)));
}
@@ -781,8 +784,8 @@ void ReExportsMaterializationUnit::materialize(
auto Tmp = I++;
// Chain detected. Skip this symbol for this round.
- if (&SrcV == &TgtV && (QueryAliases.count(Tmp->second.Aliasee) ||
- RequestedAliases.count(Tmp->second.Aliasee)))
+ if (&SrcJD == &TgtJD && (QueryAliases.count(Tmp->second.Aliasee) ||
+ RequestedAliases.count(Tmp->second.Aliasee)))
continue;
ResponsibilitySymbols.insert(Tmp->first);
@@ -806,21 +809,21 @@ void ReExportsMaterializationUnit::materialize(
QueryInfos.pop_back();
auto RegisterDependencies = [QueryInfo,
- &SrcV](const SymbolDependenceMap &Deps) {
+ &SrcJD](const SymbolDependenceMap &Deps) {
// If there were no materializing symbols, just bail out.
if (Deps.empty())
return;
- // Otherwise the only deps should be on SrcV.
- assert(Deps.size() == 1 && Deps.count(&SrcV) &&
+ // Otherwise the only deps should be on SrcJD.
+ assert(Deps.size() == 1 && Deps.count(&SrcJD) &&
"Unexpected dependencies for reexports");
- auto &SrcVDeps = Deps.find(&SrcV)->second;
+ auto &SrcJDDeps = Deps.find(&SrcJD)->second;
SymbolDependenceMap PerAliasDepsMap;
- auto &PerAliasDeps = PerAliasDepsMap[&SrcV];
+ auto &PerAliasDeps = PerAliasDepsMap[&SrcJD];
for (auto &KV : QueryInfo->Aliases)
- if (SrcVDeps.count(KV.second.Aliasee)) {
+ if (SrcJDDeps.count(KV.second.Aliasee)) {
PerAliasDeps = {KV.second.Aliasee};
QueryInfo->R.addDependencies(KV.first, PerAliasDepsMap);
}
@@ -838,7 +841,7 @@ void ReExportsMaterializationUnit::materialize(
QueryInfo->R.resolve(ResolutionMap);
QueryInfo->R.finalize();
} else {
- auto &ES = QueryInfo->R.getTargetVSO().getExecutionSession();
+ auto &ES = QueryInfo->R.getTargetJITDylib().getExecutionSession();
ES.reportError(Result.takeError());
QueryInfo->R.failMaterialization();
}
@@ -846,12 +849,13 @@ void ReExportsMaterializationUnit::materialize(
auto OnReady = [&ES](Error Err) { ES.reportError(std::move(Err)); };
- ES.lookup({&SrcV}, QuerySymbols, std::move(OnResolve), std::move(OnReady),
+ ES.lookup({&SrcJD}, QuerySymbols, std::move(OnResolve), std::move(OnReady),
std::move(RegisterDependencies));
}
}
-void ReExportsMaterializationUnit::discard(const VSO &V, SymbolStringPtr Name) {
+void ReExportsMaterializationUnit::discard(const JITDylib &JD,
+ SymbolStringPtr Name) {
assert(Aliases.count(Name) &&
"Symbol not covered by this MaterializationUnit");
Aliases.erase(Name);
@@ -867,8 +871,8 @@ ReExportsMaterializationUnit::extractFlags(const SymbolAliasMap &Aliases) {
}
Expected<SymbolAliasMap>
-buildSimpleReexportsAliasMap(VSO &SourceV, const SymbolNameSet &Symbols) {
- auto Flags = SourceV.lookupFlags(Symbols);
+buildSimpleReexportsAliasMap(JITDylib &SourceJD, const SymbolNameSet &Symbols) {
+ auto Flags = SourceJD.lookupFlags(Symbols);
if (Flags.size() != Symbols.size()) {
SymbolNameSet Unresolved = Symbols;
@@ -887,15 +891,15 @@ buildSimpleReexportsAliasMap(VSO &SourceV, const SymbolNameSet &Symbols) {
}
ReexportsFallbackDefinitionGenerator::ReexportsFallbackDefinitionGenerator(
- VSO &BackingVSO, SymbolPredicate Allow)
- : BackingVSO(BackingVSO), Allow(std::move(Allow)) {}
+ JITDylib &BackingJD, SymbolPredicate Allow)
+ : BackingJD(BackingJD), Allow(std::move(Allow)) {}
SymbolNameSet ReexportsFallbackDefinitionGenerator::
-operator()(VSO &V, const SymbolNameSet &Names) {
+operator()(JITDylib &JD, const SymbolNameSet &Names) {
orc::SymbolNameSet Added;
orc::SymbolAliasMap AliasMap;
- auto Flags = BackingVSO.lookupFlags(Names);
+ auto Flags = BackingJD.lookupFlags(Names);
for (auto &KV : Flags) {
if (!Allow(KV.first))
@@ -905,12 +909,12 @@ operator()(VSO &V, const SymbolNameSet &Names) {
}
if (!Added.empty())
- cantFail(V.define(reexports(BackingVSO, AliasMap)));
+ cantFail(JD.define(reexports(BackingJD, AliasMap)));
return Added;
}
-Error VSO::defineMaterializing(const SymbolFlagsMap &SymbolFlags) {
+Error JITDylib::defineMaterializing(const SymbolFlagsMap &SymbolFlags) {
return ES.runSessionLocked([&]() -> Error {
std::vector<SymbolMap::iterator> AddedSyms;
@@ -940,7 +944,7 @@ Error VSO::defineMaterializing(const SymbolFlagsMap &SymbolFlags) {
});
}
-void VSO::replace(std::unique_ptr<MaterializationUnit> MU) {
+void JITDylib::replace(std::unique_ptr<MaterializationUnit> MU) {
assert(MU != nullptr && "Can not replace with a null MaterializationUnit");
auto MustRunMU =
@@ -991,12 +995,12 @@ void VSO::replace(std::unique_ptr<MaterializationUnit> MU) {
ES.dispatchMaterialization(*this, std::move(MustRunMU));
}
-SymbolNameSet VSO::getRequestedSymbols(const SymbolFlagsMap &SymbolFlags) {
+SymbolNameSet JITDylib::getRequestedSymbols(const SymbolFlagsMap &SymbolFlags) {
return ES.runSessionLocked([&]() {
SymbolNameSet RequestedSymbols;
for (auto &KV : SymbolFlags) {
- assert(Symbols.count(KV.first) && "VSO does not cover this symbol?");
+ assert(Symbols.count(KV.first) && "JITDylib does not cover this symbol?");
assert(Symbols[KV.first].getFlags().isMaterializing() &&
"getRequestedSymbols can only be called for materializing "
"symbols");
@@ -1012,8 +1016,8 @@ SymbolNameSet VSO::getRequestedSymbols(const SymbolFlagsMap &SymbolFlags) {
});
}
-void VSO::addDependencies(const SymbolStringPtr &Name,
- const SymbolDependenceMap &Dependencies) {
+void JITDylib::addDependencies(const SymbolStringPtr &Name,
+ const SymbolDependenceMap &Dependencies) {
assert(Symbols.count(Name) && "Name not in symbol table");
assert((Symbols[Name].getFlags().isLazy() ||
Symbols[Name].getFlags().isMaterializing()) &&
@@ -1023,36 +1027,36 @@ void VSO::addDependencies(const SymbolStringPtr &Name,
assert(!MI.IsFinalized && "Can not add dependencies to finalized symbol");
for (auto &KV : Dependencies) {
- assert(KV.first && "Null VSO in dependency?");
- auto &OtherVSO = *KV.first;
- auto &DepsOnOtherVSO = MI.UnfinalizedDependencies[&OtherVSO];
+ assert(KV.first && "Null JITDylib in dependency?");
+ auto &OtherJITDylib = *KV.first;
+ auto &DepsOnOtherJITDylib = MI.UnfinalizedDependencies[&OtherJITDylib];
for (auto &OtherSymbol : KV.second) {
#ifndef NDEBUG
// Assert that this symbol exists and has not been finalized already.
- auto SymI = OtherVSO.Symbols.find(OtherSymbol);
- assert(SymI != OtherVSO.Symbols.end() &&
+ auto SymI = OtherJITDylib.Symbols.find(OtherSymbol);
+ assert(SymI != OtherJITDylib.Symbols.end() &&
(SymI->second.getFlags().isLazy() ||
SymI->second.getFlags().isMaterializing()) &&
"Dependency on finalized symbol");
#endif
- auto &OtherMI = OtherVSO.MaterializingInfos[OtherSymbol];
+ auto &OtherMI = OtherJITDylib.MaterializingInfos[OtherSymbol];
if (OtherMI.IsFinalized)
transferFinalizedNodeDependencies(MI, Name, OtherMI);
- else if (&OtherVSO != this || OtherSymbol != Name) {
+ else if (&OtherJITDylib != this || OtherSymbol != Name) {
OtherMI.Dependants[this].insert(Name);
- DepsOnOtherVSO.insert(OtherSymbol);
+ DepsOnOtherJITDylib.insert(OtherSymbol);
}
}
- if (DepsOnOtherVSO.empty())
- MI.UnfinalizedDependencies.erase(&OtherVSO);
+ if (DepsOnOtherJITDylib.empty())
+ MI.UnfinalizedDependencies.erase(&OtherJITDylib);
}
}
-void VSO::resolve(const SymbolMap &Resolved) {
+void JITDylib::resolve(const SymbolMap &Resolved) {
auto FullyResolvedQueries = ES.runSessionLocked([&, this]() {
AsynchronousSymbolQuerySet FullyResolvedQueries;
for (const auto &KV : Resolved) {
@@ -1098,7 +1102,7 @@ void VSO::resolve(const SymbolMap &Resolved) {
}
}
-void VSO::finalize(const SymbolFlagsMap &Finalized) {
+void JITDylib::finalize(const SymbolFlagsMap &Finalized) {
auto FullyReadyQueries = ES.runSessionLocked([&, this]() {
AsynchronousSymbolQuerySet ReadyQueries;
@@ -1115,11 +1119,11 @@ void VSO::finalize(const SymbolFlagsMap &Finalized) {
// it. If the dependant node is fully finalized then notify any pending
// queries.
for (auto &KV : MI.Dependants) {
- auto &DependantVSO = *KV.first;
+ auto &DependantJD = *KV.first;
for (auto &DependantName : KV.second) {
auto DependantMII =
- DependantVSO.MaterializingInfos.find(DependantName);
- assert(DependantMII != DependantVSO.MaterializingInfos.end() &&
+ DependantJD.MaterializingInfos.find(DependantName);
+ assert(DependantMII != DependantJD.MaterializingInfos.end() &&
"Dependant should have MaterializingInfo");
auto &DependantMI = DependantMII->second;
@@ -1132,8 +1136,8 @@ void VSO::finalize(const SymbolFlagsMap &Finalized) {
DependantMI.UnfinalizedDependencies.erase(this);
// Transfer unfinalized dependencies from this node to the dependant.
- DependantVSO.transferFinalizedNodeDependencies(DependantMI,
- DependantName, MI);
+ DependantJD.transferFinalizedNodeDependencies(DependantMI,
+ DependantName, MI);
// If the dependant is finalized and this node was the last of its
// unfinalized dependencies then notify any pending queries on the
@@ -1146,17 +1150,17 @@ void VSO::finalize(const SymbolFlagsMap &Finalized) {
Q->notifySymbolReady();
if (Q->isFullyReady())
ReadyQueries.insert(Q);
- Q->removeQueryDependence(DependantVSO, DependantName);
+ Q->removeQueryDependence(DependantJD, DependantName);
}
// If this dependant node was fully finalized we can erase its
// MaterializingInfo and update its materializing state.
- assert(DependantVSO.Symbols.count(DependantName) &&
+ assert(DependantJD.Symbols.count(DependantName) &&
"Dependant has no entry in the Symbols table");
- auto &DependantSym = DependantVSO.Symbols[DependantName];
+ auto &DependantSym = DependantJD.Symbols[DependantName];
DependantSym.setFlags(static_cast<JITSymbolFlags::FlagNames>(
DependantSym.getFlags() & ~JITSymbolFlags::Materializing));
- DependantVSO.MaterializingInfos.erase(DependantMII);
+ DependantJD.MaterializingInfos.erase(DependantMII);
}
}
}
@@ -1188,7 +1192,7 @@ void VSO::finalize(const SymbolFlagsMap &Finalized) {
}
}
-void VSO::notifyFailed(const SymbolNameSet &FailedSymbols) {
+void JITDylib::notifyFailed(const SymbolNameSet &FailedSymbols) {
// FIXME: This should fail any transitively dependant symbols too.
@@ -1197,7 +1201,7 @@ void VSO::notifyFailed(const SymbolNameSet &FailedSymbols) {
for (auto &Name : FailedSymbols) {
auto I = Symbols.find(Name);
- assert(I != Symbols.end() && "Symbol not present in this VSO");
+ assert(I != Symbols.end() && "Symbol not present in this JITDylib");
Symbols.erase(I);
auto MII = MaterializingInfos.find(Name);
@@ -1230,35 +1234,36 @@ void VSO::notifyFailed(const SymbolNameSet &FailedSymbols) {
Q->handleFailed(make_error<FailedToMaterialize>(FailedSymbols));
}
-void VSO::setSearchOrder(VSOList NewSearchOrder, bool SearchThisVSOFirst) {
- if (SearchThisVSOFirst && NewSearchOrder.front() != this)
+void JITDylib::setSearchOrder(JITDylibList NewSearchOrder,
+ bool SearchThisJITDylibFirst) {
+ if (SearchThisJITDylibFirst && NewSearchOrder.front() != this)
NewSearchOrder.insert(NewSearchOrder.begin(), this);
ES.runSessionLocked([&]() { SearchOrder = std::move(NewSearchOrder); });
}
-void VSO::addToSearchOrder(VSO &V) {
- ES.runSessionLocked([&]() { SearchOrder.push_back(&V); });
+void JITDylib::addToSearchOrder(JITDylib &JD) {
+ ES.runSessionLocked([&]() { SearchOrder.push_back(&JD); });
}
-void VSO::replaceInSearchOrder(VSO &OldV, VSO &NewV) {
+void JITDylib::replaceInSearchOrder(JITDylib &OldJD, JITDylib &NewJD) {
ES.runSessionLocked([&]() {
- auto I = std::find(SearchOrder.begin(), SearchOrder.end(), &OldV);
+ auto I = std::find(SearchOrder.begin(), SearchOrder.end(), &OldJD);
if (I != SearchOrder.end())
- *I = &NewV;
+ *I = &NewJD;
});
}
-void VSO::removeFromSearchOrder(VSO &V) {
+void JITDylib::removeFromSearchOrder(JITDylib &JD) {
ES.runSessionLocked([&]() {
- auto I = std::find(SearchOrder.begin(), SearchOrder.end(), &V);
+ auto I = std::find(SearchOrder.begin(), SearchOrder.end(), &JD);
if (I != SearchOrder.end())
SearchOrder.erase(I);
});
}
-SymbolFlagsMap VSO::lookupFlags(const SymbolNameSet &Names) {
+SymbolFlagsMap JITDylib::lookupFlags(const SymbolNameSet &Names) {
return ES.runSessionLocked([&, this]() {
SymbolFlagsMap Result;
auto Unresolved = lookupFlagsImpl(Result, Names);
@@ -1275,8 +1280,8 @@ SymbolFlagsMap VSO::lookupFlags(const SymbolNameSet &Names) {
});
}
-SymbolNameSet VSO::lookupFlagsImpl(SymbolFlagsMap &Flags,
- const SymbolNameSet &Names) {
+SymbolNameSet JITDylib::lookupFlagsImpl(SymbolFlagsMap &Flags,
+ const SymbolNameSet &Names) {
SymbolNameSet Unresolved;
for (auto &Name : Names) {
@@ -1294,8 +1299,9 @@ SymbolNameSet VSO::lookupFlagsImpl(SymbolFlagsMap &Flags,
return Unresolved;
}
-void VSO::lodgeQuery(std::shared_ptr<AsynchronousSymbolQuery> &Q,
- SymbolNameSet &Unresolved, MaterializationUnitList &MUs) {
+void JITDylib::lodgeQuery(std::shared_ptr<AsynchronousSymbolQuery> &Q,
+ SymbolNameSet &Unresolved,
+ MaterializationUnitList &MUs) {
assert(Q && "Query can not be null");
lodgeQueryImpl(Q, Unresolved, MUs);
@@ -1311,7 +1317,7 @@ void VSO::lodgeQuery(std::shared_ptr<AsynchronousSymbolQuery> &Q,
}
}
-void VSO::lodgeQueryImpl(
+void JITDylib::lodgeQueryImpl(
std::shared_ptr<AsynchronousSymbolQuery> &Q, SymbolNameSet &Unresolved,
std::vector<std::unique_ptr<MaterializationUnit>> &MUs) {
for (auto I = Unresolved.begin(), E = Unresolved.end(); I != E;) {
@@ -1323,7 +1329,7 @@ void VSO::lodgeQueryImpl(
if (SymI == Symbols.end())
continue;
- // If we found Name in V, remove it frome the Unresolved set and add it
+ // If we found Name in JD, remove it frome the Unresolved set and add it
// to the added set.
Unresolved.erase(TmpI);
@@ -1372,8 +1378,8 @@ void VSO::lodgeQueryImpl(
}
}
-SymbolNameSet VSO::legacyLookup(std::shared_ptr<AsynchronousSymbolQuery> Q,
- SymbolNameSet Names) {
+SymbolNameSet JITDylib::legacyLookup(std::shared_ptr<AsynchronousSymbolQuery> Q,
+ SymbolNameSet Names) {
assert(Q && "Query can not be null");
ES.runOutstandingMUs();
@@ -1424,10 +1430,10 @@ SymbolNameSet VSO::legacyLookup(std::shared_ptr<AsynchronousSymbolQuery> Q,
return Unresolved;
}
-VSO::LookupImplActionFlags
-VSO::lookupImpl(std::shared_ptr<AsynchronousSymbolQuery> &Q,
- std::vector<std::unique_ptr<MaterializationUnit>> &MUs,
- SymbolNameSet &Unresolved) {
+JITDylib::LookupImplActionFlags
+JITDylib::lookupImpl(std::shared_ptr<AsynchronousSymbolQuery> &Q,
+ std::vector<std::unique_ptr<MaterializationUnit>> &MUs,
+ SymbolNameSet &Unresolved) {
LookupImplActionFlags ActionFlags = None;
for (auto I = Unresolved.begin(), E = Unresolved.end(); I != E;) {
@@ -1439,7 +1445,7 @@ VSO::lookupImpl(std::shared_ptr<AsynchronousSymbolQuery> &Q,
if (SymI == Symbols.end())
continue;
- // If we found Name in V, remove it frome the Unresolved set and add it
+ // If we found Name, remove it frome the Unresolved set and add it
// to the dependencies set.
Unresolved.erase(TmpI);
@@ -1495,9 +1501,9 @@ VSO::lookupImpl(std::shared_ptr<AsynchronousSymbolQuery> &Q,
return ActionFlags;
}
-void VSO::dump(raw_ostream &OS) {
+void JITDylib::dump(raw_ostream &OS) {
ES.runSessionLocked([&, this]() {
- OS << "VSO \"" << VSOName
+ OS << "JITDylib \"" << JITDylibName
<< "\" (ES: " << format("0x%016x", reinterpret_cast<uintptr_t>(&ES))
<< "):\n"
<< "Symbol table:\n";
@@ -1541,12 +1547,12 @@ void VSO::dump(raw_ostream &OS) {
});
}
-VSO::VSO(ExecutionSessionBase &ES, std::string Name)
- : ES(ES), VSOName(std::move(Name)) {
+JITDylib::JITDylib(ExecutionSessionBase &ES, std::string Name)
+ : ES(ES), JITDylibName(std::move(Name)) {
SearchOrder.push_back(this);
}
-Error VSO::defineImpl(MaterializationUnit &MU) {
+Error JITDylib::defineImpl(MaterializationUnit &MU) {
SymbolNameSet Duplicates;
SymbolNameSet MUDefsOverridden;
@@ -1623,8 +1629,8 @@ Error VSO::defineImpl(MaterializationUnit &MU) {
return Error::success();
}
-void VSO::detachQueryHelper(AsynchronousSymbolQuery &Q,
- const SymbolNameSet &QuerySymbols) {
+void JITDylib::detachQueryHelper(AsynchronousSymbolQuery &Q,
+ const SymbolNameSet &QuerySymbols) {
for (auto &QuerySymbol : QuerySymbols) {
assert(MaterializingInfos.count(QuerySymbol) &&
"QuerySymbol does not have MaterializingInfo");
@@ -1643,53 +1649,55 @@ void VSO::detachQueryHelper(AsynchronousSymbolQuery &Q,
}
}
-void VSO::transferFinalizedNodeDependencies(
+void JITDylib::transferFinalizedNodeDependencies(
MaterializingInfo &DependantMI, const SymbolStringPtr &DependantName,
MaterializingInfo &FinalizedMI) {
for (auto &KV : FinalizedMI.UnfinalizedDependencies) {
- auto &DependencyVSO = *KV.first;
- SymbolNameSet *UnfinalizedDependenciesOnDependencyVSO = nullptr;
+ auto &DependencyJD = *KV.first;
+ SymbolNameSet *UnfinalizedDependenciesOnDependencyJD = nullptr;
for (auto &DependencyName : KV.second) {
- auto &DependencyMI = DependencyVSO.MaterializingInfos[DependencyName];
+ auto &DependencyMI = DependencyJD.MaterializingInfos[DependencyName];
// Do not add self dependencies.
if (&DependencyMI == &DependantMI)
continue;
- // If we haven't looked up the dependencies for DependencyVSO yet, do it
+ // If we haven't looked up the dependencies for DependencyJD yet, do it
// now and cache the result.
- if (!UnfinalizedDependenciesOnDependencyVSO)
- UnfinalizedDependenciesOnDependencyVSO =
- &DependantMI.UnfinalizedDependencies[&DependencyVSO];
+ if (!UnfinalizedDependenciesOnDependencyJD)
+ UnfinalizedDependenciesOnDependencyJD =
+ &DependantMI.UnfinalizedDependencies[&DependencyJD];
DependencyMI.Dependants[this].insert(DependantName);
- UnfinalizedDependenciesOnDependencyVSO->insert(DependencyName);
+ UnfinalizedDependenciesOnDependencyJD->insert(DependencyName);
}
}
}
-VSO &ExecutionSession::createVSO(std::string Name) {
- return runSessionLocked([&, this]() -> VSO & {
- VSOs.push_back(std::unique_ptr<VSO>(new VSO(*this, std::move(Name))));
- return *VSOs.back();
+JITDylib &ExecutionSession::createJITDylib(std::string Name) {
+ return runSessionLocked([&, this]() -> JITDylib & {
+ JDs.push_back(
+ std::unique_ptr<JITDylib>(new JITDylib(*this, std::move(Name))));
+ return *JDs.back();
});
}
-Expected<SymbolMap> lookup(const VSOList &VSOs, SymbolNameSet Names) {
+Expected<SymbolMap> lookup(const JITDylibList &JDs, SymbolNameSet Names) {
- if (VSOs.empty())
+ if (JDs.empty())
return SymbolMap();
- auto &ES = (*VSOs.begin())->getExecutionSession();
+ auto &ES = (*JDs.begin())->getExecutionSession();
- return ES.lookup(VSOs, Names, NoDependenciesToRegister, true);
+ return ES.lookup(JDs, Names, NoDependenciesToRegister, true);
}
-/// Look up a symbol by searching a list of VSOs.
-Expected<JITEvaluatedSymbol> lookup(const VSOList &VSOs, SymbolStringPtr Name) {
+/// Look up a symbol by searching a list of JDs.
+Expected<JITEvaluatedSymbol> lookup(const JITDylibList &JDs,
+ SymbolStringPtr Name) {
SymbolNameSet Names({Name});
- if (auto ResultMap = lookup(VSOs, std::move(Names))) {
+ if (auto ResultMap = lookup(JDs, std::move(Names))) {
assert(ResultMap->size() == 1 && "Unexpected number of results");
assert(ResultMap->count(Name) && "Missing result for symbol");
return std::move(ResultMap->begin()->second);
diff --git a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
index 6157677ce35..bb32b3d82e6 100644
--- a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
@@ -131,7 +131,7 @@ void CtorDtorRunner2::add(iterator_range<CtorDtorIterator> CtorDtors) {
return;
MangleAndInterner Mangle(
- V.getExecutionSession(),
+ JD.getExecutionSession(),
(*CtorDtors.begin()).Func->getParent()->getDataLayout());
for (const auto &CtorDtor : CtorDtors) {
@@ -161,7 +161,7 @@ Error CtorDtorRunner2::run() {
}
}
- if (auto CtorDtorMap = lookup({&V}, std::move(Names))) {
+ if (auto CtorDtorMap = lookup({&JD}, std::move(Names))) {
for (auto &KV : CtorDtorsByPriority) {
for (auto &Name : KV.second) {
assert(CtorDtorMap->count(Name) && "No entry for Name");
@@ -195,7 +195,8 @@ int LocalCXXRuntimeOverridesBase::CXAAtExitOverride(DestructorPtr Destructor,
return 0;
}
-Error LocalCXXRuntimeOverrides2::enable(VSO &V, MangleAndInterner &Mangle) {
+Error LocalCXXRuntimeOverrides2::enable(JITDylib &JD,
+ MangleAndInterner &Mangle) {
SymbolMap RuntimeInterposes(
{{Mangle("__dso_handle"),
JITEvaluatedSymbol(toTargetAddress(&DSOHandleOverride),
@@ -204,7 +205,7 @@ Error LocalCXXRuntimeOverrides2::enable(VSO &V, MangleAndInterner &Mangle) {
JITEvaluatedSymbol(toTargetAddress(&CXAAtExitOverride),
JITSymbolFlags::Exported)}});
- return V.define(absoluteSymbols(std::move(RuntimeInterposes)));
+ return JD.define(absoluteSymbols(std::move(RuntimeInterposes)));
}
DynamicLibraryFallbackGenerator::DynamicLibraryFallbackGenerator(
@@ -213,7 +214,7 @@ DynamicLibraryFallbackGenerator::DynamicLibraryFallbackGenerator(
GlobalPrefix(DL.getGlobalPrefix()) {}
SymbolNameSet DynamicLibraryFallbackGenerator::
-operator()(VSO &V, const SymbolNameSet &Names) {
+operator()(JITDylib &JD, const SymbolNameSet &Names) {
orc::SymbolNameSet Added;
orc::SymbolMap NewSymbols;
@@ -235,11 +236,11 @@ operator()(VSO &V, const SymbolNameSet &Names) {
}
}
- // Add any new symbols to V. Since the fallback generator is only called for
+ // Add any new symbols to JD. Since the fallback generator is only called for
// symbols that are not already defined, this will never trigger a duplicate
// definition error, so we can wrap this call in a 'cantFail'.
if (!NewSymbols.empty())
- cantFail(V.define(absoluteSymbols(std::move(NewSymbols))));
+ cantFail(JD.define(absoluteSymbols(std::move(NewSymbols))));
return Added;
}
diff --git a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
index 9ca2c5cb4a5..436104a3067 100644
--- a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
@@ -39,7 +39,7 @@ private:
R.finalize();
}
- void discard(const VSO &V, SymbolStringPtr Name) {
+ void discard(const JITDylib &JD, SymbolStringPtr Name) {
llvm_unreachable("Discard should never occur on a LMU?");
}
@@ -63,7 +63,7 @@ JITCompileCallbackManager::getCompileCallback(CompileFunction Compile) {
std::lock_guard<std::mutex> Lock(CCMgrMutex);
AddrToSymbol[*TrampolineAddr] = CallbackName;
- cantFail(CallbacksVSO.define(
+ cantFail(CallbacksJD.define(
llvm::make_unique<CompileCallbackMaterializationUnit>(
std::move(CallbackName), std::move(Compile))));
return *TrampolineAddr;
@@ -97,7 +97,7 @@ JITTargetAddress JITCompileCallbackManager::executeCompileCallback(
Name = I->second;
}
- if (auto Sym = lookup({&CallbacksVSO}, Name))
+ if (auto Sym = lookup({&CallbacksJD}, Name))
return Sym->getAddress();
else {
// If anything goes wrong materializing Sym then report it to the session
diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index 52ff4efe56b..12ec65a2050 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -28,25 +28,25 @@ Error LLJIT::defineAbsolute(StringRef Name, JITEvaluatedSymbol Sym) {
return Main.define(absoluteSymbols(std::move(Symbols)));
}
-Error LLJIT::addIRModule(VSO &V, std::unique_ptr<Module> M) {
+Error LLJIT::addIRModule(JITDylib &JD, std::unique_ptr<Module> M) {
assert(M && "Can not add null module");
if (auto Err = applyDataLayout(*M))
return Err;
auto K = ES->allocateVModule();
- return CompileLayer.add(V, K, std::move(M));
+ return CompileLayer.add(JD, K, std::move(M));
}
-Expected<JITEvaluatedSymbol> LLJIT::lookupLinkerMangled(VSO &V,
+Expected<JITEvaluatedSymbol> LLJIT::lookupLinkerMangled(JITDylib &JD,
StringRef Name) {
- return llvm::orc::lookup({&V}, ES->getSymbolStringPool().intern(Name));
+ return llvm::orc::lookup({&JD}, ES->getSymbolStringPool().intern(Name));
}
LLJIT::LLJIT(std::unique_ptr<ExecutionSession> ES,
std::unique_ptr<TargetMachine> TM, DataLayout DL)
- : ES(std::move(ES)), Main(this->ES->createVSO("main")), TM(std::move(TM)),
- DL(std::move(DL)),
+ : ES(std::move(ES)), Main(this->ES->createJITDylib("main")),
+ TM(std::move(TM)), DL(std::move(DL)),
ObjLinkingLayer(*this->ES,
[this](VModuleKey K) { return getMemoryManager(K); }),
CompileLayer(*this->ES, ObjLinkingLayer, SimpleCompiler(*this->TM)),
@@ -106,7 +106,7 @@ LLLazyJIT::Create(std::unique_ptr<ExecutionSession> ES,
std::move(CCMgr), std::move(ISMBuilder)));
}
-Error LLLazyJIT::addLazyIRModule(VSO &V, std::unique_ptr<Module> M) {
+Error LLLazyJIT::addLazyIRModule(JITDylib &JD, std::unique_ptr<Module> M) {
assert(M && "Can not add null module");
if (auto Err = applyDataLayout(*M))
@@ -117,7 +117,7 @@ Error LLLazyJIT::addLazyIRModule(VSO &V, std::unique_ptr<Module> M) {
recordCtorDtors(*M);
auto K = ES->allocateVModule();
- return CODLayer.add(V, K, std::move(M));
+ return CODLayer.add(JD, K, std::move(M));
}
LLLazyJIT::LLLazyJIT(
diff --git a/llvm/lib/ExecutionEngine/Orc/Layer.cpp b/llvm/lib/ExecutionEngine/Orc/Layer.cpp
index 8ba88b249ea..cbe13002622 100644
--- a/llvm/lib/ExecutionEngine/Orc/Layer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Layer.cpp
@@ -16,8 +16,8 @@ namespace orc {
IRLayer::IRLayer(ExecutionSession &ES) : ES(ES) {}
IRLayer::~IRLayer() {}
-Error IRLayer::add(VSO &V, VModuleKey K, std::unique_ptr<Module> M) {
- return V.define(llvm::make_unique<BasicIRLayerMaterializationUnit>(
+Error IRLayer::add(JITDylib &JD, VModuleKey K, std::unique_ptr<Module> M) {
+ return JD.define(llvm::make_unique<BasicIRLayerMaterializationUnit>(
*this, std::move(K), std::move(M)));
}
@@ -42,7 +42,7 @@ IRMaterializationUnit::IRMaterializationUnit(
: MaterializationUnit(std::move(SymbolFlags)), M(std::move(M)),
SymbolToDefinition(std::move(SymbolToDefinition)) {}
-void IRMaterializationUnit::discard(const VSO &V, SymbolStringPtr Name) {
+void IRMaterializationUnit::discard(const JITDylib &JD, SymbolStringPtr Name) {
auto I = SymbolToDefinition.find(Name);
assert(I != SymbolToDefinition.end() &&
"Symbol not provided by this MU, or previously discarded");
@@ -66,12 +66,13 @@ ObjectLayer::ObjectLayer(ExecutionSession &ES) : ES(ES) {}
ObjectLayer::~ObjectLayer() {}
-Error ObjectLayer::add(VSO &V, VModuleKey K, std::unique_ptr<MemoryBuffer> O) {
+Error ObjectLayer::add(JITDylib &JD, VModuleKey K,
+ std::unique_ptr<MemoryBuffer> O) {
auto ObjMU = BasicObjectLayerMaterializationUnit::Create(*this, std::move(K),
std::move(O));
if (!ObjMU)
return ObjMU.takeError();
- return V.define(std::move(*ObjMU));
+ return JD.define(std::move(*ObjMU));
}
Expected<std::unique_ptr<BasicObjectLayerMaterializationUnit>>
@@ -99,7 +100,7 @@ void BasicObjectLayerMaterializationUnit::materialize(
L.emit(std::move(R), std::move(K), std::move(O));
}
-void BasicObjectLayerMaterializationUnit::discard(const VSO &V,
+void BasicObjectLayerMaterializationUnit::discard(const JITDylib &JD,
SymbolStringPtr Name) {
// FIXME: Support object file level discard. This could be done by building a
// filter to pass to the object layer along with the object itself.
diff --git a/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp b/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
index 71b4b73ca6d..3ceafc25eec 100644
--- a/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
@@ -14,12 +14,12 @@ namespace {
using namespace llvm;
using namespace llvm::orc;
-class VSOSearchOrderResolver : public JITSymbolResolver {
+class JITDylibSearchOrderResolver : public JITSymbolResolver {
public:
- VSOSearchOrderResolver(MaterializationResponsibility &MR) : MR(MR) {}
+ JITDylibSearchOrderResolver(MaterializationResponsibility &MR) : MR(MR) {}
Expected<LookupResult> lookup(const LookupSet &Symbols) {
- auto &ES = MR.getTargetVSO().getExecutionSession();
+ auto &ES = MR.getTargetJITDylib().getExecutionSession();
SymbolNameSet InternedSymbols;
for (auto &S : Symbols)
@@ -30,8 +30,8 @@ public:
};
auto InternedResult =
- MR.getTargetVSO().withSearchOrderDo([&](const VSOList &VSOs) {
- return ES.lookup(VSOs, InternedSymbols, RegisterDependencies, false);
+ MR.getTargetJITDylib().withSearchOrderDo([&](const JITDylibList &JDs) {
+ return ES.lookup(JDs, InternedSymbols, RegisterDependencies, false);
});
if (!InternedResult)
@@ -45,7 +45,7 @@ public:
}
Expected<LookupFlagsResult> lookupFlags(const LookupSet &Symbols) {
- auto &ES = MR.getTargetVSO().getExecutionSession();
+ auto &ES = MR.getTargetJITDylib().getExecutionSession();
SymbolNameSet InternedSymbols;
@@ -53,13 +53,13 @@ public:
InternedSymbols.insert(ES.getSymbolStringPool().intern(S));
SymbolFlagsMap InternedResult;
- MR.getTargetVSO().withSearchOrderDo([&](const VSOList &VSOs) {
+ MR.getTargetJITDylib().withSearchOrderDo([&](const JITDylibList &JDs) {
// An empty search order is pathalogical, but allowed.
- if (VSOs.empty())
+ if (JDs.empty())
return;
- assert(VSOs.front() && "VSOList entry can not be null");
- InternedResult = VSOs.front()->lookupFlags(InternedSymbols);
+ assert(JDs.front() && "VSOList entry can not be null");
+ InternedResult = JDs.front()->lookupFlags(InternedSymbols);
});
LookupFlagsResult Result;
@@ -100,7 +100,7 @@ void RTDyldObjectLinkingLayer2::emit(MaterializationResponsibility R,
auto MemoryManager = GetMemoryManager(K);
- VSOSearchOrderResolver Resolver(R);
+ JITDylibSearchOrderResolver Resolver(R);
auto RTDyld = llvm::make_unique<RuntimeDyld>(*MemoryManager, Resolver);
RTDyld->setProcessAllSections(ProcessAllSections);
OpenPOWER on IntegriCloud