llvm.org GIT mirror llvm / 60789e4
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62864 91177308-0d34-0410-b5e6-96231b3b80d8 Nate Begeman 11 years ago
4 changed file(s) with 48 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
142142
143143
144144 /// removeModuleProvider - Remove a ModuleProvider from the list of modules.
145 /// Release module from ModuleProvider.
145 /// Relases the Module from the ModuleProvider, materializing it in the
146 /// process, and returns the materialized Module.
146147 virtual Module* removeModuleProvider(ModuleProvider *P,
147148 std::string *ErrInfo = 0);
149
150 /// deleteModuleProvider - Remove a ModuleProvider from the list of modules,
151 /// and deletes the ModuleProvider and owned Module. Avoids materializing
152 /// the underlying module.
153 virtual void deleteModuleProvider(ModuleProvider *P,std::string *ErrInfo = 0);
148154
149155 /// FindFunctionNamed - Search all of the active modules to find the one that
150156 /// defines FnName. This is very slow operation and shouldn't be used for
5858 }
5959
6060 /// removeModuleProvider - Remove a ModuleProvider from the list of modules.
61 /// Release module from ModuleProvider.
61 /// Relases the Module from the ModuleProvider, materializing it in the
62 /// process, and returns the materialized Module.
6263 Module* ExecutionEngine::removeModuleProvider(ModuleProvider *P,
6364 std::string *ErrInfo) {
6465 for(SmallVector::iterator I = Modules.begin(),
7172 }
7273 }
7374 return NULL;
75 }
76
77 /// deleteModuleProvider - Remove a ModuleProvider from the list of modules,
78 /// and deletes the ModuleProvider and owned Module. Avoids materializing
79 /// the underlying module.
80 void ExecutionEngine::deleteModuleProvider(ModuleProvider *P,
81 std::string *ErrInfo) {
82 for(SmallVector::iterator I = Modules.begin(),
83 E = Modules.end(); I != E; ++I) {
84 ModuleProvider *MP = *I;
85 if (MP == P) {
86 Modules.erase(I);
87 clearGlobalMappingsFromModule(MP->getModule());
88 delete MP;
89 return;
90 }
91 }
7492 }
7593
7694 /// FindFunctionNamed - Search all of the active modules to find the one that
294294 }
295295
296296 return result;
297 }
298
299 /// deleteModuleProvider - Remove a ModuleProvider from the list of modules,
300 /// and deletes the ModuleProvider and owned Module. Avoids materializing
301 /// the underlying module.
302 void JIT::deleteModuleProvider(ModuleProvider *MP, std::string *E) {
303 ExecutionEngine::deleteModuleProvider(MP, E);
304
305 MutexGuard locked(lock);
306 if (Modules.empty()) {
307 delete jitstate;
308 jitstate = 0;
309 }
297310 }
298311
299312 /// run - Start execution with the specified function and arguments.
7676 }
7777
7878 virtual void addModuleProvider(ModuleProvider *MP);
79
80 /// removeModuleProvider - Remove a ModuleProvider from the list of modules.
81 /// Relases the Module from the ModuleProvider, materializing it in the
82 /// process, and returns the materialized Module.
7983 virtual Module *removeModuleProvider(ModuleProvider *MP,
8084 std::string *ErrInfo = 0);
85
86 /// deleteModuleProvider - Remove a ModuleProvider from the list of modules,
87 /// and deletes the ModuleProvider and owned Module. Avoids materializing
88 /// the underlying module.
89 virtual void deleteModuleProvider(ModuleProvider *P,std::string *ErrInfo = 0);
8190
8291 /// runFunction - Start execution with the specified function and arguments.
8392 ///