Skip to content

Commit

Permalink
[ORC] Remove redundant locking of session mutex, update method name.
Browse files Browse the repository at this point in the history
JITDylib::removeTracker already runs with the session mutex locked (and must do
so), so remove the redundant locking and add an 'IL_' ("inside lock") prefix to
the method name.
  • Loading branch information
lhames committed Jun 26, 2024
1 parent 0fe82ea commit 96b1f88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion llvm/include/llvm/ExecutionEngine/Orc/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ class JITDylib : public ThreadSafeRefCountedBase<JITDylib>,
JITDylib(ExecutionSession &ES, std::string Name);

std::pair<AsynchronousSymbolQuerySet, std::shared_ptr<SymbolDependenceMap>>
removeTracker(ResourceTracker &RT);
IL_removeTracker(ResourceTracker &RT);

void transferTracker(ResourceTracker &DstRT, ResourceTracker &SrcRT);

Expand Down
9 changes: 4 additions & 5 deletions llvm/lib/ExecutionEngine/Orc/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ JITDylib::JITDylib(ExecutionSession &ES, std::string Name)

std::pair<JITDylib::AsynchronousSymbolQuerySet,
std::shared_ptr<SymbolDependenceMap>>
JITDylib::removeTracker(ResourceTracker &RT) {
JITDylib::IL_removeTracker(ResourceTracker &RT) {
// Note: Should be called under the session lock.
assert(State != Closed && "JD is defunct");

Expand Down Expand Up @@ -1305,9 +1305,7 @@ JITDylib::removeTracker(ResourceTracker &RT) {
SymbolsToFail.push_back(Sym);
}

AsynchronousSymbolQuerySet QueriesToFail;
auto Result = ES.runSessionLocked(
[&]() { return ES.IL_failSymbols(*this, std::move(SymbolsToFail)); });
auto Result = ES.IL_failSymbols(*this, std::move(SymbolsToFail));

// Removed symbols should be taken out of the table altogether.
for (auto &Sym : SymbolsToRemove) {
Expand Down Expand Up @@ -2198,7 +2196,8 @@ Error ExecutionSession::removeResourceTracker(ResourceTracker &RT) {
runSessionLocked([&] {
CurrentResourceManagers = ResourceManagers;
RT.makeDefunct();
std::tie(QueriesToFail, FailedSymbols) = RT.getJITDylib().removeTracker(RT);
std::tie(QueriesToFail, FailedSymbols) =
RT.getJITDylib().IL_removeTracker(RT);
});

Error Err = Error::success();
Expand Down

0 comments on commit 96b1f88

Please sign in to comment.