[PATCH] D61065: [JITLink] Pass ObjectFile in NotifyLoaded() for JITEventListener support
Stefan Gränitz via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 25 03:28:19 PDT 2019
sgraenitz updated this revision to Diff 196606.
sgraenitz added a comment.
For illustration: pass ownership to ObjectLinkingLayer and hand out a MemBufferRef in NotifyLoaded
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61065/new/
https://reviews.llvm.org/D61065
Files:
llvm/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
Index: llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
+++ llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
@@ -132,9 +132,7 @@
return notifyFailed(std::move(Err));
MR.resolve(InternedResult);
-
- if (Layer.NotifyLoaded)
- Layer.NotifyLoaded(MR.getVModuleKey());
+ Layer.notifyLoaded(MR.getVModuleKey(), std::move(ObjBuffer));
}
void notifyFinalized(
Index: llvm/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
===================================================================
--- llvm/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
+++ llvm/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
@@ -46,7 +46,7 @@
public:
/// Function object for receiving object-loaded notifications.
- using NotifyLoadedFunction = std::function<void(VModuleKey)>;
+ using NotifyLoadedFunction = std::function<void(VModuleKey, MemoryBufferRef)>;
/// Function object for receiving finalization notifications.
using NotifyEmittedFunction = std::function<void(VModuleKey)>;
@@ -114,6 +114,13 @@
JITTargetAddress EHFrameAddr = 0;
};
+ void notifyLoaded(VModuleKey K, std::unique_ptr<MemoryBuffer> O) {
+ ObjBuffers.push_back(std::move(O)); // FIXME: avoid deletion
+
+ if (NotifyLoaded)
+ NotifyLoaded(K, ObjBuffers.back()->getMemBufferRef());
+ }
+
void notifyFinalized(ObjectResources OR) {
ObjResources.push_back(std::move(OR));
}
@@ -126,6 +133,7 @@
bool OverrideObjectFlags = false;
bool AutoClaimObjectSymbols = false;
std::vector<ObjectResources> ObjResources;
+ std::vector<std::unique_ptr<MemoryBuffer>> ObjBuffers; // FIXME: add to ObjResources?
};
} // end namespace orc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61065.196606.patch
Type: text/x-patch
Size: 1807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190425/d7cdf6a0/attachment.bin>
More information about the llvm-commits
mailing list