LLVM  13.0.0git
OrcRPCTargetProcessControl.h
Go to the documentation of this file.
1 //===--- OrcRPCTargetProcessControl.h - Remote target control ---*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Utilities for interacting with target processes.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_EXECUTIONENGINE_ORC_ORCRPCTARGETPROCESSCONTROL_H
14 #define LLVM_EXECUTIONENGINE_ORC_ORCRPCTARGETPROCESSCONTROL_H
15 
21 
22 namespace llvm {
23 namespace orc {
24 
25 /// JITLinkMemoryManager implementation for a process connected via an ORC RPC
26 /// endpoint.
27 template <typename OrcRPCTPCImplT>
29 private:
30  struct HostAlloc {
31  std::unique_ptr<char[]> Mem;
32  uint64_t Size;
33  };
34 
35  struct TargetAlloc {
37  uint64_t AllocatedSize = 0;
38  };
39 
42 
43 public:
44  class OrcRPCAllocation : public Allocation {
45  public:
47  HostAllocMap HostAllocs, TargetAllocMap TargetAllocs)
48  : Parent(Parent), HostAllocs(std::move(HostAllocs)),
49  TargetAllocs(std::move(TargetAllocs)) {
50  assert(HostAllocs.size() == TargetAllocs.size() &&
51  "HostAllocs size should match TargetAllocs");
52  }
53 
54  ~OrcRPCAllocation() override {
55  assert(TargetAllocs.empty() && "failed to deallocate");
56  }
57 
59  auto I = HostAllocs.find(Seg);
60  assert(I != HostAllocs.end() && "No host allocation for segment");
61  auto &HA = I->second;
62  return {HA.Mem.get(), static_cast<size_t>(HA.Size)};
63  }
64 
66  auto I = TargetAllocs.find(Seg);
67  assert(I != TargetAllocs.end() && "No target allocation for segment");
68  return I->second.Address;
69  }
70 
71  void finalizeAsync(FinalizeContinuation OnFinalize) override {
72 
73  std::vector<tpctypes::BufferWrite> BufferWrites;
75 
76  for (auto &KV : HostAllocs) {
77  assert(TargetAllocs.count(KV.first) &&
78  "No target allocation for buffer");
79  auto &HA = KV.second;
80  auto &TA = TargetAllocs[KV.first];
81  BufferWrites.push_back({TA.Address, StringRef(HA.Mem.get(), HA.Size)});
82  FMR.push_back({orcrpctpc::toWireProtectionFlags(
83  static_cast<sys::Memory::ProtectionFlags>(KV.first)),
84  TA.Address, TA.AllocatedSize});
85  }
86 
87  DEBUG_WITH_TYPE("orc", {
88  dbgs() << "finalizeAsync " << (void *)this << ":\n";
89  auto FMRI = FMR.begin();
90  for (auto &B : BufferWrites) {
91  auto Prot = FMRI->Prot;
92  ++FMRI;
93  dbgs() << " Writing " << formatv("{0:x16}", B.Buffer.size())
94  << " bytes to " << ((Prot & orcrpctpc::WPF_Read) ? 'R' : '-')
95  << ((Prot & orcrpctpc::WPF_Write) ? 'W' : '-')
96  << ((Prot & orcrpctpc::WPF_Exec) ? 'X' : '-')
97  << " segment: local " << (const void *)B.Buffer.data()
98  << " -> target " << formatv("{0:x16}", B.Address) << "\n";
99  }
100  });
101  if (auto Err =
102  Parent.Parent.getMemoryAccess().writeBuffers(BufferWrites)) {
103  OnFinalize(std::move(Err));
104  return;
105  }
106 
107  DEBUG_WITH_TYPE("orc", dbgs() << " Applying permissions...\n");
108  if (auto Err =
109  Parent.getEndpoint().template callAsync<orcrpctpc::FinalizeMem>(
110  [OF = std::move(OnFinalize)](Error Err2) {
111  // FIXME: Dispatch to work queue.
112  std::thread([OF = std::move(OF),
113  Err3 = std::move(Err2)]() mutable {
114  DEBUG_WITH_TYPE(
115  "orc", { dbgs() << " finalizeAsync complete\n"; });
116  OF(std::move(Err3));
117  }).detach();
118  return Error::success();
119  },
120  FMR)) {
121  DEBUG_WITH_TYPE("orc", dbgs() << " failed.\n");
122  Parent.getEndpoint().abandonPendingResponses();
123  Parent.reportError(std::move(Err));
124  }
125  DEBUG_WITH_TYPE("orc", {
126  dbgs() << "Leaving finalizeAsync (finalization may continue in "
127  "background)\n";
128  });
129  }
130 
131  Error deallocate() override {
133  for (auto &KV : TargetAllocs)
134  RMR.push_back({orcrpctpc::toWireProtectionFlags(
135  static_cast<sys::Memory::ProtectionFlags>(KV.first)),
136  KV.second.Address, KV.second.AllocatedSize});
137  TargetAllocs.clear();
138 
139  return Parent.getEndpoint().template callB<orcrpctpc::ReleaseMem>(RMR);
140  }
141 
142  private:
144  HostAllocMap HostAllocs;
145  TargetAllocMap TargetAllocs;
146  };
147 
148  OrcRPCTPCJITLinkMemoryManager(OrcRPCTPCImplT &Parent) : Parent(Parent) {}
149 
152  const SegmentsRequestMap &Request) override {
154  HostAllocMap HostAllocs;
155 
156  for (auto &KV : Request) {
157  assert(KV.second.getContentSize() <= std::numeric_limits<size_t>::max() &&
158  "Content size is out-of-range for host");
159 
160  RMR.push_back({orcrpctpc::toWireProtectionFlags(
161  static_cast<sys::Memory::ProtectionFlags>(KV.first)),
162  KV.second.getContentSize() + KV.second.getZeroFillSize(),
163  KV.second.getAlignment()});
164  HostAllocs[KV.first] = {
165  std::make_unique<char[]>(KV.second.getContentSize()),
166  KV.second.getContentSize()};
167  }
168 
169  DEBUG_WITH_TYPE("orc", {
170  dbgs() << "Orc remote memmgr got request:\n";
171  for (auto &KV : Request)
172  dbgs() << " permissions: "
173  << ((KV.first & sys::Memory::MF_READ) ? 'R' : '-')
174  << ((KV.first & sys::Memory::MF_WRITE) ? 'W' : '-')
175  << ((KV.first & sys::Memory::MF_EXEC) ? 'X' : '-')
176  << ", content size: "
177  << formatv("{0:x16}", KV.second.getContentSize())
178  << " + zero-fill-size: "
179  << formatv("{0:x16}", KV.second.getZeroFillSize())
180  << ", align: " << KV.second.getAlignment() << "\n";
181  });
182 
183  // FIXME: LLVM RPC needs to be fixed to support alt
184  // serialization/deserialization on return types. For now just
185  // translate from std::map to DenseMap manually.
186  auto TmpTargetAllocs =
187  Parent.getEndpoint().template callB<orcrpctpc::ReserveMem>(RMR);
188  if (!TmpTargetAllocs)
189  return TmpTargetAllocs.takeError();
190 
191  if (TmpTargetAllocs->size() != RMR.size())
192  return make_error<StringError>(
193  "Number of target allocations does not match request",
195 
196  TargetAllocMap TargetAllocs;
197  for (auto &E : *TmpTargetAllocs)
198  TargetAllocs[orcrpctpc::fromWireProtectionFlags(E.Prot)] = {
199  E.Address, E.AllocatedSize};
200 
201  DEBUG_WITH_TYPE("orc", {
202  auto HAI = HostAllocs.begin();
203  for (auto &KV : TargetAllocs)
204  dbgs() << " permissions: "
205  << ((KV.first & sys::Memory::MF_READ) ? 'R' : '-')
206  << ((KV.first & sys::Memory::MF_WRITE) ? 'W' : '-')
207  << ((KV.first & sys::Memory::MF_EXEC) ? 'X' : '-')
208  << " assigned local " << (void *)HAI->second.Mem.get()
209  << ", target " << formatv("{0:x16}", KV.second.Address) << "\n";
210  });
211 
212  return std::make_unique<OrcRPCAllocation>(*this, std::move(HostAllocs),
213  std::move(TargetAllocs));
214  }
215 
216 private:
217  void reportError(Error Err) { Parent.reportError(std::move(Err)); }
218 
219  decltype(std::declval<OrcRPCTPCImplT>().getEndpoint()) getEndpoint() {
220  return Parent.getEndpoint();
221  }
222 
223  OrcRPCTPCImplT &Parent;
224 };
225 
226 /// TargetProcessControl::MemoryAccess implementation for a process connected
227 /// via an ORC RPC endpoint.
228 template <typename OrcRPCTPCImplT>
230 public:
231  OrcRPCTPCMemoryAccess(OrcRPCTPCImplT &Parent) : Parent(Parent) {}
232 
234  WriteResultFn OnWriteComplete) override {
235  writeViaRPC<orcrpctpc::WriteUInt8s>(Ws, std::move(OnWriteComplete));
236  }
237 
239  WriteResultFn OnWriteComplete) override {
240  writeViaRPC<orcrpctpc::WriteUInt16s>(Ws, std::move(OnWriteComplete));
241  }
242 
244  WriteResultFn OnWriteComplete) override {
245  writeViaRPC<orcrpctpc::WriteUInt32s>(Ws, std::move(OnWriteComplete));
246  }
247 
249  WriteResultFn OnWriteComplete) override {
250  writeViaRPC<orcrpctpc::WriteUInt64s>(Ws, std::move(OnWriteComplete));
251  }
252 
254  WriteResultFn OnWriteComplete) override {
255  writeViaRPC<orcrpctpc::WriteBuffers>(Ws, std::move(OnWriteComplete));
256  }
257 
258 private:
259  template <typename WriteRPCFunction, typename WriteElementT>
260  void writeViaRPC(ArrayRef<WriteElementT> Ws, WriteResultFn OnWriteComplete) {
261  if (auto Err = Parent.getEndpoint().template callAsync<WriteRPCFunction>(
262  [OWC = std::move(OnWriteComplete)](Error Err2) mutable -> Error {
263  OWC(std::move(Err2));
264  return Error::success();
265  },
266  Ws)) {
267  Parent.reportError(std::move(Err));
268  Parent.getEndpoint().abandonPendingResponses();
269  }
270  }
271 
272  OrcRPCTPCImplT &Parent;
273 };
274 
275 // TargetProcessControl for a process connected via an ORC RPC Endpoint.
276 template <typename RPCEndpointT>
278 public:
280 
282 
283  OrcRPCTargetProcessControlBase(std::shared_ptr<SymbolStringPool> SSP,
284  RPCEndpointT &EP, ErrorReporter ReportError)
285  : TargetProcessControl(std::move(SSP)),
286  ReportError(std::move(ReportError)), EP(EP) {}
287 
288  void reportError(Error Err) { ReportError(std::move(Err)); }
289 
290  RPCEndpointT &getEndpoint() { return EP; }
291 
292  Expected<tpctypes::DylibHandle> loadDylib(const char *DylibPath) override {
293  DEBUG_WITH_TYPE("orc", {
294  dbgs() << "Loading dylib \"" << (DylibPath ? DylibPath : "") << "\" ";
295  if (!DylibPath)
296  dbgs() << "(process symbols)";
297  dbgs() << "\n";
298  });
299  if (!DylibPath)
300  DylibPath = "";
301  auto H = EP.template callB<orcrpctpc::LoadDylib>(DylibPath);
302  DEBUG_WITH_TYPE("orc", {
303  if (H)
304  dbgs() << " got handle " << formatv("{0:x16}", *H) << "\n";
305  else
306  dbgs() << " error, unable to load\n";
307  });
308  return H;
309  }
310 
313  std::vector<orcrpctpc::RemoteLookupRequest> RR;
314  for (auto &E : Request) {
315  RR.push_back({});
316  RR.back().first = E.Handle;
317  for (auto &KV : E.Symbols)
318  RR.back().second.push_back(
319  {(*KV.first).str(),
320  KV.second == SymbolLookupFlags::WeaklyReferencedSymbol});
321  }
322  DEBUG_WITH_TYPE("orc", {
323  dbgs() << "Compound lookup:\n";
324  for (auto &R : Request) {
325  dbgs() << " In " << formatv("{0:x16}", R.Handle) << ": {";
326  bool First = true;
327  for (auto &KV : R.Symbols) {
328  dbgs() << (First ? "" : ",") << " " << *KV.first;
329  First = false;
330  }
331  dbgs() << " }\n";
332  }
333  });
334  return EP.template callB<orcrpctpc::LookupSymbols>(RR);
335  }
336 
338  ArrayRef<std::string> Args) override {
339  DEBUG_WITH_TYPE("orc", {
340  dbgs() << "Running as main: " << formatv("{0:x16}", MainFnAddr)
341  << ", args = [";
342  for (unsigned I = 0; I != Args.size(); ++I)
343  dbgs() << (I ? "," : "") << " \"" << Args[I] << "\"";
344  dbgs() << "]\n";
345  });
346  auto Result = EP.template callB<orcrpctpc::RunMain>(MainFnAddr, Args);
347  DEBUG_WITH_TYPE("orc", {
348  dbgs() << " call to " << formatv("{0:x16}", MainFnAddr);
349  if (Result)
350  dbgs() << " returned result " << *Result << "\n";
351  else
352  dbgs() << " failed\n";
353  });
354  return Result;
355  }
356 
359  ArrayRef<uint8_t> ArgBuffer) override {
360  DEBUG_WITH_TYPE("orc", {
361  dbgs() << "Running as wrapper function "
362  << formatv("{0:x16}", WrapperFnAddr) << " with "
363  << formatv("{0:x16}", ArgBuffer.size()) << " argument buffer\n";
364  });
365  auto Result =
366  EP.template callB<orcrpctpc::RunWrapper>(WrapperFnAddr, ArgBuffer);
367  // dbgs() << "Returned from runWrapper...\n";
368  return Result;
369  }
370 
372  DEBUG_WITH_TYPE("orc", dbgs() << "Closing connection to remote\n");
373  return EP.template callAsync<orcrpctpc::CloseConnection>(
374  std::move(OnCloseConnection));
375  }
376 
378  std::promise<MSVCPError> P;
379  auto F = P.get_future();
380  if (auto Err = closeConnection([&](Error Err2) -> Error {
381  P.set_value(std::move(Err2));
382  return Error::success();
383  })) {
384  EP.abandonAllPendingResponses();
385  return joinErrors(std::move(Err), F.get());
386  }
387  return F.get();
388  }
389 
390 protected:
391  /// Subclasses must call this during construction to initialize the
392  /// TargetTriple and PageSize members.
394  if (auto TripleOrErr = EP.template callB<orcrpctpc::GetTargetTriple>())
395  TargetTriple = Triple(*TripleOrErr);
396  else
397  return TripleOrErr.takeError();
398 
399  if (auto PageSizeOrErr = EP.template callB<orcrpctpc::GetPageSize>())
400  PageSize = *PageSizeOrErr;
401  else
402  return PageSizeOrErr.takeError();
403 
404  return Error::success();
405  }
406 
407 private:
408  ErrorReporter ReportError;
409  RPCEndpointT &EP;
410 };
411 
412 } // end namespace orc
413 } // end namespace llvm
414 
415 #endif // LLVM_EXECUTIONENGINE_ORC_ORCRPCTARGETPROCESSCONTROL_H
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::orc::OrcRPCTPCJITLinkMemoryManager::allocate
Expected< std::unique_ptr< Allocation > > allocate(const jitlink::JITLinkDylib *JD, const SegmentsRequestMap &Request) override
Create an Allocation object.
Definition: OrcRPCTargetProcessControl.h:151
llvm::sys::Memory::MF_READ
@ MF_READ
Definition: Memory.h:56
llvm
This class represents lattice values for constants.
Definition: AllocatorList.h:23
llvm::sys::Memory::MF_WRITE
@ MF_WRITE
Definition: Memory.h:57
llvm::orc::OrcRPCTPCMemoryAccess::OrcRPCTPCMemoryAccess
OrcRPCTPCMemoryAccess(OrcRPCTPCImplT &Parent)
Definition: OrcRPCTargetProcessControl.h:231
llvm::unique_function< void(Error)>
llvm::X86II::TA
@ TA
Definition: X86BaseInfo.h:801
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::orc::orcrpctpc::WPF_Read
@ WPF_Read
Definition: OrcRPCTPCServer.h:37
llvm::orc::TargetProcessControl::MemoryAccess
APIs for manipulating memory in the target process.
Definition: TargetProcessControl.h:35
llvm::orc::orcrpctpc::ReleaseOrFinalizeMemRequest
std::vector< ReleaseOrFinalizeMemRequestElement > ReleaseOrFinalizeMemRequest
Definition: OrcRPCTPCServer.h:91
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:332
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
OrcRPCTPCServer.h
llvm::DenseMapBase::begin
iterator begin()
Definition: DenseMap.h:74
llvm::orc::OrcRPCTargetProcessControlBase::lookupSymbols
Expected< std::vector< tpctypes::LookupResult > > lookupSymbols(ArrayRef< LookupRequest > Request) override
Search for symbols in the target process.
Definition: OrcRPCTargetProcessControl.h:312
MSVCErrorWorkarounds.h
llvm::DenseMapBase::count
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
Definition: DenseMap.h:145
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::orc::OrcRPCTPCMemoryAccess::writeUInt16s
void writeUInt16s(ArrayRef< tpctypes::UInt16Write > Ws, WriteResultFn OnWriteComplete) override
Definition: OrcRPCTargetProcessControl.h:238
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
llvm::formatv
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
Definition: FormatVariadic.h:250
DEBUG_WITH_TYPE
#define DEBUG_WITH_TYPE(TYPE, X)
DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug information.
Definition: Debug.h:64
llvm::orc::OrcRPCTPCMemoryAccess::writeUInt8s
void writeUInt8s(ArrayRef< tpctypes::UInt8Write > Ws, WriteResultFn OnWriteComplete) override
Definition: OrcRPCTargetProcessControl.h:233
PageSize
static cl::opt< int > PageSize("imp-null-check-page-size", cl::desc("The page size of the target in bytes"), cl::init(4096), cl::Hidden)
Allocation
llvm::MutableArrayRef
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:305
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
reportError
static Error reportError(StringRef Message)
Definition: BitcodeAnalyzer.cpp:19
llvm::sys::Memory::ProtectionFlags
ProtectionFlags
Definition: Memory.h:55
llvm::orc::OrcRPCTPCJITLinkMemoryManager::OrcRPCAllocation::~OrcRPCAllocation
~OrcRPCAllocation() override
Definition: OrcRPCTargetProcessControl.h:54
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
First
into llvm powi allowing the code generator to produce balanced multiplication trees First
Definition: README.txt:54
llvm::orc::OrcRPCTPCJITLinkMemoryManager::OrcRPCAllocation::finalizeAsync
void finalizeAsync(FinalizeContinuation OnFinalize) override
Definition: OrcRPCTargetProcessControl.h:71
llvm::orc::TargetProcessControl
TargetProcessControl supports interaction with a JIT target process.
Definition: TargetProcessControl.h:32
llvm::sys::Memory::MF_EXEC
@ MF_EXEC
Definition: Memory.h:58
llvm::orc::OrcRPCTargetProcessControlBase
Definition: OrcRPCTargetProcessControl.h:277
llvm::orc::OrcRPCTargetProcessControlBase::runWrapper
Expected< tpctypes::WrapperFunctionResult > runWrapper(JITTargetAddress WrapperFnAddr, ArrayRef< uint8_t > ArgBuffer) override
Run a wrapper function with signature:
Definition: OrcRPCTargetProcessControl.h:358
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::DenseMap< int, HostAlloc >
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::orc::OrcRPCTPCMemoryAccess::writeBuffers
void writeBuffers(ArrayRef< tpctypes::BufferWrite > Ws, WriteResultFn OnWriteComplete) override
Definition: OrcRPCTargetProcessControl.h:253
llvm::joinErrors
Error joinErrors(Error E1, Error E2)
Concatenate errors.
Definition: Error.h:429
llvm::orc::orcrpctpc::WPF_Exec
@ WPF_Exec
Definition: OrcRPCTPCServer.h:39
llvm::orc::OrcRPCTPCJITLinkMemoryManager::OrcRPCAllocation::OrcRPCAllocation
OrcRPCAllocation(OrcRPCTPCJITLinkMemoryManager< OrcRPCTPCImplT > &Parent, HostAllocMap HostAllocs, TargetAllocMap TargetAllocs)
Definition: OrcRPCTargetProcessControl.h:46
llvm::HighlightColor::Address
@ Address
llvm::DenseMapBase::find
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:150
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1556
llvm::orc::OrcRPCTPCJITLinkMemoryManager::OrcRPCTPCJITLinkMemoryManager
OrcRPCTPCJITLinkMemoryManager(OrcRPCTPCImplT &Parent)
Definition: OrcRPCTargetProcessControl.h:148
llvm::orc::orcrpctpc::ReserveMemRequest
std::vector< ReserveMemRequestElement > ReserveMemRequest
Definition: OrcRPCTPCServer.h:74
RPCUtils.h
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::orc::OrcRPCTargetProcessControlBase::runAsMain
Expected< int32_t > runAsMain(JITTargetAddress MainFnAddr, ArrayRef< std::string > Args) override
Run function with a main-like signature.
Definition: OrcRPCTargetProcessControl.h:337
llvm::DenseMapBase::empty
LLVM_NODISCARD bool empty() const
Definition: DenseMap.h:97
llvm::orc::OrcRPCTargetProcessControlBase::reportError
void reportError(Error Err)
Definition: OrcRPCTargetProcessControl.h:288
std
Definition: BitVector.h:941
TargetProcessControl.h
H
#define H(x, y, z)
Definition: MD5.cpp:58
llvm::inconvertibleErrorCode
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition: Error.cpp:77
llvm::DenseMapBase::end
iterator end()
Definition: DenseMap.h:83
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::orc::OrcRPCTPCJITLinkMemoryManager::OrcRPCAllocation::getWorkingMemory
MutableArrayRef< char > getWorkingMemory(ProtectionFlags Seg) override
Definition: OrcRPCTargetProcessControl.h:58
llvm::orc::OrcRPCTargetProcessControlBase::closeConnection
Error closeConnection(OnCloseConnectionFunction OnCloseConnection)
Definition: OrcRPCTargetProcessControl.h:371
llvm::DenseMapBase::size
unsigned size() const
Definition: DenseMap.h:100
llvm::orc::OrcRPCTPCMemoryAccess::writeUInt32s
void writeUInt32s(ArrayRef< tpctypes::UInt32Write > Ws, WriteResultFn OnWriteComplete) override
Definition: OrcRPCTargetProcessControl.h:243
llvm::JITTargetAddress
uint64_t JITTargetAddress
Represents an address in the target process's address space.
Definition: JITSymbol.h:42
llvm::orc::OrcRPCTPCMemoryAccess
TargetProcessControl::MemoryAccess implementation for a process connected via an ORC RPC endpoint.
Definition: OrcRPCTargetProcessControl.h:229
llvm::orc::orcrpctpc::fromWireProtectionFlags
sys::Memory::ProtectionFlags fromWireProtectionFlags(WireProtectionFlags WPF)
Definition: OrcRPCTPCServer.h:57
RawByteChannel.h
llvm::orc::OrcRPCTargetProcessControlBase::closeConnectionAndWait
Error closeConnectionAndWait()
Definition: OrcRPCTargetProcessControl.h:377
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:163
llvm::max
Align max(MaybeAlign Lhs, Align Rhs)
Definition: Alignment.h:350
llvm::orc::OrcRPCTargetProcessControlBase::getEndpoint
RPCEndpointT & getEndpoint()
Definition: OrcRPCTargetProcessControl.h:290
llvm::orc::orcrpctpc::toWireProtectionFlags
WireProtectionFlags toWireProtectionFlags(sys::Memory::ProtectionFlags PF)
Convert from sys::Memory::ProtectionFlags.
Definition: OrcRPCTPCServer.h:45
llvm::orc::OrcRPCTPCMemoryAccess::writeUInt64s
void writeUInt64s(ArrayRef< tpctypes::UInt64Write > Ws, WriteResultFn OnWriteComplete) override
Definition: OrcRPCTargetProcessControl.h:248
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:379
llvm::orc::OrcRPCTPCJITLinkMemoryManager
JITLinkMemoryManager implementation for a process connected via an ORC RPC endpoint.
Definition: OrcRPCTargetProcessControl.h:28
llvm::orc::OrcRPCTargetProcessControlBase::initializeORCRPCTPCBase
Error initializeORCRPCTPCBase()
Subclasses must call this during construction to initialize the TargetTriple and PageSize members.
Definition: OrcRPCTargetProcessControl.h:393
llvm::orc::OrcRPCTPCJITLinkMemoryManager::OrcRPCAllocation::getTargetMemory
JITTargetAddress getTargetMemory(ProtectionFlags Seg) override
Definition: OrcRPCTargetProcessControl.h:65
llvm::orc::OrcRPCTPCJITLinkMemoryManager::OrcRPCAllocation::deallocate
Error deallocate() override
Definition: OrcRPCTargetProcessControl.h:131
llvm::orc::orcrpctpc::WPF_Write
@ WPF_Write
Definition: OrcRPCTPCServer.h:38
llvm::orc::OrcRPCTargetProcessControlBase::OrcRPCTargetProcessControlBase
OrcRPCTargetProcessControlBase(std::shared_ptr< SymbolStringPool > SSP, RPCEndpointT &EP, ErrorReporter ReportError)
Definition: OrcRPCTargetProcessControl.h:283
llvm::orc::OrcRPCTPCJITLinkMemoryManager::OrcRPCAllocation
Definition: OrcRPCTargetProcessControl.h:44
llvm::orc::OrcRPCTargetProcessControlBase::loadDylib
Expected< tpctypes::DylibHandle > loadDylib(const char *DylibPath) override
Load the dynamic library at the given path and return a handle to it.
Definition: OrcRPCTargetProcessControl.h:292