#ifndef LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETCLIENT_H
#define LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETCLIENT_H
+#include "IndirectionUtils.h"
#include "OrcRemoteTargetRPCAPI.h"
+#include <system_error>
#define DEBUG_TYPE "orc-remote"
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");
DEBUG(dbgs() << "Allocator " << Id << " reserved:\n");
if (CodeSize != 0) {
- if (auto EC = Client.reserveMem(Unmapped.back().RemoteCodeAddr, Id,
- CodeSize, CodeAlign)) {
+ 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.");
}
: 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)),
+ RemoteAddr(std::move(Other.RemoteAddr)) {}
+
+ Alloc &operator=(Alloc &&Other) {
+ Size = std::move(Other.Size);
+ Align = std::move(Other.Align);
+ Contents = std::move(Other.Contents);
+ RemoteAddr = std::move(Other.RemoteAddr);
+ return *this;
+ }
+
uint64_t getSize() const { return Size; }
unsigned getAlign() const { return Align; }
if (auto EC = call<ReserveMem>(Channel, Id, Size, Align))
return EC;
- if (auto EC = expect<ReserveMemResponse>(Channel, [&](TargetAddress Addr) {
- RemoteAddr = Addr;
- return std::error_code();
- }))
+ if (std::error_code EC =
+ expect<ReserveMemResponse>(Channel, [&](TargetAddress Addr) {
+ RemoteAddr = Addr;
+ return std::error_code();
+ }))
return EC;
return std::error_code();