llvm.org GIT mirror llvm / af07403
Give ExecutionEngine of top level buffers. Long term the idea if for the engine to not own the buffers, but for now this is consistent with the rest of the API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216484 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
5 changed file(s) with 14 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
188188 ///
189189 /// MCJIT will take ownership of the ObjectFile.
190190 virtual void addObjectFile(std::unique_ptr O);
191 virtual void addObjectFile(object::OwningBinary O);
191192
192193 /// addArchive - Add an Archive to the execution engine.
193194 ///
120120 }
121121
122122 void ExecutionEngine::addObjectFile(std::unique_ptr O) {
123 llvm_unreachable("ExecutionEngine subclass doesn't implement addObjectFile.");
124 }
125
126 void
127 ExecutionEngine::addObjectFile(object::OwningBinary O) {
123128 llvm_unreachable("ExecutionEngine subclass doesn't implement addObjectFile.");
124129 }
125130
106106 return OwnedModules.removeModule(M);
107107 }
108108
109
110
111109 void MCJIT::addObjectFile(std::unique_ptr Obj) {
112110 ObjectImage *LoadedObject = Dyld.loadObject(std::move(Obj));
113111 if (!LoadedObject || Dyld.hasError())
118116 NotifyObjectEmitted(*LoadedObject);
119117 }
120118
119 void MCJIT::addObjectFile(object::OwningBinary Obj) {
120 addObjectFile(std::move(Obj.getBinary()));
121 Buffers.push_back(std::move(Obj.getBuffer()));
122 }
123
121124 void MCJIT::addArchive(object::OwningBinary A) {
122125 Archives.push_back(std::move(A));
123126 }
124
125127
126128 void MCJIT::setObjectCache(ObjectCache* NewCache) {
127129 MutexGuard locked(lock);
216216 OwningModuleContainer OwnedModules;
217217
218218 SmallVector, 2> Archives;
219 SmallVector, 2> Buffers;
219220
220221 typedef SmallVector LoadedObjectList;
221222 LoadedObjectList LoadedObjects;
239240 /// @{
240241 void addModule(std::unique_ptr M) override;
241242 void addObjectFile(std::unique_ptr O) override;
243 void addObjectFile(object::OwningBinary O) override;
242244 void addArchive(object::OwningBinary O) override;
243245 bool removeModule(Module *M) override;
244246
528528 EE->addModule(std::move(XMod));
529529 }
530530
531 std::vector> Buffers;
532531 for (unsigned i = 0, e = ExtraObjects.size(); i != e; ++i) {
533532 ErrorOr> Obj =
534533 object::ObjectFile::createObjectFile(ExtraObjects[i]);
537536 return 1;
538537 }
539538 object::OwningBinary &O = Obj.get();
540 EE->addObjectFile(std::move(O.getBinary()));
541 Buffers.push_back(std::move(O.getBuffer()));
539 EE->addObjectFile(std::move(O));
542540 }
543541
544542 for (unsigned i = 0, e = ExtraArchives.size(); i != e; ++i) {