summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2019-04-25 23:31:33 +0000
committerLang Hames <lhames@gmail.com>2019-04-25 23:31:33 +0000
commit4f71049a39dc7ebbb957dc701f77cd6191b20e3c (patch)
tree041b5e21092792058e1608c42a77115bc7b188c4 /llvm/lib/ExecutionEngine
parent1be5369a0ce4606d8ee3113ab4372f196d20daeb (diff)
downloadbcm5719-llvm-4f71049a39dc7ebbb957dc701f77cd6191b20e3c.tar.gz
bcm5719-llvm-4f71049a39dc7ebbb957dc701f77cd6191b20e3c.zip
[ORC] Remove symbols from dependency lists when failing materialization.
When failing materialization of a symbol X, remove X from the dependants list of any of X's dependencies. This ensures that when X's dependencies are emitted (or fail themselves) they do not try to access the no-longer-existing MaterializationInfo for X. llvm-svn: 359252
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/Orc/Core.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp
index cc52b564bec..4aa763feb79 100644
--- a/llvm/lib/ExecutionEngine/Orc/Core.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp
@@ -390,8 +390,8 @@ SymbolNameSet MaterializationResponsibility::getRequestedSymbols() const {
}
void MaterializationResponsibility::resolve(const SymbolMap &Symbols) {
- LLVM_DEBUG(dbgs() << "In " << JD.getName() << " resolving " << Symbols
- << "\n");
+ LLVM_DEBUG(
+ { dbgs() << "In " << JD.getName() << " resolving " << Symbols << "\n"; });
#ifndef NDEBUG
for (auto &KV : Symbols) {
auto I = SymbolFlags.find(KV.first);
@@ -412,6 +412,11 @@ void MaterializationResponsibility::resolve(const SymbolMap &Symbols) {
}
void MaterializationResponsibility::emit() {
+
+ LLVM_DEBUG({
+ dbgs() << "In " << JD.getName() << " emitting " << SymbolFlags << "\n";
+ });
+
#ifndef NDEBUG
for (auto &KV : SymbolFlags)
assert(!KV.second.isMaterializing() &&
@@ -441,6 +446,11 @@ Error MaterializationResponsibility::defineMaterializing(
void MaterializationResponsibility::failMaterialization() {
+ LLVM_DEBUG({
+ dbgs() << "In " << JD.getName() << " failing materialization for "
+ << SymbolFlags << "\n";
+ });
+
SymbolNameSet FailedSymbols;
for (auto &KV : SymbolFlags)
FailedSymbols.insert(KV.first);
@@ -1025,6 +1035,23 @@ void JITDylib::notifyFailed(const SymbolNameSet &FailedSymbols) {
if (MII == MaterializingInfos.end())
continue;
+ // Remove this symbol from the dependants list of any dependencies.
+ for (auto &KV : MII->second.UnemittedDependencies) {
+ auto *DependencyJD = KV.first;
+ auto &Dependencies = KV.second;
+ for (auto &DependencyName : Dependencies) {
+ auto DependencyMII =
+ DependencyJD->MaterializingInfos.find(DependencyName);
+ assert(DependencyMII != DependencyJD->MaterializingInfos.end() &&
+ "Unemitted dependency must have a MaterializingInfo entry");
+ assert(DependencyMII->second.Dependants.count(this) &&
+ "Dependency's dependants list does not contain this JITDylib");
+ assert(DependencyMII->second.Dependants[this].count(Name) &&
+ "Dependency's dependants list does not contain dependant");
+ DependencyMII->second.Dependants[this].erase(Name);
+ }
+ }
+
// Copy all the queries to the FailedQueries list, then abandon them.
// This has to be a copy, and the copy has to come before the abandon
// operation: Each Q.detach() call will reach back into this
OpenPOWER on IntegriCloud