summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2018-10-15 05:07:54 +0000
committerLang Hames <lhames@gmail.com>2018-10-15 05:07:54 +0000
commita5157d6f4bed542993ae83d7a7826146eed3e019 (patch)
tree881ca55e5c456ef6042268ac8f7d02825f74d0ae /llvm/lib/ExecutionEngine
parent3c01508409d3e9a7e43950318b626e2bd1bf7e78 (diff)
downloadbcm5719-llvm-a5157d6f4bed542993ae83d7a7826146eed3e019.tar.gz
bcm5719-llvm-a5157d6f4bed542993ae83d7a7826146eed3e019.zip
[ORC] Simplify naming for JITDylib definition generators.
Renames: JITDylib's setFallbackDefinitionGenerator method to setGenerator. DynamicLibraryFallbackGenerator class to DynamicLibrarySearchGenerator. ReexportsFallbackDefinitionGenerator to ReexportsGenerator. llvm-svn: 344489
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/Orc/Core.cpp49
-rw-r--r--llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp20
2 files changed, 36 insertions, 33 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp
index c9cfacef61b..3fa28a5af6f 100644
--- a/llvm/lib/ExecutionEngine/Orc/Core.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp
@@ -686,26 +686,26 @@ buildSimpleReexportsAliasMap(JITDylib &SourceJD, const SymbolNameSet &Symbols) {
return Result;
}
-ReexportsFallbackDefinitionGenerator::ReexportsFallbackDefinitionGenerator(
- JITDylib &BackingJD, SymbolPredicate Allow)
- : BackingJD(BackingJD), Allow(std::move(Allow)) {}
+ReexportsGenerator::ReexportsGenerator(JITDylib &SourceJD,
+ SymbolPredicate Allow)
+ : SourceJD(SourceJD), Allow(std::move(Allow)) {}
-SymbolNameSet ReexportsFallbackDefinitionGenerator::
-operator()(JITDylib &JD, const SymbolNameSet &Names) {
+SymbolNameSet ReexportsGenerator::operator()(JITDylib &JD,
+ const SymbolNameSet &Names) {
orc::SymbolNameSet Added;
orc::SymbolAliasMap AliasMap;
- auto Flags = BackingJD.lookupFlags(Names);
+ auto Flags = SourceJD.lookupFlags(Names);
for (auto &KV : Flags) {
- if (!Allow(KV.first))
+ if (Allow && !Allow(KV.first))
continue;
AliasMap[KV.first] = SymbolAliasMapEntry(KV.first, KV.second);
Added.insert(KV.first);
}
if (!Added.empty())
- cantFail(JD.define(reexports(BackingJD, AliasMap)));
+ cantFail(JD.define(reexports(SourceJD, AliasMap)));
return Added;
}
@@ -1117,10 +1117,10 @@ SymbolFlagsMap JITDylib::lookupFlags(const SymbolNameSet &Names) {
return ES.runSessionLocked([&, this]() {
SymbolFlagsMap Result;
auto Unresolved = lookupFlagsImpl(Result, Names);
- if (FallbackDefinitionGenerator && !Unresolved.empty()) {
- auto FallbackDefs = FallbackDefinitionGenerator(*this, Unresolved);
- if (!FallbackDefs.empty()) {
- auto Unresolved2 = lookupFlagsImpl(Result, FallbackDefs);
+ if (DefGenerator && !Unresolved.empty()) {
+ auto NewDefs = DefGenerator(*this, Unresolved);
+ if (!NewDefs.empty()) {
+ auto Unresolved2 = lookupFlagsImpl(Result, NewDefs);
(void)Unresolved2;
assert(Unresolved2.empty() &&
"All fallback defs should have been found by lookupFlagsImpl");
@@ -1156,14 +1156,13 @@ void JITDylib::lodgeQuery(std::shared_ptr<AsynchronousSymbolQuery> &Q,
assert(Q && "Query can not be null");
lodgeQueryImpl(Q, Unresolved, MatchNonExportedInJD, MatchNonExported, MUs);
- if (FallbackDefinitionGenerator && !Unresolved.empty()) {
- auto FallbackDefs = FallbackDefinitionGenerator(*this, Unresolved);
- if (!FallbackDefs.empty()) {
- for (auto &D : FallbackDefs)
+ if (DefGenerator && !Unresolved.empty()) {
+ auto NewDefs = DefGenerator(*this, Unresolved);
+ if (!NewDefs.empty()) {
+ for (auto &D : NewDefs)
Unresolved.erase(D);
- lodgeQueryImpl(Q, FallbackDefs, MatchNonExportedInJD, MatchNonExported,
- MUs);
- assert(FallbackDefs.empty() &&
+ lodgeQueryImpl(Q, NewDefs, MatchNonExportedInJD, MatchNonExported, MUs);
+ assert(NewDefs.empty() &&
"All fallback defs should have been found by lookupImpl");
}
}
@@ -1250,15 +1249,15 @@ SymbolNameSet JITDylib::legacyLookup(std::shared_ptr<AsynchronousSymbolQuery> Q,
SymbolNameSet Unresolved = std::move(Names);
ES.runSessionLocked([&, this]() {
ActionFlags = lookupImpl(Q, MUs, Unresolved);
- if (FallbackDefinitionGenerator && !Unresolved.empty()) {
+ if (DefGenerator && !Unresolved.empty()) {
assert(ActionFlags == None &&
"ActionFlags set but unresolved symbols remain?");
- auto FallbackDefs = FallbackDefinitionGenerator(*this, Unresolved);
- if (!FallbackDefs.empty()) {
- for (auto &D : FallbackDefs)
+ auto NewDefs = DefGenerator(*this, Unresolved);
+ if (!NewDefs.empty()) {
+ for (auto &D : NewDefs)
Unresolved.erase(D);
- ActionFlags = lookupImpl(Q, MUs, FallbackDefs);
- assert(FallbackDefs.empty() &&
+ ActionFlags = lookupImpl(Q, MUs, NewDefs);
+ assert(NewDefs.empty() &&
"All fallback defs should have been found by lookupImpl");
}
}
diff --git a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
index 6a180106240..667237373ca 100644
--- a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
@@ -178,21 +178,22 @@ Error LocalCXXRuntimeOverrides2::enable(JITDylib &JD,
return JD.define(absoluteSymbols(std::move(RuntimeInterposes)));
}
-DynamicLibraryFallbackGenerator::DynamicLibraryFallbackGenerator(
+DynamicLibrarySearchGenerator::DynamicLibrarySearchGenerator(
sys::DynamicLibrary Dylib, const DataLayout &DL, SymbolPredicate Allow)
: Dylib(std::move(Dylib)), Allow(std::move(Allow)),
GlobalPrefix(DL.getGlobalPrefix()) {}
-Expected<DynamicLibraryFallbackGenerator> DynamicLibraryFallbackGenerator::Load(
- const char *FileName, const DataLayout &DL, SymbolPredicate Allow) {
+Expected<DynamicLibrarySearchGenerator>
+DynamicLibrarySearchGenerator::Load(const char *FileName, const DataLayout &DL,
+ SymbolPredicate Allow) {
std::string ErrMsg;
auto Lib = sys::DynamicLibrary::getPermanentLibrary(FileName, &ErrMsg);
if (!Lib.isValid())
return make_error<StringError>(std::move(ErrMsg), inconvertibleErrorCode());
- return DynamicLibraryFallbackGenerator(std::move(Lib), DL, std::move(Allow));
+ return DynamicLibrarySearchGenerator(std::move(Lib), DL, std::move(Allow));
}
-SymbolNameSet DynamicLibraryFallbackGenerator::
+SymbolNameSet DynamicLibrarySearchGenerator::
operator()(JITDylib &JD, const SymbolNameSet &Names) {
orc::SymbolNameSet Added;
orc::SymbolMap NewSymbols;
@@ -200,7 +201,10 @@ operator()(JITDylib &JD, const SymbolNameSet &Names) {
bool HasGlobalPrefix = (GlobalPrefix != '\0');
for (auto &Name : Names) {
- if (!Allow(Name) || (*Name).empty())
+ if ((*Name).empty())
+ continue;
+
+ if (Allow && !Allow(Name))
continue;
if (HasGlobalPrefix && (*Name).front() != GlobalPrefix)
@@ -215,8 +219,8 @@ operator()(JITDylib &JD, const SymbolNameSet &Names) {
}
}
- // 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
+ // Add any new symbols to JD. Since the 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(JD.define(absoluteSymbols(std::move(NewSymbols))));
OpenPOWER on IntegriCloud