@@ -390,8 +390,8 @@ SymbolNameSet MaterializationResponsibility::getRequestedSymbols() const {
390
390
}
391
391
392
392
void MaterializationResponsibility::resolve (const SymbolMap &Symbols) {
393
- LLVM_DEBUG (dbgs () << " In " << JD. getName () << " resolving " << Symbols
394
- << " \n " );
393
+ LLVM_DEBUG (
394
+ { dbgs () << " In " << JD. getName () << " resolving " << Symbols << " \n " ; } );
395
395
#ifndef NDEBUG
396
396
for (auto &KV : Symbols) {
397
397
auto I = SymbolFlags.find (KV.first );
@@ -412,6 +412,11 @@ void MaterializationResponsibility::resolve(const SymbolMap &Symbols) {
412
412
}
413
413
414
414
void MaterializationResponsibility::emit () {
415
+
416
+ LLVM_DEBUG ({
417
+ dbgs () << " In " << JD.getName () << " emitting " << SymbolFlags << " \n " ;
418
+ });
419
+
415
420
#ifndef NDEBUG
416
421
for (auto &KV : SymbolFlags)
417
422
assert (!KV.second .isMaterializing () &&
@@ -441,6 +446,11 @@ Error MaterializationResponsibility::defineMaterializing(
441
446
442
447
void MaterializationResponsibility::failMaterialization () {
443
448
449
+ LLVM_DEBUG ({
450
+ dbgs () << " In " << JD.getName () << " failing materialization for "
451
+ << SymbolFlags << " \n " ;
452
+ });
453
+
444
454
SymbolNameSet FailedSymbols;
445
455
for (auto &KV : SymbolFlags)
446
456
FailedSymbols.insert (KV.first );
@@ -1025,6 +1035,23 @@ void JITDylib::notifyFailed(const SymbolNameSet &FailedSymbols) {
1025
1035
if (MII == MaterializingInfos.end ())
1026
1036
continue ;
1027
1037
1038
+ // Remove this symbol from the dependants list of any dependencies.
1039
+ for (auto &KV : MII->second .UnemittedDependencies ) {
1040
+ auto *DependencyJD = KV.first ;
1041
+ auto &Dependencies = KV.second ;
1042
+ for (auto &DependencyName : Dependencies) {
1043
+ auto DependencyMII =
1044
+ DependencyJD->MaterializingInfos .find (DependencyName);
1045
+ assert (DependencyMII != DependencyJD->MaterializingInfos .end () &&
1046
+ " Unemitted dependency must have a MaterializingInfo entry" );
1047
+ assert (DependencyMII->second .Dependants .count (this ) &&
1048
+ " Dependency's dependants list does not contain this JITDylib" );
1049
+ assert (DependencyMII->second .Dependants [this ].count (Name) &&
1050
+ " Dependency's dependants list does not contain dependant" );
1051
+ DependencyMII->second .Dependants [this ].erase (Name);
1052
+ }
1053
+ }
1054
+
1028
1055
// Copy all the queries to the FailedQueries list, then abandon them.
1029
1056
// This has to be a copy, and the copy has to come before the abandon
1030
1057
// operation: Each Q.detach() call will reach back into this
0 commit comments