summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
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/MCJIT/MCJIT.cpp
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/MCJIT/MCJIT.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
index 8122ed28b7f..ffc6707e148 100644
--- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
+++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
@@ -95,7 +95,7 @@ MCJIT::~MCJIT() {
for (auto &Obj : LoadedObjects)
if (Obj)
- NotifyFreeingObject(*Obj);
+ notifyFreeingObject(*Obj);
Archives.clear();
}
@@ -119,7 +119,7 @@ void MCJIT::addObjectFile(std::unique_ptr<object::ObjectFile> Obj) {
if (Dyld.hasError())
report_fatal_error(Dyld.getErrorString());
- NotifyObjectEmitted(*Obj, *L);
+ notifyObjectLoaded(*Obj, *L);
LoadedObjects.push_back(std::move(Obj));
}
@@ -226,7 +226,7 @@ void MCJIT::generateCodeForModule(Module *M) {
if (Dyld.hasError())
report_fatal_error(Dyld.getErrorString());
- NotifyObjectEmitted(*LoadedObject.get(), *L);
+ notifyObjectLoaded(*LoadedObject.get(), *L);
Buffers.push_back(std::move(ObjectToLoad));
LoadedObjects.push_back(std::move(*LoadedObject));
@@ -648,19 +648,23 @@ void MCJIT::UnregisterJITEventListener(JITEventListener *L) {
}
}
-void MCJIT::NotifyObjectEmitted(const object::ObjectFile& Obj,
- const RuntimeDyld::LoadedObjectInfo &L) {
+void MCJIT::notifyObjectLoaded(const object::ObjectFile &Obj,
+ const RuntimeDyld::LoadedObjectInfo &L) {
+ uint64_t Key =
+ static_cast<uint64_t>(reinterpret_cast<uintptr_t>(Obj.getData().data()));
MutexGuard locked(lock);
MemMgr->notifyObjectLoaded(this, Obj);
for (unsigned I = 0, S = EventListeners.size(); I < S; ++I) {
- EventListeners[I]->NotifyObjectEmitted(Obj, L);
+ EventListeners[I]->notifyObjectLoaded(Key, Obj, L);
}
}
-void MCJIT::NotifyFreeingObject(const object::ObjectFile& Obj) {
+void MCJIT::notifyFreeingObject(const object::ObjectFile &Obj) {
+ uint64_t Key =
+ static_cast<uint64_t>(reinterpret_cast<uintptr_t>(Obj.getData().data()));
MutexGuard locked(lock);
for (JITEventListener *L : EventListeners)
- L->NotifyFreeingObject(Obj);
+ L->notifyFreeingObject(Key);
}
JITSymbol
OpenPOWER on IntegriCloud