From bf6d7ca9870beb66766e2c087f5109eeb538f530 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Sun, 13 Nov 2022 22:12:09 -0800 Subject: [ORC] Add JITDylib argument to ResourceManager notify-removing/transferring ops. In some cases it's helpful to group trackers by JITDylib. E.g. Platform classes may want to track initializer symbols with a `JITDylib -> Tracker -> [ Symbol ]` map. This makes it easy to collect all symbols for the JITDylib, while still allowing efficient removal of a single tracker. Passing the JITDylib as an argument to ResourceManager::notifyRemovingResources and ResourceManager::notifyTransferringResources supports such use-cases. --- llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp') diff --git a/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp b/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp index 1a4a451..2b11c47 100644 --- a/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp +++ b/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp @@ -680,12 +680,12 @@ Error ObjectLinkingLayer::notifyEmitted(MaterializationResponsibility &MR, [&](ResourceKey K) { Allocs[K].push_back(std::move(FA)); }); } -Error ObjectLinkingLayer::handleRemoveResources(ResourceKey K) { +Error ObjectLinkingLayer::handleRemoveResources(JITDylib &JD, ResourceKey K) { { Error Err = Error::success(); for (auto &P : Plugins) - Err = joinErrors(std::move(Err), P->notifyRemovingResources(K)); + Err = joinErrors(std::move(Err), P->notifyRemovingResources(JD, K)); if (Err) return Err; } @@ -705,7 +705,8 @@ Error ObjectLinkingLayer::handleRemoveResources(ResourceKey K) { return MemMgr.deallocate(std::move(AllocsToRemove)); } -void ObjectLinkingLayer::handleTransferResources(ResourceKey DstKey, +void ObjectLinkingLayer::handleTransferResources(JITDylib &JD, + ResourceKey DstKey, ResourceKey SrcKey) { auto I = Allocs.find(SrcKey); if (I != Allocs.end()) { @@ -721,7 +722,7 @@ void ObjectLinkingLayer::handleTransferResources(ResourceKey DstKey, } for (auto &P : Plugins) - P->notifyTransferringResources(DstKey, SrcKey); + P->notifyTransferringResources(JD, DstKey, SrcKey); } EHFrameRegistrationPlugin::EHFrameRegistrationPlugin( @@ -773,7 +774,8 @@ Error EHFrameRegistrationPlugin::notifyFailed( return Error::success(); } -Error EHFrameRegistrationPlugin::notifyRemovingResources(ResourceKey K) { +Error EHFrameRegistrationPlugin::notifyRemovingResources(JITDylib &JD, + ResourceKey K) { std::vector RangesToRemove; ES.runSessionLocked([&] { @@ -797,7 +799,7 @@ Error EHFrameRegistrationPlugin::notifyRemovingResources(ResourceKey K) { } void EHFrameRegistrationPlugin::notifyTransferringResources( - ResourceKey DstKey, ResourceKey SrcKey) { + JITDylib &JD, ResourceKey DstKey, ResourceKey SrcKey) { auto SI = EHFrameRanges.find(SrcKey); if (SI == EHFrameRanges.end()) return; -- cgit v1.1