From: Lang Hames Date: Wed, 28 Oct 2015 22:10:27 +0000 (+0000) Subject: [Orc] Remove the 'takeOwnershipOfBuffers' kludge. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=4198d74ec84c5859aeb57318ed3c7a865d832be4 [Orc] Remove the 'takeOwnershipOfBuffers' kludge. Keno Fischer fixed the underlying issue that necessitated this in r236341. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251560 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h b/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h index 63790220078..e4bed95fdab 100644 --- a/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h +++ b/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h @@ -85,8 +85,6 @@ public: ModuleSetHandleT H = BaseLayer.addObjectSet(Objects, std::move(MemMgr), std::move(Resolver)); - BaseLayer.takeOwnershipOfBuffers(H, std::move(Buffers)); - return H; } diff --git a/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h b/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h index f3094dafae3..5ba0bb21afd 100644 --- a/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h +++ b/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h @@ -64,18 +64,9 @@ protected: RTDyld->mapSectionAddress(LocalAddress, TargetAddr); } - void takeOwnershipOfBuffer(std::unique_ptr B) { - OwnedBuffers.push_back(std::move(B)); - } - protected: std::unique_ptr RTDyld; enum { Raw, Finalizing, Finalized } State; - - // FIXME: This ownership hack only exists because RuntimeDyldELF still - // wants to be able to inspect the original object when resolving - // relocations. As soon as that can be fixed this should be removed. - std::vector> OwnedBuffers; }; typedef std::list> LinkedObjectSetListT; @@ -83,16 +74,6 @@ protected: public: /// @brief Handle to a set of loaded objects. typedef LinkedObjectSetListT::iterator ObjSetHandleT; - - // Ownership hack. - // FIXME: Remove this as soon as RuntimeDyldELF can apply relocations without - // referencing the original object. - template - void takeOwnershipOfBuffers(ObjSetHandleT H, OwningMBSet MBs) { - for (auto &MB : MBs) - (*H)->takeOwnershipOfBuffer(std::move(MB)); - } - }; /// @brief Default (no-op) action to perform when loading objects. @@ -126,7 +107,6 @@ private: RTDyld->resolveRelocations(); RTDyld->registerEHFrames(); MemMgr->finalizeMemory(); - OwnedBuffers.clear(); State = Finalized; } diff --git a/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h b/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h index 951993f75e4..42770fcdcae 100644 --- a/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h +++ b/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h @@ -175,12 +175,7 @@ public: std::tie(Obj, Buf) = O.takeBinary(); std::vector> Objs; Objs.push_back(std::move(Obj)); - auto H = - ObjectLayer.addObjectSet(std::move(Objs), &MemMgr, &Resolver); - - std::vector> Bufs; - Bufs.push_back(std::move(Buf)); - ObjectLayer.takeOwnershipOfBuffers(H, std::move(Bufs)); + ObjectLayer.addObjectSet(std::move(Objs), &MemMgr, &Resolver); } void addArchive(object::OwningBinary A) override {