diff options
| author | Lang Hames <lhames@gmail.com> | 2018-12-04 00:55:15 +0000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2018-12-04 00:55:15 +0000 |
| commit | eca6d4b638ecc27fe9054590ca11148981b5c633 (patch) | |
| tree | 98d85138f3a5d607eb16890426bd7a993d0be467 /llvm/lib/ExecutionEngine/OProfileJIT | |
| parent | dc6403d1331cc49ff208ac28b239148c3f40502d (diff) | |
| download | bcm5719-llvm-eca6d4b638ecc27fe9054590ca11148981b5c633.tar.gz bcm5719-llvm-eca6d4b638ecc27fe9054590ca11148981b5c633.zip | |
[ExecutionEngine] Change NotifyObjectEmitted/NotifyObjectFreed API.
This patch renames both methods (NotifyObjectEmitted -> notifyObjectLoaded, and
NotifyObjectFreed -> notifyObjectFreed), adds an abstract "ObjectKey" (uint64_t)
parameter to notifyObjectLoaded, and replaces the ObjectFile parameter for
notifyObjectFreed with an ObjectKey. Using an ObjectKey to track identify
events, rather than a reference to the ObjectFile, allows us to free the
ObjectFile after notifyObjectLoaded is called, saving memory.
https://reviews.llvm.org/D53773
llvm-svn: 348223
Diffstat (limited to 'llvm/lib/ExecutionEngine/OProfileJIT')
| -rw-r--r-- | llvm/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/llvm/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp b/llvm/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp index 6f0825fb38d..21af6b585c4 100644 --- a/llvm/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp +++ b/llvm/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp @@ -40,7 +40,7 @@ class OProfileJITEventListener : public JITEventListener { std::unique_ptr<OProfileWrapper> Wrapper; void initialize(); - std::map<const char*, OwningBinary<ObjectFile>> DebugObjects; + std::map<ObjectKey, OwningBinary<ObjectFile>> DebugObjects; public: OProfileJITEventListener(std::unique_ptr<OProfileWrapper> LibraryWrapper) @@ -50,10 +50,10 @@ public: ~OProfileJITEventListener(); - void NotifyObjectEmitted(const ObjectFile &Obj, - const RuntimeDyld::LoadedObjectInfo &L) override; + void notifyObjectLoaded(ObjectKey Key, const ObjectFile &Obj, + const RuntimeDyld::LoadedObjectInfo &L) override; - void NotifyFreeingObject(const ObjectFile &Obj) override; + void notifyFreeingObject(ObjectKey Key) override; }; void OProfileJITEventListener::initialize() { @@ -78,9 +78,9 @@ OProfileJITEventListener::~OProfileJITEventListener() { } } -void OProfileJITEventListener::NotifyObjectEmitted( - const ObjectFile &Obj, - const RuntimeDyld::LoadedObjectInfo &L) { +void OProfileJITEventListener::notifyObjectLoaded( + ObjectKey Key, const ObjectFile &Obj, + const RuntimeDyld::LoadedObjectInfo &L) { if (!Wrapper->isAgentAvailable()) { return; } @@ -137,18 +137,18 @@ void OProfileJITEventListener::NotifyObjectEmitted( } } - DebugObjects[Obj.getData().data()] = std::move(DebugObjOwner); + DebugObjects[Key] = std::move(DebugObjOwner); } -void OProfileJITEventListener::NotifyFreeingObject(const ObjectFile &Obj) { +void OProfileJITEventListener::notifyFreeingObject(ObjectKey Key) { if (Wrapper->isAgentAvailable()) { // If there was no agent registered when the original object was loaded then // we won't have created a debug object for it, so bail out. - if (DebugObjects.find(Obj.getData().data()) == DebugObjects.end()) + if (DebugObjects.find(Key) == DebugObjects.end()) return; - const ObjectFile &DebugObj = *DebugObjects[Obj.getData().data()].getBinary(); + const ObjectFile &DebugObj = *DebugObjects[Key].getBinary(); // Use symbol info to iterate functions in the object. for (symbol_iterator I = DebugObj.symbol_begin(), @@ -171,7 +171,7 @@ void OProfileJITEventListener::NotifyFreeingObject(const ObjectFile &Obj) { } } - DebugObjects.erase(Obj.getData().data()); + DebugObjects.erase(Key); } } // anonymous namespace. |

