diff options
author | Nate Begeman <natebegeman@mac.com> | 2009-01-23 19:27:28 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2009-01-23 19:27:28 +0000 |
commit | 617001d84279f075a09e236f7002d58572c1192b (patch) | |
tree | 65008251f32b277a587fa61ecb87cac7c1581564 /llvm/lib/ExecutionEngine/ExecutionEngine.cpp | |
parent | dd7aa3789576b484e3ae7e5fd0ba53984b5ce000 (diff) | |
download | bcm5719-llvm-617001d84279f075a09e236f7002d58572c1192b.tar.gz bcm5719-llvm-617001d84279f075a09e236f7002d58572c1192b.zip |
Add support for deleting a module provider from a JIT in such a way that it does not cause the owned module to be fully materialized.
llvm-svn: 62864
Diffstat (limited to 'llvm/lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index d1a406c9960..9fea1f5753f 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -59,7 +59,8 @@ char* ExecutionEngine::getMemoryForGV(const GlobalVariable* GV) { } /// removeModuleProvider - Remove a ModuleProvider from the list of modules. -/// Release module from ModuleProvider. +/// Relases the Module from the ModuleProvider, materializing it in the +/// process, and returns the materialized Module. Module* ExecutionEngine::removeModuleProvider(ModuleProvider *P, std::string *ErrInfo) { for(SmallVector<ModuleProvider *, 1>::iterator I = Modules.begin(), @@ -74,6 +75,23 @@ Module* ExecutionEngine::removeModuleProvider(ModuleProvider *P, return NULL; } +/// deleteModuleProvider - Remove a ModuleProvider from the list of modules, +/// and deletes the ModuleProvider and owned Module. Avoids materializing +/// the underlying module. +void ExecutionEngine::deleteModuleProvider(ModuleProvider *P, + std::string *ErrInfo) { + for(SmallVector<ModuleProvider *, 1>::iterator I = Modules.begin(), + E = Modules.end(); I != E; ++I) { + ModuleProvider *MP = *I; + if (MP == P) { + Modules.erase(I); + clearGlobalMappingsFromModule(MP->getModule()); + delete MP; + return; + } + } +} + /// FindFunctionNamed - Search all of the active modules to find the one that /// defines FnName. This is very slow operation and shouldn't be used for /// general code. |