LLVM 20.0.0git
Classes | Public Member Functions | Static Public Member Functions | List of all members
llvm::orc::SimpleRemoteEPC Class Reference

#include "llvm/ExecutionEngine/Orc/SimpleRemoteEPC.h"

Inheritance diagram for llvm::orc::SimpleRemoteEPC:
Inheritance graph
[legend]

Classes

struct  Setup
 A setup object containing callbacks to construct a memory manager and memory access object. More...
 

Public Member Functions

 SimpleRemoteEPC (const SimpleRemoteEPC &)=delete
 
SimpleRemoteEPCoperator= (const SimpleRemoteEPC &)=delete
 
 SimpleRemoteEPC (SimpleRemoteEPC &&)=delete
 
SimpleRemoteEPCoperator= (SimpleRemoteEPC &&)=delete
 
 ~SimpleRemoteEPC ()
 
Expected< tpctypes::DylibHandleloadDylib (const char *DylibPath) override
 Load the dynamic library at the given path and return a handle to it.
 
void lookupSymbolsAsync (ArrayRef< LookupRequest > Request, SymbolLookupCompleteFn F) override
 Search for symbols in the target process.
 
Expected< int32_t > runAsMain (ExecutorAddr MainFnAddr, ArrayRef< std::string > Args) override
 Run function with a main-like signature.
 
Expected< int32_t > runAsVoidFunction (ExecutorAddr VoidFnAddr) override
 Run function with a int (*)(void) signature.
 
Expected< int32_t > runAsIntFunction (ExecutorAddr IntFnAddr, int Arg) override
 Run function with a int (*)(int) signature.
 
void callWrapperAsync (ExecutorAddr WrapperFnAddr, IncomingWFRHandler OnComplete, ArrayRef< char > ArgBuffer) override
 Run a wrapper function in the executor.
 
Error disconnect () override
 Disconnect from the target process.
 
Expected< HandleMessageActionhandleMessage (SimpleRemoteEPCOpcode OpC, uint64_t SeqNo, ExecutorAddr TagAddr, SimpleRemoteEPCArgBytesVector ArgBytes) override
 Handle receipt of a message.
 
void handleDisconnect (Error Err) override
 Handle a disconnection from the underlying transport.
 
- Public Member Functions inherited from llvm::orc::ExecutorProcessControl
 ExecutorProcessControl (std::shared_ptr< SymbolStringPool > SSP, std::unique_ptr< TaskDispatcher > D)
 
virtual ~ExecutorProcessControl ()
 
ExecutionSessiongetExecutionSession ()
 Return the ExecutionSession associated with this instance.
 
SymbolStringPtr intern (StringRef SymName)
 Intern a symbol name in the SymbolStringPool.
 
std::shared_ptr< SymbolStringPoolgetSymbolStringPool () const
 Return a shared pointer to the SymbolStringPool for this instance.
 
TaskDispatchergetDispatcher ()
 
const TriplegetTargetTriple () const
 Return the Triple for the target process.
 
unsigned getPageSize () const
 Get the page size for the target process.
 
const JITDispatchInfogetJITDispatchInfo () const
 Get the JIT dispatch function and context address for the executor.
 
MemoryAccessgetMemoryAccess () const
 Return a MemoryAccess object for the target process.
 
jitlink::JITLinkMemoryManagergetMemMgr () const
 Return a JITLinkMemoryManager for the target process.
 
const StringMap< std::vector< char > > & getBootstrapMap () const
 Returns the bootstrap map.
 
template<typename T , typename SPSTagT >
Error getBootstrapMapValue (StringRef Key, std::optional< T > &Val) const
 Look up and SPS-deserialize a bootstrap map value.
 
const StringMap< ExecutorAddr > & getBootstrapSymbolsMap () const
 Returns the bootstrap symbol map.
 
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 its address to the ExecutorAddr if found.
 
virtual Expected< tpctypes::DylibHandleloadDylib (const char *DylibPath)=0
 Load the dynamic library at the given path and return a handle to it.
 
Expected< std::vector< tpctypes::LookupResult > > lookupSymbols (ArrayRef< LookupRequest > Request)
 Search for symbols in the target process.
 
virtual void lookupSymbolsAsync (ArrayRef< LookupRequest > Request, SymbolLookupCompleteFn F)=0
 Search for symbols in the target process.
 
virtual Expected< int32_t > runAsMain (ExecutorAddr MainFnAddr, ArrayRef< std::string > Args)=0
 Run function with a main-like signature.
 
virtual Expected< int32_t > runAsVoidFunction (ExecutorAddr VoidFnAddr)=0
 Run function with a int (*)(void) signature.
 
virtual Expected< int32_t > runAsIntFunction (ExecutorAddr IntFnAddr, int Arg)=0
 Run function with a int (*)(int) signature.
 
virtual void callWrapperAsync (ExecutorAddr WrapperFnAddr, IncomingWFRHandler OnComplete, ArrayRef< char > ArgBuffer)=0
 Run a wrapper function in the executor.
 
template<typename RunPolicyT , typename FnT >
void callWrapperAsync (RunPolicyT &&Runner, ExecutorAddr WrapperFnAddr, FnT &&OnComplete, ArrayRef< char > ArgBuffer)
 Run a wrapper function in the executor using the given Runner to dispatch OnComplete when the result is ready.
 
template<typename FnT >
void callWrapperAsync (ExecutorAddr WrapperFnAddr, FnT &&OnComplete, ArrayRef< char > ArgBuffer)
 Run a wrapper function in the executor.
 
shared::WrapperFunctionResult callWrapper (ExecutorAddr WrapperFnAddr, ArrayRef< char > ArgBuffer)
 Run a wrapper function in the executor.
 
template<typename SPSSignature , typename RunPolicyT , typename SendResultT , typename... ArgTs>
void callSPSWrapperAsync (RunPolicyT &&Runner, ExecutorAddr WrapperFnAddr, SendResultT &&SendResult, const ArgTs &...Args)
 Run a wrapper function using SPS to serialize the arguments and deserialize the results.
 
template<typename SPSSignature , typename SendResultT , typename... ArgTs>
void callSPSWrapperAsync (ExecutorAddr WrapperFnAddr, SendResultT &&SendResult, const ArgTs &...Args)
 Run a wrapper function using SPS to serialize the arguments and deserialize the results.
 
template<typename SPSSignature , typename... WrapperCallArgTs>
Error callSPSWrapper (ExecutorAddr WrapperFnAddr, WrapperCallArgTs &&...WrapperCallArgs)
 Run a wrapper function using SPS to serialize the arguments and deserialize the results.
 
virtual Error disconnect ()=0
 Disconnect from the target process.
 
- Public Member Functions inherited from llvm::orc::SimpleRemoteEPCTransportClient
virtual ~SimpleRemoteEPCTransportClient ()
 
virtual Expected< HandleMessageActionhandleMessage (SimpleRemoteEPCOpcode OpC, uint64_t SeqNo, ExecutorAddr TagAddr, SimpleRemoteEPCArgBytesVector ArgBytes)=0
 Handle receipt of a message.
 
virtual void handleDisconnect (Error Err)=0
 Handle a disconnection from the underlying transport.
 

Static Public Member Functions

template<typename TransportT , typename... TransportTCtorArgTs>
static Expected< std::unique_ptr< SimpleRemoteEPC > > Create (std::unique_ptr< TaskDispatcher > D, Setup S, TransportTCtorArgTs &&...TransportTCtorArgs)
 Create a SimpleRemoteEPC using the given transport type and args.
 

Additional Inherited Members

- Public Types inherited from llvm::orc::ExecutorProcessControl
using SymbolLookupCompleteFn = unique_function< void(Expected< std::vector< tpctypes::LookupResult > >)>
 
- Public Types inherited from llvm::orc::SimpleRemoteEPCTransportClient
enum  HandleMessageAction { ContinueSession , EndSession }
 
- Protected Attributes inherited from llvm::orc::ExecutorProcessControl
std::shared_ptr< SymbolStringPoolSSP
 
std::unique_ptr< TaskDispatcherD
 
ExecutionSessionES = nullptr
 
Triple TargetTriple
 
unsigned PageSize = 0
 
JITDispatchInfo JDI
 
MemoryAccessMemAccess = nullptr
 
jitlink::JITLinkMemoryManagerMemMgr = nullptr
 
StringMap< std::vector< char > > BootstrapMap
 
StringMap< ExecutorAddrBootstrapSymbols
 

Detailed Description

Definition at line 31 of file SimpleRemoteEPC.h.

Constructor & Destructor Documentation

◆ SimpleRemoteEPC() [1/2]

llvm::orc::SimpleRemoteEPC::SimpleRemoteEPC ( const SimpleRemoteEPC )
delete

◆ SimpleRemoteEPC() [2/2]

llvm::orc::SimpleRemoteEPC::SimpleRemoteEPC ( SimpleRemoteEPC &&  )
delete

◆ ~SimpleRemoteEPC()

llvm::orc::SimpleRemoteEPC::~SimpleRemoteEPC ( )

Definition at line 20 of file SimpleRemoteEPC.cpp.

References assert().

Member Function Documentation

◆ callWrapperAsync()

void llvm::orc::SimpleRemoteEPC::callWrapperAsync ( ExecutorAddr  WrapperFnAddr,
IncomingWFRHandler  OnComplete,
ArrayRef< char ArgBuffer 
)
overridevirtual

Run a wrapper function in the executor.

The given WFRHandler will be called on the result when it is returned.

The wrapper function should be callable as:

CWrapperFunctionResult fn(uint8_t *Data, uint64_t Size);
uint64_t Size

{.cpp}

Implements llvm::orc::ExecutorProcessControl.

Definition at line 91 of file SimpleRemoteEPC.cpp.

References assert(), H, and I.

◆ Create()

template<typename TransportT , typename... TransportTCtorArgTs>
static Expected< std::unique_ptr< SimpleRemoteEPC > > llvm::orc::SimpleRemoteEPC::Create ( std::unique_ptr< TaskDispatcher D,
Setup  S,
TransportTCtorArgTs &&...  TransportTCtorArgs 
)
inlinestatic

Create a SimpleRemoteEPC using the given transport type and args.

Definition at line 51 of file SimpleRemoteEPC.h.

References llvm::orc::ExecutorProcessControl::D, and llvm::joinErrors().

◆ disconnect()

Error llvm::orc::SimpleRemoteEPC::disconnect ( )
overridevirtual

Disconnect from the target process.

This should be called after the JIT session is shut down.

Implements llvm::orc::ExecutorProcessControl.

Definition at line 127 of file SimpleRemoteEPC.cpp.

References D.

◆ handleDisconnect()

void llvm::orc::SimpleRemoteEPC::handleDisconnect ( Error  Err)
overridevirtual

Handle a disconnection from the underlying transport.

No further messages should be sent to handleMessage after this is called. Err may contain an Error value indicating unexpected disconnection. This allows clients to log such errors, but no attempt should be made at recovery (which should be handled inside the transport class, if it is supported at all).

Implements llvm::orc::SimpleRemoteEPCTransportClient.

Definition at line 192 of file SimpleRemoteEPC.cpp.

References llvm::dbgs(), llvm::joinErrors(), LLVM_DEBUG, and std::swap().

◆ handleMessage()

Expected< SimpleRemoteEPCTransportClient::HandleMessageAction > llvm::orc::SimpleRemoteEPC::handleMessage ( SimpleRemoteEPCOpcode  OpC,
uint64_t  SeqNo,
ExecutorAddr  TagAddr,
SimpleRemoteEPCArgBytesVector  ArgBytes 
)
overridevirtual

Handle receipt of a message.

Returns an Error if the message cannot be handled, 'EndSession' if the client will not accept any further messages, and 'ContinueSession' otherwise.

Implements llvm::orc::SimpleRemoteEPCTransportClient.

Definition at line 136 of file SimpleRemoteEPC.cpp.

References assert(), llvm::dbgs(), llvm::formatv(), llvm::inconvertibleErrorCode(), LLVM_DEBUG, and llvm::SmallVectorBase< Size_T >::size().

◆ loadDylib()

Expected< tpctypes::DylibHandle > llvm::orc::SimpleRemoteEPC::loadDylib ( const char DylibPath)
overridevirtual

Load the dynamic library at the given path and return a handle to it.

If LibraryPath is null this function will return the global handle for the target process.

Implements llvm::orc::ExecutorProcessControl.

Definition at line 28 of file SimpleRemoteEPC.cpp.

◆ lookupSymbolsAsync()

void llvm::orc::SimpleRemoteEPC::lookupSymbolsAsync ( ArrayRef< LookupRequest Request,
SymbolLookupCompleteFn  F 
)
overridevirtual

Search for symbols in the target process.

The result of the lookup is a 2-dimensional array of target addresses that correspond to the lookup order. If a required symbol is not found then this method will return an error. If a weakly referenced symbol is not found then it be assigned a '0' value.

Implements llvm::orc::ExecutorProcessControl.

Definition at line 60 of file SimpleRemoteEPC.cpp.

References llvm::orc::lookupSymbolsAsyncHelper().

◆ operator=() [1/2]

SimpleRemoteEPC & llvm::orc::SimpleRemoteEPC::operator= ( const SimpleRemoteEPC )
delete

◆ operator=() [2/2]

SimpleRemoteEPC & llvm::orc::SimpleRemoteEPC::operator= ( SimpleRemoteEPC &&  )
delete

◆ runAsIntFunction()

Expected< int32_t > llvm::orc::SimpleRemoteEPC::runAsIntFunction ( ExecutorAddr  IntFnAddr,
int  Arg 
)
overridevirtual

Run function with a int (*)(int) signature.

Implements llvm::orc::ExecutorProcessControl.

Definition at line 82 of file SimpleRemoteEPC.cpp.

◆ runAsMain()

Expected< int32_t > llvm::orc::SimpleRemoteEPC::runAsMain ( ExecutorAddr  MainFnAddr,
ArrayRef< std::string >  Args 
)
overridevirtual

Run function with a main-like signature.

Implements llvm::orc::ExecutorProcessControl.

Definition at line 65 of file SimpleRemoteEPC.cpp.

◆ runAsVoidFunction()

Expected< int32_t > llvm::orc::SimpleRemoteEPC::runAsVoidFunction ( ExecutorAddr  VoidFnAddr)
overridevirtual

Run function with a int (*)(void) signature.

Implements llvm::orc::ExecutorProcessControl.

Definition at line 74 of file SimpleRemoteEPC.cpp.


The documentation for this class was generated from the following files: