summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/IntelJITEvents
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2018-12-04 00:55:15 +0000
committerLang Hames <lhames@gmail.com>2018-12-04 00:55:15 +0000
commiteca6d4b638ecc27fe9054590ca11148981b5c633 (patch)
tree98d85138f3a5d607eb16890426bd7a993d0be467 /llvm/lib/ExecutionEngine/IntelJITEvents
parentdc6403d1331cc49ff208ac28b239148c3f40502d (diff)
downloadbcm5719-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/IntelJITEvents')
-rw-r--r--llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp b/llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
index 211f5216811..e9051c19850 100644
--- a/llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
+++ b/llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
@@ -47,7 +47,7 @@ class IntelJITEventListener : public JITEventListener {
typedef DenseMap<const void *, MethodAddressVector> ObjectMap;
ObjectMap LoadedObjectMap;
- std::map<const char*, OwningBinary<ObjectFile>> DebugObjects;
+ std::map<ObjectKey, OwningBinary<ObjectFile>> DebugObjects;
public:
IntelJITEventListener(IntelJITEventsWrapper* libraryWrapper) {
@@ -57,10 +57,10 @@ public:
~IntelJITEventListener() {
}
- 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;
};
static LineNumberInfo DILineInfoToIntelJITFormat(uintptr_t StartAddress,
@@ -96,9 +96,9 @@ static iJIT_Method_Load FunctionDescToIntelJITFormat(
return Result;
}
-void IntelJITEventListener::NotifyObjectEmitted(
- const ObjectFile &Obj,
- const RuntimeDyld::LoadedObjectInfo &L) {
+void IntelJITEventListener::notifyObjectLoaded(
+ ObjectKey Key, const ObjectFile &Obj,
+ const RuntimeDyld::LoadedObjectInfo &L) {
OwningBinary<ObjectFile> DebugObjOwner = L.getObjectForDebug(Obj);
const ObjectFile *DebugObj = DebugObjOwner.getBinary();
@@ -188,17 +188,17 @@ void IntelJITEventListener::NotifyObjectEmitted(
// registered function addresses for each loaded object. We will
// use the MethodIDs map to get the registered ID for each function.
LoadedObjectMap[ObjData] = Functions;
- DebugObjects[Obj.getData().data()] = std::move(DebugObjOwner);
+ DebugObjects[Key] = std::move(DebugObjOwner);
}
-void IntelJITEventListener::NotifyFreeingObject(const ObjectFile &Obj) {
+void IntelJITEventListener::notifyFreeingObject(ObjectKey Key) {
// This object may not have been registered with the listener. If it wasn't,
// bail out.
- if (DebugObjects.find(Obj.getData().data()) == DebugObjects.end())
+ if (DebugObjects.find(Key) == DebugObjects.end())
return;
// Get the address of the object image for use as a unique identifier
- const ObjectFile &DebugObj = *DebugObjects[Obj.getData().data()].getBinary();
+ const ObjectFile &DebugObj = *DebugObjects[Key].getBinary();
const void* ObjData = DebugObj.getData().data();
// Get the object's function list from LoadedObjectMap
@@ -223,7 +223,7 @@ void IntelJITEventListener::NotifyFreeingObject(const ObjectFile &Obj) {
// Erase the object from LoadedObjectMap
LoadedObjectMap.erase(OI);
- DebugObjects.erase(Obj.getData().data());
+ DebugObjects.erase(Key);
}
} // anonymous namespace.
OpenPOWER on IntegriCloud