[Orc] Remove the 'takeOwnershipOfBuffers' kludge.
authorLang Hames <lhames@gmail.com>
Wed, 28 Oct 2015 22:10:27 +0000 (22:10 +0000)
committerLang Hames <lhames@gmail.com>
Wed, 28 Oct 2015 22:10:27 +0000 (22:10 +0000)
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

include/llvm/ExecutionEngine/Orc/IRCompileLayer.h
include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
lib/ExecutionEngine/Orc/OrcMCJITReplacement.h

index 637902200786e914b22d2013be40431e290bef83..e4bed95fdabf6ee239b69cc54c4b0546aaf679b1 100644 (file)
@@ -85,8 +85,6 @@ public:
     ModuleSetHandleT H =
       BaseLayer.addObjectSet(Objects, std::move(MemMgr), std::move(Resolver));
 
-    BaseLayer.takeOwnershipOfBuffers(H, std::move(Buffers));
-
     return H;
   }
 
index f3094dafae3c314740fe5f4720f6d07d6dc68423..5ba0bb21afd8d1d8bb9f8683eedfe5fcdda58f73 100644 (file)
@@ -64,18 +64,9 @@ protected:
       RTDyld->mapSectionAddress(LocalAddress, TargetAddr);
     }
 
-    void takeOwnershipOfBuffer(std::unique_ptr<MemoryBuffer> B) {
-      OwnedBuffers.push_back(std::move(B));
-    }
-
   protected:
     std::unique_ptr<RuntimeDyld> 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<std::unique_ptr<MemoryBuffer>> OwnedBuffers;
   };
 
   typedef std::list<std::unique_ptr<LinkedObjectSet>> 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 <typename OwningMBSet>
-  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;
     }
 
index 951993f75e4ceb2a0f173f579ce50e230079899d..42770fcdcae77358610ca4e5fce6865c93cb40d8 100644 (file)
@@ -175,12 +175,7 @@ public:
     std::tie(Obj, Buf) = O.takeBinary();
     std::vector<std::unique_ptr<object::ObjectFile>> Objs;
     Objs.push_back(std::move(Obj));
-    auto H =
-      ObjectLayer.addObjectSet(std::move(Objs), &MemMgr, &Resolver);
-
-    std::vector<std::unique_ptr<MemoryBuffer>> Bufs;
-    Bufs.push_back(std::move(Buf));
-    ObjectLayer.takeOwnershipOfBuffers(H, std::move(Bufs));
+    ObjectLayer.addObjectSet(std::move(Objs), &MemMgr, &Resolver);
   }
 
   void addArchive(object::OwningBinary<object::Archive> A) override {