Skip to content

Commit

Permalink
[ORC] Fail materialization in tasks that are destroyed before running.
Browse files Browse the repository at this point in the history
If a MaterialiaztionTask is destroyed before running then we need to call
failMaterialization on the MaterializationResponsibility member.
  • Loading branch information
lhames committed Jan 9, 2025
1 parent d80bdf7 commit 42b2325
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions llvm/include/llvm/ExecutionEngine/Orc/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,7 @@ class MaterializationTask : public RTTIExtends<MaterializationTask, Task> {
MaterializationTask(std::unique_ptr<MaterializationUnit> MU,
std::unique_ptr<MaterializationResponsibility> MR)
: MU(std::move(MU)), MR(std::move(MR)) {}
~MaterializationTask() override;
void printDescription(raw_ostream &OS) override;
void run() override;

Expand Down
12 changes: 11 additions & 1 deletion llvm/lib/ExecutionEngine/Orc/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1576,12 +1576,22 @@ void Platform::lookupInitSymbolsAsync(
}
}

MaterializationTask::~MaterializationTask() {
// If this task wasn't run then fail materialization.
if (MR)
MR->failMaterialization();
}

void MaterializationTask::printDescription(raw_ostream &OS) {
OS << "Materialization task: " << MU->getName() << " in "
<< MR->getTargetJITDylib().getName();
}

void MaterializationTask::run() { MU->materialize(std::move(MR)); }
void MaterializationTask::run() {
assert(MU && "MU should not be null");
assert(MR && "MR should not be null");
MU->materialize(std::move(MR));
}

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

Expand Down

0 comments on commit 42b2325

Please sign in to comment.