LLVM  14.0.0git
ExecutorProcessControl.h
Go to the documentation of this file.
1 //===- ExecutorProcessControl.h - Executor process control APIs -*- 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 the executor processes.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_EXECUTIONENGINE_ORC_EXECUTORPROCESSCONTROL_H
14 #define LLVM_EXECUTIONENGINE_ORC_EXECUTORPROCESSCONTROL_H
15 
16 #include "llvm/ADT/Optional.h"
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/ADT/Triple.h"
26 
27 #include <future>
28 #include <mutex>
29 #include <vector>
30 
31 namespace llvm {
32 namespace orc {
33 
34 class ExecutionSession;
35 class SymbolLookupSet;
36 
37 /// ExecutorProcessControl supports interaction with a JIT target process.
39  friend class ExecutionSession;
40 
41 public:
42  /// Sender to return the result of a WrapperFunction executed in the JIT.
43  using SendResultFunction =
45 
46  /// APIs for manipulating memory in the target process.
47  class MemoryAccess {
48  public:
49  /// Callback function for asynchronous writes.
51 
52  virtual ~MemoryAccess();
53 
55  WriteResultFn OnWriteComplete) = 0;
56 
58  WriteResultFn OnWriteComplete) = 0;
59 
61  WriteResultFn OnWriteComplete) = 0;
62 
64  WriteResultFn OnWriteComplete) = 0;
65 
67  WriteResultFn OnWriteComplete) = 0;
68 
70  std::promise<MSVCPError> ResultP;
71  auto ResultF = ResultP.get_future();
73  [&](Error Err) { ResultP.set_value(std::move(Err)); });
74  return ResultF.get();
75  }
76 
78  std::promise<MSVCPError> ResultP;
79  auto ResultF = ResultP.get_future();
81  [&](Error Err) { ResultP.set_value(std::move(Err)); });
82  return ResultF.get();
83  }
84 
86  std::promise<MSVCPError> ResultP;
87  auto ResultF = ResultP.get_future();
89  [&](Error Err) { ResultP.set_value(std::move(Err)); });
90  return ResultF.get();
91  }
92 
94  std::promise<MSVCPError> ResultP;
95  auto ResultF = ResultP.get_future();
97  [&](Error Err) { ResultP.set_value(std::move(Err)); });
98  return ResultF.get();
99  }
100 
102  std::promise<MSVCPError> ResultP;
103  auto ResultF = ResultP.get_future();
105  [&](Error Err) { ResultP.set_value(std::move(Err)); });
106  return ResultF.get();
107  }
108  };
109 
110  /// A pair of a dylib and a set of symbols to be looked up.
111  struct LookupRequest {
113  : Handle(Handle), Symbols(Symbols) {}
116  };
117 
118  /// Contains the address of the dispatch function and context that the ORC
119  /// runtime can use to call functions in the JIT.
123  };
124 
125  virtual ~ExecutorProcessControl();
126 
127  /// Return the ExecutionSession associated with this instance.
128  /// Not callable until the ExecutionSession has been associated.
130  assert(ES && "No ExecutionSession associated yet");
131  return *ES;
132  }
133 
134  /// Intern a symbol name in the SymbolStringPool.
135  SymbolStringPtr intern(StringRef SymName) { return SSP->intern(SymName); }
136 
137  /// Return a shared pointer to the SymbolStringPool for this instance.
138  std::shared_ptr<SymbolStringPool> getSymbolStringPool() const { return SSP; }
139 
140  /// Return the Triple for the target process.
141  const Triple &getTargetTriple() const { return TargetTriple; }
142 
143  /// Get the page size for the target process.
144  unsigned getPageSize() const { return PageSize; }
145 
146  /// Get the JIT dispatch function and context address for the executor.
147  const JITDispatchInfo &getJITDispatchInfo() const { return JDI; }
148 
149  /// Return a MemoryAccess object for the target process.
151  assert(MemAccess && "No MemAccess object set.");
152  return *MemAccess;
153  }
154 
155  /// Return a JITLinkMemoryManager for the target process.
157  assert(MemMgr && "No MemMgr object set");
158  return *MemMgr;
159  }
160 
161  /// Returns the bootstrap symbol map.
163  return BootstrapSymbols;
164  }
165 
166  /// For each (ExecutorAddr&, StringRef) pair, looks up the string in the
167  /// bootstrap symbols map and writes its address to the ExecutorAddr if
168  /// found. If any symbol is not found then the function returns an error.
170  ArrayRef<std::pair<ExecutorAddr &, StringRef>> Pairs) const {
171  for (auto &KV : Pairs) {
172  auto I = BootstrapSymbols.find(KV.second);
173  if (I == BootstrapSymbols.end())
174  return make_error<StringError>("Symbol \"" + KV.second +
175  "\" not found "
176  "in bootstrap symbols map",
178 
179  KV.first = I->second;
180  }
181  return Error::success();
182  }
183 
184  /// Load the dynamic library at the given path and return a handle to it.
185  /// If LibraryPath is null this function will return the global handle for
186  /// the target process.
187  virtual Expected<tpctypes::DylibHandle> loadDylib(const char *DylibPath) = 0;
188 
189  /// Search for symbols in the target process.
190  ///
191  /// The result of the lookup is a 2-dimentional array of target addresses
192  /// that correspond to the lookup order. If a required symbol is not
193  /// found then this method will return an error. If a weakly referenced
194  /// symbol is not found then it be assigned a '0' value.
197 
198  /// Run function with a main-like signature.
199  virtual Expected<int32_t> runAsMain(JITTargetAddress MainFnAddr,
201 
202  /// Run a wrapper function in the executor.
203  ///
204  /// The wrapper function should be callable as:
205  ///
206  /// \code{.cpp}
207  /// CWrapperFunctionResult fn(uint8_t *Data, uint64_t Size);
208  /// \endcode{.cpp}
209  ///
210  /// The given OnComplete function will be called to return the result.
211  virtual void callWrapperAsync(SendResultFunction OnComplete,
212  JITTargetAddress WrapperFnAddr,
213  ArrayRef<char> ArgBuffer) = 0;
214 
215  /// Run a wrapper function in the executor. The wrapper function should be
216  /// callable as:
217  ///
218  /// \code{.cpp}
219  /// CWrapperFunctionResult fn(uint8_t *Data, uint64_t Size);
220  /// \endcode{.cpp}
222  ArrayRef<char> ArgBuffer) {
223  std::promise<shared::WrapperFunctionResult> RP;
224  auto RF = RP.get_future();
226  [&](shared::WrapperFunctionResult R) { RP.set_value(std::move(R)); },
227  WrapperFnAddr, ArgBuffer);
228  return RF.get();
229  }
230 
231  /// Run a wrapper function using SPS to serialize the arguments and
232  /// deserialize the results.
233  template <typename SPSSignature, typename SendResultT, typename... ArgTs>
234  void callSPSWrapperAsync(SendResultT &&SendResult,
235  JITTargetAddress WrapperFnAddr,
236  const ArgTs &...Args) {
238  [this,
239  WrapperFnAddr](ExecutorProcessControl::SendResultFunction SendResult,
240  const char *ArgData, size_t ArgSize) {
241  callWrapperAsync(std::move(SendResult), WrapperFnAddr,
242  ArrayRef<char>(ArgData, ArgSize));
243  },
244  std::move(SendResult), Args...);
245  }
246 
247  /// Run a wrapper function using SPS to serialize the arguments and
248  /// deserialize the results.
249  ///
250  /// If SPSSignature is a non-void function signature then the second argument
251  /// (the first in the Args list) should be a reference to a return value.
252  template <typename SPSSignature, typename... WrapperCallArgTs>
254  WrapperCallArgTs &&...WrapperCallArgs) {
256  [this, WrapperFnAddr](const char *ArgData, size_t ArgSize) {
257  return callWrapper(WrapperFnAddr, ArrayRef<char>(ArgData, ArgSize));
258  },
259  std::forward<WrapperCallArgTs>(WrapperCallArgs)...);
260  }
261 
262  /// Disconnect from the target process.
263  ///
264  /// This should be called after the JIT session is shut down.
265  virtual Error disconnect() = 0;
266 
267 protected:
268  ExecutorProcessControl(std::shared_ptr<SymbolStringPool> SSP)
269  : SSP(std::move(SSP)) {}
270 
271  std::shared_ptr<SymbolStringPool> SSP;
272  ExecutionSession *ES = nullptr;
274  unsigned PageSize = 0;
279 };
280 
281 /// A ExecutorProcessControl instance that asserts if any of its methods are
282 /// used. Suitable for use is unit tests, and by ORC clients who haven't moved
283 /// to ExecutorProcessControl-based APIs yet.
285 public:
287  std::shared_ptr<SymbolStringPool> SSP = nullptr,
288  const std::string &TT = "", unsigned PageSize = 0)
290  : std::make_shared<SymbolStringPool>()) {
291  this->TargetTriple = Triple(TT);
292  this->PageSize = PageSize;
293  }
294 
295  Expected<tpctypes::DylibHandle> loadDylib(const char *DylibPath) override {
296  llvm_unreachable("Unsupported");
297  }
298 
301  llvm_unreachable("Unsupported");
302  }
303 
305  ArrayRef<std::string> Args) override {
306  llvm_unreachable("Unsupported");
307  }
308 
310  JITTargetAddress WrapperFnAddr,
311  ArrayRef<char> ArgBuffer) override {
312  llvm_unreachable("Unsupported");
313  }
314 
315  Error disconnect() override { return Error::success(); }
316 };
317 
318 /// A ExecutorProcessControl implementation targeting the current process.
320  : public ExecutorProcessControl,
322 public:
324  std::shared_ptr<SymbolStringPool> SSP, Triple TargetTriple,
325  unsigned PageSize, std::unique_ptr<jitlink::JITLinkMemoryManager> MemMgr);
326 
327  /// Create a SelfExecutorProcessControl with the given symbol string pool and
328  /// memory manager.
329  /// If no symbol string pool is given then one will be created.
330  /// If no memory manager is given a jitlink::InProcessMemoryManager will
331  /// be created and used by default.
333  Create(std::shared_ptr<SymbolStringPool> SSP = nullptr,
334  std::unique_ptr<jitlink::JITLinkMemoryManager> MemMgr = nullptr);
335 
336  Expected<tpctypes::DylibHandle> loadDylib(const char *DylibPath) override;
337 
339  lookupSymbols(ArrayRef<LookupRequest> Request) override;
340 
342  ArrayRef<std::string> Args) override;
343 
344  void callWrapperAsync(SendResultFunction OnComplete,
345  JITTargetAddress WrapperFnAddr,
346  ArrayRef<char> ArgBuffer) override;
347 
348  Error disconnect() override;
349 
350 private:
351  void writeUInt8sAsync(ArrayRef<tpctypes::UInt8Write> Ws,
352  WriteResultFn OnWriteComplete) override;
353 
354  void writeUInt16sAsync(ArrayRef<tpctypes::UInt16Write> Ws,
355  WriteResultFn OnWriteComplete) override;
356 
357  void writeUInt32sAsync(ArrayRef<tpctypes::UInt32Write> Ws,
358  WriteResultFn OnWriteComplete) override;
359 
360  void writeUInt64sAsync(ArrayRef<tpctypes::UInt64Write> Ws,
361  WriteResultFn OnWriteComplete) override;
362 
363  void writeBuffersAsync(ArrayRef<tpctypes::BufferWrite> Ws,
364  WriteResultFn OnWriteComplete) override;
365 
367  jitDispatchViaWrapperFunctionManager(void *Ctx, const void *FnTag,
368  const char *Data, size_t Size);
369 
370  std::unique_ptr<jitlink::JITLinkMemoryManager> OwnedMemMgr;
371  char GlobalManglingPrefix = 0;
372  std::vector<std::unique_ptr<sys::DynamicLibrary>> DynamicLibraries;
373 };
374 
375 } // end namespace orc
376 } // end namespace llvm
377 
378 #endif // LLVM_EXECUTIONENGINE_ORC_EXECUTORPROCESSCONTROL_H
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::orc::ExecutorAddr
Represents an address in the executor process.
Definition: ExecutorAddress.h:37
llvm::orc::ExecutorProcessControl::MemMgr
jitlink::JITLinkMemoryManager * MemMgr
Definition: ExecutorProcessControl.h:277
llvm::orc::ExecutorProcessControl::callWrapper
shared::WrapperFunctionResult callWrapper(JITTargetAddress WrapperFnAddr, ArrayRef< char > ArgBuffer)
Run a wrapper function in the executor.
Definition: ExecutorProcessControl.h:221
TargetProcessControlTypes.h
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
Optional.h
llvm::orc::ExecutorProcessControl::ES
ExecutionSession * ES
Definition: ExecutorProcessControl.h:272
llvm::unique_function
unique_function is a type-erasing functor similar to std::function.
Definition: FunctionExtras.h:55
llvm::orc::ExecutorProcessControl::MemoryAccess::~MemoryAccess
virtual ~MemoryAccess()
Definition: ExecutorProcessControl.cpp:22
llvm::orc::ExecutorProcessControl::getBootstrapSymbols
Error getBootstrapSymbols(ArrayRef< std::pair< ExecutorAddr &, StringRef >> Pairs) const
For each (ExecutorAddr&, StringRef) pair, looks up the string in the bootstrap symbols map and writes...
Definition: ExecutorProcessControl.h:169
llvm::orc::ExecutorProcessControl::getMemoryAccess
MemoryAccess & getMemoryAccess() const
Return a MemoryAccess object for the target process.
Definition: ExecutorProcessControl.h:150
StringRef.h
llvm::orc::ExecutorProcessControl::LookupRequest::LookupRequest
LookupRequest(tpctypes::DylibHandle Handle, const SymbolLookupSet &Symbols)
Definition: ExecutorProcessControl.h:112
llvm::orc::SymbolLookupSet
A set of symbols to look up, each associated with a SymbolLookupFlags value.
Definition: Core.h:174
llvm::orc::SymbolStringPtr
Pointer to a pooled string representing a symbol name.
Definition: SymbolStringPool.h:50
llvm::orc::shared::WrapperFunction
Definition: WrapperFunctionUtils.h:431
llvm::orc::UnsupportedExecutorProcessControl::loadDylib
Expected< tpctypes::DylibHandle > loadDylib(const char *DylibPath) override
Load the dynamic library at the given path and return a handle to it.
Definition: ExecutorProcessControl.h:295
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:331
llvm::orc::ExecutorProcessControl::TargetTriple
Triple TargetTriple
Definition: ExecutorProcessControl.h:273
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::orc::SelfExecutorProcessControl::disconnect
Error disconnect() override
Disconnect from the target process.
Definition: ExecutorProcessControl.cpp:121
llvm::orc::ExecutorProcessControl::getExecutionSession
ExecutionSession & getExecutionSession()
Return the ExecutionSession associated with this instance.
Definition: ExecutorProcessControl.h:129
WrapperFunctionUtils.h
DynamicLibrary.h
llvm::orc::ExecutorProcessControl
ExecutorProcessControl supports interaction with a JIT target process.
Definition: ExecutorProcessControl.h:38
llvm::orc::UnsupportedExecutorProcessControl::callWrapperAsync
void callWrapperAsync(SendResultFunction OnComplete, JITTargetAddress WrapperFnAddr, ArrayRef< char > ArgBuffer) override
Run a wrapper function in the executor.
Definition: ExecutorProcessControl.h:309
llvm::orc::ExecutorProcessControl::JITDispatchInfo::JITDispatchFunction
ExecutorAddr JITDispatchFunction
Definition: ExecutorProcessControl.h:121
MSVCErrorWorkarounds.h
llvm::orc::ExecutorProcessControl::SSP
std::shared_ptr< SymbolStringPool > SSP
Definition: ExecutorProcessControl.h:271
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::orc::ExecutorProcessControl::disconnect
virtual Error disconnect()=0
Disconnect from the target process.
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::orc::ExecutorProcessControl::LookupRequest::Handle
tpctypes::DylibHandle Handle
Definition: ExecutorProcessControl.h:114
llvm::orc::SelfExecutorProcessControl::runAsMain
Expected< int32_t > runAsMain(JITTargetAddress MainFnAddr, ArrayRef< std::string > Args) override
Run function with a main-like signature.
Definition: ExecutorProcessControl.cpp:106
SymbolStringPool.h
llvm::orc::ExecutorProcessControl::getMemMgr
jitlink::JITLinkMemoryManager & getMemMgr() const
Return a JITLinkMemoryManager for the target process.
Definition: ExecutorProcessControl.h:156
llvm::AArch64::RP
@ RP
Definition: AArch64ISelLowering.h:471
llvm::orc::SymbolStringPool
String pool for symbol names used by the JIT.
Definition: SymbolStringPool.h:27
llvm::orc::ExecutorProcessControl::MemoryAccess::writeBuffersAsync
virtual void writeBuffersAsync(ArrayRef< tpctypes::BufferWrite > Ws, WriteResultFn OnWriteComplete)=0
llvm::orc::UnsupportedExecutorProcessControl::runAsMain
Expected< int32_t > runAsMain(JITTargetAddress MainFnAddr, ArrayRef< std::string > Args) override
Run function with a main-like signature.
Definition: ExecutorProcessControl.h:304
llvm::orc::shared::detail::CWrapperFunctionResult
Definition: WrapperFunctionUtils.h:37
llvm::orc::ExecutorProcessControl::MemoryAccess::writeUInt8sAsync
virtual void writeUInt8sAsync(ArrayRef< tpctypes::UInt8Write > Ws, WriteResultFn OnWriteComplete)=0
llvm::orc::ExecutorProcessControl::callSPSWrapper
Error callSPSWrapper(JITTargetAddress WrapperFnAddr, WrapperCallArgTs &&...WrapperCallArgs)
Run a wrapper function using SPS to serialize the arguments and deserialize the results.
Definition: ExecutorProcessControl.h:253
llvm::orc::ExecutorProcessControl::MemoryAccess::writeUInt8s
Error writeUInt8s(ArrayRef< tpctypes::UInt8Write > Ws)
Definition: ExecutorProcessControl.h:69
llvm::orc::ExecutorProcessControl::ExecutorProcessControl
ExecutorProcessControl(std::shared_ptr< SymbolStringPool > SSP)
Definition: ExecutorProcessControl.h:268
llvm::orc::ExecutorProcessControl::LookupRequest::Symbols
const SymbolLookupSet & Symbols
Definition: ExecutorProcessControl.h:115
llvm::orc::ExecutorProcessControl::MemAccess
MemoryAccess * MemAccess
Definition: ExecutorProcessControl.h:276
llvm::orc::ExecutorProcessControl::JDI
JITDispatchInfo JDI
Definition: ExecutorProcessControl.h:275
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:108
llvm::orc::ExecutorProcessControl::callSPSWrapperAsync
void callSPSWrapperAsync(SendResultT &&SendResult, JITTargetAddress WrapperFnAddr, const ArgTs &...Args)
Run a wrapper function using SPS to serialize the arguments and deserialize the results.
Definition: ExecutorProcessControl.h:234
llvm::orc::SelfExecutorProcessControl::loadDylib
Expected< tpctypes::DylibHandle > loadDylib(const char *DylibPath) override
Load the dynamic library at the given path and return a handle to it.
Definition: ExecutorProcessControl.cpp:64
llvm::orc::ExecutorProcessControl::JITDispatchInfo
Contains the address of the dispatch function and context that the ORC runtime can use to call functi...
Definition: ExecutorProcessControl.h:120
llvm::orc::ExecutorProcessControl::LookupRequest
A pair of a dylib and a set of symbols to be looked up.
Definition: ExecutorProcessControl.h:111
llvm::orc::ExecutorProcessControl::MemoryAccess::writeUInt32sAsync
virtual void writeUInt32sAsync(ArrayRef< tpctypes::UInt32Write > Ws, WriteResultFn OnWriteComplete)=0
llvm::orc::shared::WrapperFunctionResult
C++ wrapper function result: Same as CWrapperFunctionResult but auto-releases memory.
Definition: WrapperFunctionUtils.h:46
uint64_t
llvm::orc::UnsupportedExecutorProcessControl::disconnect
Error disconnect() override
Disconnect from the target process.
Definition: ExecutorProcessControl.h:315
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::orc::ExecutorProcessControl::MemoryAccess::writeUInt64sAsync
virtual void writeUInt64sAsync(ArrayRef< tpctypes::UInt64Write > Ws, WriteResultFn OnWriteComplete)=0
I
#define I(x, y, z)
Definition: MD5.cpp:59
call
S is passed via registers r2 But gcc stores them to the and then reload them to and r3 before issuing the call(r0 contains the address of the format string)
Definition: README.txt:190
llvm::orc::ExecutorProcessControl::runAsMain
virtual Expected< int32_t > runAsMain(JITTargetAddress MainFnAddr, ArrayRef< std::string > Args)=0
Run function with a main-like signature.
llvm::orc::ExecutorProcessControl::JITDispatchInfo::JITDispatchContext
ExecutorAddr JITDispatchContext
Definition: ExecutorProcessControl.h:122
llvm::orc::SelfExecutorProcessControl::Create
static Expected< std::unique_ptr< SelfExecutorProcessControl > > Create(std::shared_ptr< SymbolStringPool > SSP=nullptr, std::unique_ptr< jitlink::JITLinkMemoryManager > MemMgr=nullptr)
Create a SelfExecutorProcessControl with the given symbol string pool and memory manager.
Definition: ExecutorProcessControl.cpp:46
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:1609
llvm::orc::ExecutorProcessControl::MemoryAccess::writeUInt64s
Error writeUInt64s(ArrayRef< tpctypes::UInt64Write > Ws)
Definition: ExecutorProcessControl.h:93
llvm::orc::ExecutorProcessControl::MemoryAccess::writeUInt32s
Error writeUInt32s(ArrayRef< tpctypes::UInt32Write > Ws)
Definition: ExecutorProcessControl.h:85
llvm::orc::SelfExecutorProcessControl
A ExecutorProcessControl implementation targeting the current process.
Definition: ExecutorProcessControl.h:319
llvm::orc::ExecutorProcessControl::MemoryAccess::writeUInt16sAsync
virtual void writeUInt16sAsync(ArrayRef< tpctypes::UInt16Write > Ws, WriteResultFn OnWriteComplete)=0
Triple.h
llvm::orc::ExecutorProcessControl::MemoryAccess::writeUInt16s
Error writeUInt16s(ArrayRef< tpctypes::UInt16Write > Ws)
Definition: ExecutorProcessControl.h:77
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:58
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
llvm::orc::ExecutorProcessControl::callWrapperAsync
virtual void callWrapperAsync(SendResultFunction OnComplete, JITTargetAddress WrapperFnAddr, ArrayRef< char > ArgBuffer)=0
Run a wrapper function in the executor.
JITLinkMemoryManager.h
llvm::orc::ExecutorProcessControl::BootstrapSymbols
StringMap< ExecutorAddr > BootstrapSymbols
Definition: ExecutorProcessControl.h:278
llvm::orc::ExecutorProcessControl::MemoryAccess::writeBuffers
Error writeBuffers(ArrayRef< tpctypes::BufferWrite > Ws)
Definition: ExecutorProcessControl.h:101
llvm::orc::SelfExecutorProcessControl::lookupSymbols
Expected< std::vector< tpctypes::LookupResult > > lookupSymbols(ArrayRef< LookupRequest > Request) override
Search for symbols in the target process.
Definition: ExecutorProcessControl.cpp:75
llvm::orc::ExecutorProcessControl::MemoryAccess
APIs for manipulating memory in the target process.
Definition: ExecutorProcessControl.h:47
llvm::orc::ExecutorProcessControl::getBootstrapSymbolsMap
const StringMap< ExecutorAddr > & getBootstrapSymbolsMap() const
Returns the bootstrap symbol map.
Definition: ExecutorProcessControl.h:162
llvm::orc::UnsupportedExecutorProcessControl
A ExecutorProcessControl instance that asserts if any of its methods are used.
Definition: ExecutorProcessControl.h:284
std
Definition: BitVector.h:838
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
ExecutorAddress.h
llvm::orc::ExecutorProcessControl::getTargetTriple
const Triple & getTargetTriple() const
Return the Triple for the target process.
Definition: ExecutorProcessControl.h:141
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::orc::ExecutionSession
An ExecutionSession represents a running JIT program.
Definition: Core.h:1275
llvm::orc::ExecutorProcessControl::loadDylib
virtual Expected< tpctypes::DylibHandle > loadDylib(const char *DylibPath)=0
Load the dynamic library at the given path and return a handle to it.
llvm::orc::ExecutorProcessControl::getPageSize
unsigned getPageSize() const
Get the page size for the target process.
Definition: ExecutorProcessControl.h:144
llvm::orc::ExecutorProcessControl::getJITDispatchInfo
const JITDispatchInfo & getJITDispatchInfo() const
Get the JIT dispatch function and context address for the executor.
Definition: ExecutorProcessControl.h:147
llvm::JITTargetAddress
uint64_t JITTargetAddress
Represents an address in the target process's address space.
Definition: JITSymbol.h:42
llvm::orc::ExecutorProcessControl::getSymbolStringPool
std::shared_ptr< SymbolStringPool > getSymbolStringPool() const
Return a shared pointer to the SymbolStringPool for this instance.
Definition: ExecutorProcessControl.h:138
llvm::orc::ExecutorProcessControl::~ExecutorProcessControl
virtual ~ExecutorProcessControl()
Definition: ExecutorProcessControl.cpp:24
llvm::orc::ExecutorProcessControl::PageSize
unsigned PageSize
Definition: ExecutorProcessControl.h:274
llvm::orc::UnsupportedExecutorProcessControl::lookupSymbols
Expected< std::vector< tpctypes::LookupResult > > lookupSymbols(ArrayRef< LookupRequest > Request) override
Search for symbols in the target process.
Definition: ExecutorProcessControl.h:300
llvm::orc::ExecutorProcessControl::lookupSymbols
virtual Expected< std::vector< tpctypes::LookupResult > > lookupSymbols(ArrayRef< LookupRequest > Request)=0
Search for symbols in the target process.
llvm::orc::UnsupportedExecutorProcessControl::UnsupportedExecutorProcessControl
UnsupportedExecutorProcessControl(std::shared_ptr< SymbolStringPool > SSP=nullptr, const std::string &TT="", unsigned PageSize=0)
Definition: ExecutorProcessControl.h:286
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:389
llvm::orc::ExecutorProcessControl::SendResultFunction
unique_function< void(shared::WrapperFunctionResult)> SendResultFunction
Sender to return the result of a WrapperFunction executed in the JIT.
Definition: ExecutorProcessControl.h:44
llvm::orc::ExecutorProcessControl::intern
SymbolStringPtr intern(StringRef SymName)
Intern a symbol name in the SymbolStringPool.
Definition: ExecutorProcessControl.h:135
llvm::orc::SelfExecutorProcessControl::callWrapperAsync
void callWrapperAsync(SendResultFunction OnComplete, JITTargetAddress WrapperFnAddr, ArrayRef< char > ArgBuffer) override
Run a wrapper function in the executor.
Definition: ExecutorProcessControl.cpp:112
llvm::orc::SelfExecutorProcessControl::SelfExecutorProcessControl
SelfExecutorProcessControl(std::shared_ptr< SymbolStringPool > SSP, Triple TargetTriple, unsigned PageSize, std::unique_ptr< jitlink::JITLinkMemoryManager > MemMgr)
Definition: ExecutorProcessControl.cpp:26