X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FExecutionEngine%2FOrc%2FOrcMCJITReplacement.h;h=ddbc73251c7eee4c83224fe84600f9b3b32df551;hp=9fdf0efdd9084b2fbf19e456bced1272f0e75746;hb=41367e252a806c1dfa36479d09643b3ac93a7263;hpb=63cc4f56a92d80148009381616897c7a1836c296 diff --git a/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h b/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h index 9fdf0efdd90..ddbc73251c7 100644 --- a/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h +++ b/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h @@ -20,7 +20,6 @@ #include "llvm/ExecutionEngine/Orc/LazyEmittingLayer.h" #include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h" #include "llvm/Object/Archive.h" -#include "llvm/Target/TargetSubtargetInfo.h" namespace llvm { @@ -119,25 +118,25 @@ public: OrcMCJITReplacement(std::unique_ptr MM, std::unique_ptr TM) - : TM(std::move(TM)), MM(std::move(MM)), - Mang(this->TM->getSubtargetImpl()->getDataLayout()), + : TM(std::move(TM)), MM(std::move(MM)), Mang(this->TM->getDataLayout()), NotifyObjectLoaded(*this), NotifyFinalized(*this), - ObjectLayer(NotifyObjectLoaded, NotifyFinalized), + ObjectLayer(ObjectLayerT::CreateRTDyldMMFtor(), NotifyObjectLoaded, + NotifyFinalized), CompileLayer(ObjectLayer, SimpleCompiler(*this->TM)), LazyEmitLayer(CompileLayer) { - setDataLayout(this->TM->getSubtargetImpl()->getDataLayout()); + setDataLayout(this->TM->getDataLayout()); } - void addModule(std::unique_ptr M) { + void addModule(std::unique_ptr M) override { // If this module doesn't have a DataLayout attached then attach the // default. if (!M->getDataLayout()) M->setDataLayout(getDataLayout()); - OwnedModules.push_back(std::move(M)); + Modules.push_back(std::move(M)); std::vector Ms; - Ms.push_back(&*OwnedModules.back()); + Ms.push_back(&*Modules.back()); LazyEmitLayer.addModuleSet(std::move(Ms), llvm::make_unique(*this)); } @@ -155,8 +154,13 @@ public: std::tie(Obj, Buf) = O.takeBinary(); std::vector> Objs; Objs.push_back(std::move(Obj)); - ObjectLayer.addObjectSet(std::move(Objs), - llvm::make_unique(*this)); + auto H = + ObjectLayer.addObjectSet(std::move(Objs), + llvm::make_unique(*this)); + + std::vector> Bufs; + Bufs.push_back(std::move(Buf)); + ObjectLayer.takeOwnershipOfBuffers(H, std::move(Bufs)); } void addArchive(object::OwningBinary A) override { @@ -257,7 +261,7 @@ private: const ObjListT &Objects, const LoadedObjInfoListT &Infos) const { M.UnfinalizedSections[H] = std::move(M.SectionsAllocatedSinceLastLoad); - M.SectionsAllocatedSinceLastLoad = {}; + M.SectionsAllocatedSinceLastLoad = SectionAddrSet(); assert(Objects.size() == Infos.size() && "Incorrect number of Infos for Objects."); for (unsigned I = 0; I < Objects.size(); ++I) @@ -303,10 +307,6 @@ private: CompileLayerT CompileLayer; LazyEmitLayerT LazyEmitLayer; - // MCJIT keeps modules alive - we need to do the same for backwards - // compatibility. - std::vector> OwnedModules; - // We need to store ObjLayerT::ObjSetHandles for each of the object sets // that have been emitted but not yet finalized so that we can forward the // mapSectionAddress calls appropriately.