X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FExecutionEngine%2FOrc%2FOrcRemoteTargetClient.h;h=d1bbaf34137b6ed7e51fe4f1e6494ec8753b2bb9;hp=20e26469fbb17ba3e421a977ee75d4637131dcb3;hb=dab4109a7b96faf3e82acf0dae91347b3554a575;hpb=c45bf3b4bfda473198584d2e196bef0202f98029 diff --git a/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h b/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h index 20e26469fbb..d1bbaf34137 100644 --- a/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h +++ b/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h @@ -44,6 +44,19 @@ public: DEBUG(dbgs() << "Created remote allocator " << Id << "\n"); } + RCMemoryManager(RCMemoryManager &&Other) + : Client(std::move(Other.Client)), Id(std::move(Other.Id)), + Unmapped(std::move(Other.Unmapped)), + Unfinalized(std::move(Other.Unfinalized)) {} + + RCMemoryManager operator=(RCMemoryManager &&Other) { + Client = std::move(Other.Client); + Id = std::move(Other.Id); + Unmapped = std::move(Other.Unmapped); + Unfinalized = std::move(Other.Unfinalized); + return *this; + } + ~RCMemoryManager() { Client.destroyRemoteAllocator(Id); DEBUG(dbgs() << "Destroyed remote allocator " << Id << "\n"); @@ -92,12 +105,11 @@ public: DEBUG(dbgs() << "Allocator " << Id << " reserved:\n"); if (CodeSize != 0) { - if (std::error_code EC = Client.reserveMem( - Unmapped.back().RemoteCodeAddr, Id, CodeSize, CodeAlign)) { - (void)EC; - // FIXME; Add error to poll. - llvm_unreachable("Failed reserving remote memory."); - } + std::error_code EC = Client.reserveMem( + Unmapped.back().RemoteCodeAddr, Id, CodeSize, CodeAlign); + // FIXME; Add error to poll. + assert(!EC && "Failed reserving remote memory."); + (void)EC; DEBUG(dbgs() << " code: " << format("0x%016x", Unmapped.back().RemoteCodeAddr) << " (" << CodeSize << " bytes, alignment " << CodeAlign @@ -105,11 +117,12 @@ public: } if (RODataSize != 0) { - if (auto EC = Client.reserveMem(Unmapped.back().RemoteRODataAddr, Id, - RODataSize, RODataAlign)) { - // FIXME; Add error to poll. - llvm_unreachable("Failed reserving remote memory."); - } + std::error_code EC = + Client.reserveMem(Unmapped.back().RemoteRODataAddr, Id, + RODataSize, RODataAlign); + // FIXME; Add error to poll. + assert(!EC && "Failed reserving remote memory."); + (void)EC; DEBUG(dbgs() << " ro-data: " << format("0x%016x", Unmapped.back().RemoteRODataAddr) << " (" << RODataSize << " bytes, alignment " @@ -117,11 +130,12 @@ public: } if (RWDataSize != 0) { - if (auto EC = Client.reserveMem(Unmapped.back().RemoteRWDataAddr, Id, - RWDataSize, RWDataAlign)) { - // FIXME; Add error to poll. - llvm_unreachable("Failed reserving remote memory."); - } + std::error_code EC = + Client.reserveMem(Unmapped.back().RemoteRWDataAddr, Id, + RWDataSize, RWDataAlign); + // FIXME; Add error to poll. + assert(!EC && "Failed reserving remote memory."); + (void)EC; DEBUG(dbgs() << " rw-data: " << format("0x%016x", Unmapped.back().RemoteRWDataAddr) << " (" << RWDataSize << " bytes, alignment " @@ -253,9 +267,6 @@ public: : Size(Size), Align(Align), Contents(new char[Size + Align - 1]), RemoteAddr(0) {} - Alloc(const Alloc&) = delete; - Alloc& operator=(const Alloc&) = delete; - Alloc(Alloc &&Other) : Size(std::move(Other.Size)), Align(std::move(Other.Align)), Contents(std::move(Other.Contents)), @@ -295,6 +306,25 @@ public: struct ObjectAllocs { ObjectAllocs() : RemoteCodeAddr(0), RemoteRODataAddr(0), RemoteRWDataAddr(0) {} + + ObjectAllocs(ObjectAllocs &&Other) + : RemoteCodeAddr(std::move(Other.RemoteCodeAddr)), + RemoteRODataAddr(std::move(Other.RemoteRODataAddr)), + RemoteRWDataAddr(std::move(Other.RemoteRWDataAddr)), + CodeAllocs(std::move(Other.CodeAllocs)), + RODataAllocs(std::move(Other.RODataAllocs)), + RWDataAllocs(std::move(Other.RWDataAllocs)) {} + + ObjectAllocs &operator=(ObjectAllocs &&Other) { + RemoteCodeAddr = std::move(Other.RemoteCodeAddr); + RemoteRODataAddr = std::move(Other.RemoteRODataAddr); + RemoteRWDataAddr = std::move(Other.RemoteRWDataAddr); + CodeAllocs = std::move(Other.CodeAllocs); + RODataAllocs = std::move(Other.RODataAllocs); + RWDataAllocs = std::move(Other.RWDataAllocs); + return *this; + } + TargetAddress RemoteCodeAddr; TargetAddress RemoteRODataAddr; TargetAddress RemoteRWDataAddr;