mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
[ORC] Fix an overly aggressive assert.
Symbols that have not been queried will not have MaterializingInfo entries, so remove the assert that all failed symbols should have these entries. Also updates the loop to only remove entries that were found earlier. llvm-svn: 369975
This commit is contained in:
parent
024081fd3f
commit
f2f188d997
@ -1187,6 +1187,8 @@ void JITDylib::notifyFailed(const SymbolFlagsMap &FailedSymbols) {
|
|||||||
AsynchronousSymbolQuerySet FailedQueries;
|
AsynchronousSymbolQuerySet FailedQueries;
|
||||||
|
|
||||||
ES.runSessionLocked([&]() {
|
ES.runSessionLocked([&]() {
|
||||||
|
std::vector<const SymbolStringPtr *> MaterializerNamesToFail;
|
||||||
|
|
||||||
for (auto &KV : FailedSymbols) {
|
for (auto &KV : FailedSymbols) {
|
||||||
auto &Name = KV.first;
|
auto &Name = KV.first;
|
||||||
|
|
||||||
@ -1207,6 +1209,7 @@ void JITDylib::notifyFailed(const SymbolFlagsMap &FailedSymbols) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto &MI = MII->second;
|
auto &MI = MII->second;
|
||||||
|
MaterializerNamesToFail.push_back(&KV.first);
|
||||||
|
|
||||||
// Move all dependants to the error state and disconnect from them.
|
// Move all dependants to the error state and disconnect from them.
|
||||||
for (auto &KV : MI.Dependants) {
|
for (auto &KV : MI.Dependants) {
|
||||||
@ -1261,9 +1264,9 @@ void JITDylib::notifyFailed(const SymbolFlagsMap &FailedSymbols) {
|
|||||||
Q->detach();
|
Q->detach();
|
||||||
|
|
||||||
// Remove the MaterializingInfos.
|
// Remove the MaterializingInfos.
|
||||||
for (auto &KV : FailedSymbols) {
|
while (!MaterializerNamesToFail.empty()) {
|
||||||
assert(MaterializingInfos.count(KV.first) && "Expected MI for Name");
|
MaterializingInfos.erase(*MaterializerNamesToFail.back());
|
||||||
MaterializingInfos.erase(KV.first);
|
MaterializerNamesToFail.pop_back();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -718,6 +718,35 @@ TEST_F(CoreAPIsStandardTest, AddDependencyOnFailedSymbol) {
|
|||||||
<< "Lookup on failed symbol should fail";
|
<< "Lookup on failed symbol should fail";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(CoreAPIsStandardTest, FailMaterializerWithUnqueriedSymbols) {
|
||||||
|
// Make sure that symbols with no queries aganist them still
|
||||||
|
// fail correctly.
|
||||||
|
|
||||||
|
bool MaterializerRun = false;
|
||||||
|
auto MU = std::make_unique<SimpleMaterializationUnit>(
|
||||||
|
SymbolFlagsMap(
|
||||||
|
{{Foo, JITSymbolFlags::Exported}, {Bar, JITSymbolFlags::Exported}}),
|
||||||
|
[&](MaterializationResponsibility R) {
|
||||||
|
MaterializerRun = true;
|
||||||
|
R.failMaterialization();
|
||||||
|
});
|
||||||
|
|
||||||
|
cantFail(JD.define(std::move(MU)));
|
||||||
|
|
||||||
|
// Issue a query for Foo, but not bar.
|
||||||
|
EXPECT_THAT_EXPECTED(ES.lookup({&JD}, {Foo}), Failed())
|
||||||
|
<< "Expected lookup to fail.";
|
||||||
|
|
||||||
|
// Check that the materializer (and therefore failMaterialization) ran.
|
||||||
|
EXPECT_TRUE(MaterializerRun) << "Expected materializer to have run by now";
|
||||||
|
|
||||||
|
// Check that subsequent queries against both symbols fail.
|
||||||
|
EXPECT_THAT_EXPECTED(ES.lookup({&JD}, {Foo}), Failed())
|
||||||
|
<< "Expected lookup for Foo to fail.";
|
||||||
|
EXPECT_THAT_EXPECTED(ES.lookup({&JD}, {Bar}), Failed())
|
||||||
|
<< "Expected lookup for Bar to fail.";
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(CoreAPIsStandardTest, DropMaterializerWhenEmpty) {
|
TEST_F(CoreAPIsStandardTest, DropMaterializerWhenEmpty) {
|
||||||
bool DestructorRun = false;
|
bool DestructorRun = false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user