mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-07 11:33:44 +00:00
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
This commit is contained in:
parent
3c92309f0d
commit
af07403c3e
@ -189,6 +189,7 @@ public:
|
||||
///
|
||||
/// MCJIT will take ownership of the ObjectFile.
|
||||
virtual void addObjectFile(std::unique_ptr<object::ObjectFile> O);
|
||||
virtual void addObjectFile(object::OwningBinary<object::ObjectFile> O);
|
||||
|
||||
/// addArchive - Add an Archive to the execution engine.
|
||||
///
|
||||
|
@ -124,6 +124,11 @@ void ExecutionEngine::addObjectFile(std::unique_ptr<object::ObjectFile> O) {
|
||||
llvm_unreachable("ExecutionEngine subclass doesn't implement addObjectFile.");
|
||||
}
|
||||
|
||||
void
|
||||
ExecutionEngine::addObjectFile(object::OwningBinary<object::ObjectFile> O) {
|
||||
llvm_unreachable("ExecutionEngine subclass doesn't implement addObjectFile.");
|
||||
}
|
||||
|
||||
void ExecutionEngine::addArchive(object::OwningBinary<object::Archive> A) {
|
||||
llvm_unreachable("ExecutionEngine subclass doesn't implement addArchive.");
|
||||
}
|
||||
|
@ -107,8 +107,6 @@ bool MCJIT::removeModule(Module *M) {
|
||||
return OwnedModules.removeModule(M);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MCJIT::addObjectFile(std::unique_ptr<object::ObjectFile> Obj) {
|
||||
ObjectImage *LoadedObject = Dyld.loadObject(std::move(Obj));
|
||||
if (!LoadedObject || Dyld.hasError())
|
||||
@ -119,11 +117,15 @@ void MCJIT::addObjectFile(std::unique_ptr<object::ObjectFile> Obj) {
|
||||
NotifyObjectEmitted(*LoadedObject);
|
||||
}
|
||||
|
||||
void MCJIT::addObjectFile(object::OwningBinary<object::ObjectFile> Obj) {
|
||||
addObjectFile(std::move(Obj.getBinary()));
|
||||
Buffers.push_back(std::move(Obj.getBuffer()));
|
||||
}
|
||||
|
||||
void MCJIT::addArchive(object::OwningBinary<object::Archive> A) {
|
||||
Archives.push_back(std::move(A));
|
||||
}
|
||||
|
||||
|
||||
void MCJIT::setObjectCache(ObjectCache* NewCache) {
|
||||
MutexGuard locked(lock);
|
||||
ObjCache = NewCache;
|
||||
|
@ -217,6 +217,7 @@ class MCJIT : public ExecutionEngine {
|
||||
OwningModuleContainer OwnedModules;
|
||||
|
||||
SmallVector<object::OwningBinary<object::Archive>, 2> Archives;
|
||||
SmallVector<std::unique_ptr<MemoryBuffer>, 2> Buffers;
|
||||
|
||||
typedef SmallVector<ObjectImage *, 2> LoadedObjectList;
|
||||
LoadedObjectList LoadedObjects;
|
||||
@ -240,6 +241,7 @@ public:
|
||||
/// @{
|
||||
void addModule(std::unique_ptr<Module> M) override;
|
||||
void addObjectFile(std::unique_ptr<object::ObjectFile> O) override;
|
||||
void addObjectFile(object::OwningBinary<object::ObjectFile> O) override;
|
||||
void addArchive(object::OwningBinary<object::Archive> O) override;
|
||||
bool removeModule(Module *M) override;
|
||||
|
||||
|
@ -529,7 +529,6 @@ int main(int argc, char **argv, char * const *envp) {
|
||||
EE->addModule(std::move(XMod));
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<MemoryBuffer>> Buffers;
|
||||
for (unsigned i = 0, e = ExtraObjects.size(); i != e; ++i) {
|
||||
ErrorOr<object::OwningBinary<object::ObjectFile>> Obj =
|
||||
object::ObjectFile::createObjectFile(ExtraObjects[i]);
|
||||
@ -538,8 +537,7 @@ int main(int argc, char **argv, char * const *envp) {
|
||||
return 1;
|
||||
}
|
||||
object::OwningBinary<object::ObjectFile> &O = Obj.get();
|
||||
EE->addObjectFile(std::move(O.getBinary()));
|
||||
Buffers.push_back(std::move(O.getBuffer()));
|
||||
EE->addObjectFile(std::move(O));
|
||||
}
|
||||
|
||||
for (unsigned i = 0, e = ExtraArchives.size(); i != e; ++i) {
|
||||
|
Loading…
Reference in New Issue
Block a user