Skip to content

Commit 42b2325

Browse files
committed
[ORC] Fail materialization in tasks that are destroyed before running.
If a MaterialiaztionTask is destroyed before running then we need to call failMaterialization on the MaterializationResponsibility member.
1 parent d80bdf7 commit 42b2325

File tree

2 files changed

+12
-1
lines changed
  • llvm

2 files changed

+12
-1
lines changed

llvm/include/llvm/ExecutionEngine/Orc/Core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,7 @@ class MaterializationTask : public RTTIExtends<MaterializationTask, Task> {
13121312
MaterializationTask(std::unique_ptr<MaterializationUnit> MU,
13131313
std::unique_ptr<MaterializationResponsibility> MR)
13141314
: MU(std::move(MU)), MR(std::move(MR)) {}
1315+
~MaterializationTask() override;
13151316
void printDescription(raw_ostream &OS) override;
13161317
void run() override;
13171318

llvm/lib/ExecutionEngine/Orc/Core.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,12 +1576,22 @@ void Platform::lookupInitSymbolsAsync(
15761576
}
15771577
}
15781578

1579+
MaterializationTask::~MaterializationTask() {
1580+
// If this task wasn't run then fail materialization.
1581+
if (MR)
1582+
MR->failMaterialization();
1583+
}
1584+
15791585
void MaterializationTask::printDescription(raw_ostream &OS) {
15801586
OS << "Materialization task: " << MU->getName() << " in "
15811587
<< MR->getTargetJITDylib().getName();
15821588
}
15831589

1584-
void MaterializationTask::run() { MU->materialize(std::move(MR)); }
1590+
void MaterializationTask::run() {
1591+
assert(MU && "MU should not be null");
1592+
assert(MR && "MR should not be null");
1593+
MU->materialize(std::move(MR));
1594+
}
15851595

15861596
void LookupTask::printDescription(raw_ostream &OS) { OS << "Lookup task"; }
15871597

0 commit comments

Comments
 (0)