LLVM 22.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::orc::ExecutionSession Class Reference

An ExecutionSession represents a running JIT program. More...

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

Public Types

using ErrorReporter = unique_function< void(Error)>
 For reporting errors.
 
using SendResultFunction = unique_function< void(shared::WrapperFunctionResult)>
 Send a result to the remote.
 
using JITDispatchHandlerFunction = unique_function< void(SendResultFunction SendResult, const char *ArgData, size_t ArgSize)>
 An asynchronous wrapper-function callable from the executor via jit-dispatch.
 
using JITDispatchHandlerAssociationMap = DenseMap< SymbolStringPtr, JITDispatchHandlerFunction >
 A map associating tag names with asynchronous wrapper function implementations in the JIT.
 

Public Member Functions

LLVM_ABI ExecutionSession (std::unique_ptr< ExecutorProcessControl > EPC)
 Construct an ExecutionSession with the given ExecutorProcessControl object.
 
LLVM_ABI ~ExecutionSession ()
 Destroy an ExecutionSession.
 
LLVM_ABI Error endSession ()
 End the session.
 
ExecutorProcessControlgetExecutorProcessControl ()
 Get the ExecutorProcessControl object associated with this ExecutionSession.
 
const TriplegetTargetTriple () const
 Return the triple for the executor.
 
size_t getPageSize () const
 
std::shared_ptr< SymbolStringPoolgetSymbolStringPool ()
 Get the SymbolStringPool for this instance.
 
SymbolStringPtr intern (StringRef SymName)
 Add a symbol name to the SymbolStringPool and return a pointer to it.
 
void setPlatform (std::unique_ptr< Platform > P)
 Set the Platform for this ExecutionSession.
 
PlatformgetPlatform ()
 Get the Platform for this session.
 
template<typename Func >
decltype(auto) runSessionLocked (Func &&F)
 Run the given lambda with the session mutex locked.
 
LLVM_ABI void registerResourceManager (ResourceManager &RM)
 Register the given ResourceManager with this ExecutionSession.
 
LLVM_ABI void deregisterResourceManager (ResourceManager &RM)
 Deregister the given ResourceManager with this ExecutionSession.
 
LLVM_ABI JITDylibgetJITDylibByName (StringRef Name)
 Return a pointer to the "name" JITDylib.
 
LLVM_ABI JITDylibcreateBareJITDylib (std::string Name)
 Add a new bare JITDylib to this ExecutionSession.
 
LLVM_ABI Expected< JITDylib & > createJITDylib (std::string Name)
 Add a new JITDylib to this ExecutionSession.
 
LLVM_ABI Error removeJITDylibs (std::vector< JITDylibSP > JDsToRemove)
 Removes the given JITDylibs from the ExecutionSession.
 
Error removeJITDylib (JITDylib &JD)
 Calls removeJTIDylibs on the gives JITDylib.
 
ExecutionSessionsetErrorReporter (ErrorReporter ReportError)
 Set the error reporter function.
 
void reportError (Error Err)
 Report a error for this execution session.
 
LLVM_ABI void lookupFlags (LookupKind K, JITDylibSearchOrder SearchOrder, SymbolLookupSet Symbols, unique_function< void(Expected< SymbolFlagsMap >)> OnComplete)
 Search the given JITDylibs to find the flags associated with each of the given symbols.
 
LLVM_ABI Expected< SymbolFlagsMaplookupFlags (LookupKind K, JITDylibSearchOrder SearchOrder, SymbolLookupSet Symbols)
 Blocking version of lookupFlags.
 
LLVM_ABI void lookup (LookupKind K, const JITDylibSearchOrder &SearchOrder, SymbolLookupSet Symbols, SymbolState RequiredState, SymbolsResolvedCallback NotifyComplete, RegisterDependenciesFunction RegisterDependencies)
 Search the given JITDylibs for the given symbols.
 
LLVM_ABI Expected< SymbolMaplookup (const JITDylibSearchOrder &SearchOrder, SymbolLookupSet Symbols, LookupKind K=LookupKind::Static, SymbolState RequiredState=SymbolState::Ready, RegisterDependenciesFunction RegisterDependencies=NoDependenciesToRegister)
 Blocking version of lookup above.
 
LLVM_ABI Expected< ExecutorSymbolDeflookup (const JITDylibSearchOrder &SearchOrder, SymbolStringPtr Symbol, SymbolState RequiredState=SymbolState::Ready)
 Convenience version of blocking lookup.
 
LLVM_ABI Expected< ExecutorSymbolDeflookup (ArrayRef< JITDylib * > SearchOrder, SymbolStringPtr Symbol, SymbolState RequiredState=SymbolState::Ready)
 Convenience version of blocking lookup.
 
LLVM_ABI Expected< ExecutorSymbolDeflookup (ArrayRef< JITDylib * > SearchOrder, StringRef Symbol, SymbolState RequiredState=SymbolState::Ready)
 Convenience version of blocking lookup.
 
void dispatchTask (std::unique_ptr< Task > T)
 Materialize the given unit.
 
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.
 
void callWrapperAsync (ExecutorAddr WrapperFnAddr, ExecutorProcessControl::IncomingWFRHandler OnComplete, ArrayRef< char > ArgBuffer)
 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 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.
 
LLVM_ABI Error registerJITDispatchHandlers (JITDylib &JD, JITDispatchHandlerAssociationMap WFs)
 For each tag symbol name, associate the corresponding AsyncHandlerWrapperFunction with the address of that symbol.
 
LLVM_ABI void runJITDispatchHandler (SendResultFunction SendResult, ExecutorAddr HandlerFnTagAddr, ArrayRef< char > ArgBuffer)
 Run a registered jit-side wrapper function.
 
LLVM_ABI void dump (raw_ostream &OS)
 Dump the state of all the JITDylibs in this session.
 

Static Public Member Functions

template<typename SPSSignature , typename HandlerT >
static JITDispatchHandlerFunction wrapAsyncWithSPS (HandlerT &&H)
 Wrap a handler that takes concrete argument types (and a sender for a concrete return type) to produce an AsyncHandlerWrapperFunction.
 
template<typename SPSSignature , typename ClassT , typename... MethodArgTs>
static JITDispatchHandlerFunction wrapAsyncWithSPS (ClassT *Instance, void(ClassT::*Method)(MethodArgTs...))
 Wrap a class method that takes concrete argument types (and a sender for a concrete return type) to produce an AsyncHandlerWrapperFunction.
 

Friends

class InProgressLookupFlagsState
 
class InProgressFullLookupState
 
class JITDylib
 
class LookupState
 
class MaterializationResponsibility
 
class ResourceTracker
 

Detailed Description

An ExecutionSession represents a running JIT program.

Definition at line 1355 of file Core.h.

Member Typedef Documentation

◆ ErrorReporter

For reporting errors.

Definition at line 1365 of file Core.h.

◆ JITDispatchHandlerAssociationMap

A map associating tag names with asynchronous wrapper function implementations in the JIT.

Definition at line 1378 of file Core.h.

◆ JITDispatchHandlerFunction

An asynchronous wrapper-function callable from the executor via jit-dispatch.

Definition at line 1372 of file Core.h.

◆ SendResultFunction

Send a result to the remote.

Definition at line 1368 of file Core.h.

Constructor & Destructor Documentation

◆ ExecutionSession()

llvm::orc::ExecutionSession::ExecutionSession ( std::unique_ptr< ExecutorProcessControl EPC)

Construct an ExecutionSession with the given ExecutorProcessControl object.

Definition at line 1605 of file Core.cpp.

◆ ~ExecutionSession()

llvm::orc::ExecutionSession::~ExecutionSession ( )

Destroy an ExecutionSession.

Verifies that endSession was called prior to destruction.

Definition at line 1611 of file Core.cpp.

References assert().

Member Function Documentation

◆ callSPSWrapper()

template<typename SPSSignature , typename... WrapperCallArgTs>
Error llvm::orc::ExecutionSession::callSPSWrapper ( ExecutorAddr  WrapperFnAddr,
WrapperCallArgTs &&...  WrapperCallArgs 
)
inline

Run a wrapper function using SPS to serialize the arguments and deserialize the results.

If SPSSignature is a non-void function signature then the second argument (the first in the Args list) should be a reference to a return value.

Definition at line 1652 of file Core.h.

Referenced by llvm::orc::ORCPlatformSupport::deinitialize(), and llvm::orc::EPCDebugObjectRegistrar::registerDebugObject().

◆ callSPSWrapperAsync()

template<typename SPSSignature , typename SendResultT , typename... ArgTs>
void llvm::orc::ExecutionSession::callSPSWrapperAsync ( ExecutorAddr  WrapperFnAddr,
SendResultT &&  SendResult,
const ArgTs &...  Args 
)
inline

Run a wrapper function using SPS to serialize the arguments and deserialize the results.

Definition at line 1640 of file Core.h.

◆ callWrapper()

shared::WrapperFunctionResult llvm::orc::ExecutionSession::callWrapper ( ExecutorAddr  WrapperFnAddr,
ArrayRef< char ArgBuffer 
)
inline

Run a wrapper function in the executor.

The wrapper function should be callable as:

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

{.cpp}

Definition at line 1632 of file Core.h.

◆ callWrapperAsync() [1/3]

void llvm::orc::ExecutionSession::callWrapperAsync ( ExecutorAddr  WrapperFnAddr,
ExecutorProcessControl::IncomingWFRHandler  OnComplete,
ArrayRef< char ArgBuffer 
)
inline

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);

{.cpp}

Definition at line 1602 of file Core.h.

◆ callWrapperAsync() [2/3]

template<typename FnT >
void llvm::orc::ExecutionSession::callWrapperAsync ( ExecutorAddr  WrapperFnAddr,
FnT &&  OnComplete,
ArrayRef< char ArgBuffer 
)
inline

Run a wrapper function in the executor.

OnComplete will be dispatched as a GenericNamedTask using this instance's TaskDispatch object.

Definition at line 1620 of file Core.h.

◆ callWrapperAsync() [3/3]

template<typename RunPolicyT , typename FnT >
void llvm::orc::ExecutionSession::callWrapperAsync ( RunPolicyT &&  Runner,
ExecutorAddr  WrapperFnAddr,
FnT &&  OnComplete,
ArrayRef< char ArgBuffer 
)
inline

Run a wrapper function in the executor using the given Runner to dispatch OnComplete when the result is ready.

Definition at line 1611 of file Core.h.

◆ createBareJITDylib()

JITDylib & llvm::orc::ExecutionSession::createBareJITDylib ( std::string  Name)

Add a new bare JITDylib to this ExecutionSession.

The JITDylib Name is required to be unique. Clients should verify that names are not being re-used (E.g. by calling getJITDylibByName) if names are based on user input.

This call does not install any library code or symbols into the newly created JITDylib. The client is responsible for all configuration.

Definition at line 1665 of file Core.cpp.

References assert(), getJITDylibByName(), JITDylib, Name, and runSessionLocked().

Referenced by llvm::orc::COFFPlatform::Create(), createJITDylib(), llvm::orc::ExecutorNativePlatform::operator()(), and llvm::orc::LLJITBuilderState::prepareForConstruction().

◆ createJITDylib()

Expected< JITDylib & > llvm::orc::ExecutionSession::createJITDylib ( std::string  Name)

Add a new JITDylib to this ExecutionSession.

The JITDylib Name is required to be unique. Clients should verify that names are not being re-used (e.g. by calling getJITDylibByName) if names are based on user input.

If a Platform is attached then Platform::setupJITDylib will be called to install standard platform symbols (e.g. standard library interposes). If no Platform is attached this call is equivalent to createBareJITDylib.

Definition at line 1674 of file Core.cpp.

References createBareJITDylib(), and Name.

◆ deregisterResourceManager()

void llvm::orc::ExecutionSession::deregisterResourceManager ( ResourceManager RM)

Deregister the given ResourceManager with this ExecutionSession.

Manager must have been previously registered.

Definition at line 1643 of file Core.cpp.

References assert(), llvm::find(), I, and runSessionLocked().

Referenced by llvm::orc::LinkGraphLinkingLayer::~LinkGraphLinkingLayer().

◆ dispatchTask()

void llvm::orc::ExecutionSession::dispatchTask ( std::unique_ptr< Task T)
inline

Materialize the given unit.

Definition at line 1564 of file Core.h.

References assert(), and DEBUG_WITH_TYPE.

◆ dump()

void llvm::orc::ExecutionSession::dump ( raw_ostream OS)

Dump the state of all the JITDylibs in this session.

Definition at line 1958 of file Core.cpp.

References OS, and runSessionLocked().

◆ endSession()

Error llvm::orc::ExecutionSession::endSession ( )

End the session.

Closes all JITDylibs and disconnects from the executor. Clients must call this method before destroying the session.

Definition at line 1617 of file Core.cpp.

References llvm::dbgs(), llvm::joinErrors(), LLVM_DEBUG, removeJITDylibs(), and runSessionLocked().

◆ getBootstrapMap()

const StringMap< std::vector< char > > & llvm::orc::ExecutionSession::getBootstrapMap ( ) const
inline

Returns the bootstrap map.

Definition at line 1571 of file Core.h.

◆ getBootstrapMapValue()

template<typename T , typename SPSTagT >
Error llvm::orc::ExecutionSession::getBootstrapMapValue ( StringRef  Key,
std::optional< T > &  Val 
) const
inline

Look up and SPS-deserialize a bootstrap map value.

Definition at line 1577 of file Core.h.

References T.

◆ getBootstrapSymbols()

Error llvm::orc::ExecutionSession::getBootstrapSymbols ( ArrayRef< std::pair< ExecutorAddr &, StringRef > >  Pairs) const
inline

For each (ExecutorAddr&, StringRef) pair, looks up the string in the bootstrap symbols map and writes its address to the ExecutorAddr if found.

If any symbol is not found then the function returns an error.

Definition at line 1589 of file Core.h.

◆ getBootstrapSymbolsMap()

const StringMap< ExecutorAddr > & llvm::orc::ExecutionSession::getBootstrapSymbolsMap ( ) const
inline

Returns the bootstrap symbol map.

Definition at line 1582 of file Core.h.

◆ getExecutorProcessControl()

ExecutorProcessControl & llvm::orc::ExecutionSession::getExecutorProcessControl ( )
inline

◆ getJITDylibByName()

JITDylib * llvm::orc::ExecutionSession::getJITDylibByName ( StringRef  Name)

Return a pointer to the "name" JITDylib.

Ownership of JITDylib remains within Execution Session

Definition at line 1656 of file Core.cpp.

References Name, and runSessionLocked().

Referenced by createBareJITDylib().

◆ getPageSize()

size_t llvm::orc::ExecutionSession::getPageSize ( ) const
inline

Definition at line 1401 of file Core.h.

◆ getPlatform()

Platform * llvm::orc::ExecutionSession::getPlatform ( )
inline

Get the Platform for this session.

Will return null if no Platform has been set for this ExecutionSession.

Definition at line 1416 of file Core.h.

References P.

Referenced by llvm::orc::JITDylib::define().

◆ getSymbolStringPool()

std::shared_ptr< SymbolStringPool > llvm::orc::ExecutionSession::getSymbolStringPool ( )
inline

◆ getTargetTriple()

const Triple & llvm::orc::ExecutionSession::getTargetTriple ( ) const
inline

◆ intern()

SymbolStringPtr llvm::orc::ExecutionSession::intern ( StringRef  SymName)
inline

◆ lookup() [1/5]

Expected< ExecutorSymbolDef > llvm::orc::ExecutionSession::lookup ( ArrayRef< JITDylib * >  SearchOrder,
StringRef  Symbol,
SymbolState  RequiredState = SymbolState::Ready 
)

Convenience version of blocking lookup.

Searches each of the JITDylibs in the search order in turn for the given symbol. The search will not find non-exported symbols.

Definition at line 1893 of file Core.cpp.

References intern(), lookup(), and Name.

◆ lookup() [2/5]

Expected< ExecutorSymbolDef > llvm::orc::ExecutionSession::lookup ( ArrayRef< JITDylib * >  SearchOrder,
SymbolStringPtr  Symbol,
SymbolState  RequiredState = SymbolState::Ready 
)

Convenience version of blocking lookup.

Searches each of the JITDylibs in the search order in turn for the given symbol. The search will not find non-exported symbols.

Definition at line 1887 of file Core.cpp.

References lookup(), llvm::orc::makeJITDylibSearchOrder(), and Name.

◆ lookup() [3/5]

Expected< SymbolMap > llvm::orc::ExecutionSession::lookup ( const JITDylibSearchOrder SearchOrder,
SymbolLookupSet  Symbols,
LookupKind  K = LookupKind::Static,
SymbolState  RequiredState = SymbolState::Ready,
RegisterDependenciesFunction  RegisterDependencies = NoDependenciesToRegister 
)

Blocking version of lookup above.

Returns the resolved symbol map. If WaitUntilReady is true (the default), will not return until all requested symbols are ready (or an error occurs). If WaitUntilReady is false, will return as soon as all requested symbols are resolved, or an error occurs. If WaitUntilReady is false and an error occurs after resolution, the function will return a success value, but the error will be reported via reportErrors.

Definition at line 1833 of file Core.cpp.

References _, lookup(), llvm::orc::Result, and llvm::Error::success().

◆ lookup() [4/5]

Expected< ExecutorSymbolDef > llvm::orc::ExecutionSession::lookup ( const JITDylibSearchOrder SearchOrder,
SymbolStringPtr  Symbol,
SymbolState  RequiredState = SymbolState::Ready 
)

Convenience version of blocking lookup.

Searches each of the JITDylibs in the search order in turn for the given symbol.

Definition at line 1873 of file Core.cpp.

References assert(), lookup(), Name, llvm::orc::NoDependenciesToRegister, and llvm::orc::Static.

◆ lookup() [5/5]

void llvm::orc::ExecutionSession::lookup ( LookupKind  K,
const JITDylibSearchOrder SearchOrder,
SymbolLookupSet  Symbols,
SymbolState  RequiredState,
SymbolsResolvedCallback  NotifyComplete,
RegisterDependenciesFunction  RegisterDependencies 
)

Search the given JITDylibs for the given symbols.

SearchOrder lists the JITDylibs to search. For each dylib, the associated boolean indicates whether the search should match against non-exported (hidden visibility) symbols in that dylib (true means match against non-exported symbols, false means do not match).

The NotifyComplete callback will be called once all requested symbols reach the required state.

If all symbols are found, the RegisterDependencies function will be called while the session lock is held. This gives clients a chance to register dependencies for on the queried symbols for any symbols they are materializing (if a MaterializationResponsibility instance is present, this can be implemented by calling MaterializationResponsibility::addDependencies). If there are no dependenant symbols for this query (e.g. it is being made by a top level client to get an address to call) then the value NoDependenciesToRegister can be used.

Definition at line 1803 of file Core.cpp.

References llvm::dbgs(), LLVM_DEBUG, runSessionLocked(), and llvm::Error::success().

Referenced by llvm::orc::GDBJITDebugInfoRegistrationPlugin::Create(), llvm::orc::JITCompileCallbackManager::executeCompileCallback(), lookup(), llvm::orc::lookupAndRecordAddrs(), llvm::orc::Platform::lookupInitSymbols(), llvm::orc::Platform::lookupInitSymbolsAsync(), registerJITDispatchHandlers(), llvm::orc::Speculator::registerSymbols(), llvm::orc::LazyCallThroughManager::resolveTrampolineLandingAddress(), llvm::orc::COFFPlatform::setupJITDylib(), llvm::orc::ELFNixPlatform::setupJITDylib(), and llvm::orc::DLLImportDefinitionGenerator::tryToGenerate().

◆ lookupFlags() [1/2]

Expected< SymbolFlagsMap > llvm::orc::ExecutionSession::lookupFlags ( LookupKind  K,
JITDylibSearchOrder  SearchOrder,
SymbolLookupSet  Symbols 
)

Blocking version of lookupFlags.

Definition at line 1788 of file Core.cpp.

References llvm::orc::Result, and llvm::Error::success().

◆ lookupFlags() [2/2]

void llvm::orc::ExecutionSession::lookupFlags ( LookupKind  K,
JITDylibSearchOrder  SearchOrder,
SymbolLookupSet  Symbols,
unique_function< void(Expected< SymbolFlagsMap >)>  OnComplete 
)

Search the given JITDylibs to find the flags associated with each of the given symbols.

Definition at line 1777 of file Core.cpp.

References llvm::Error::success().

Referenced by llvm::orc::buildSimpleReexportsAliasMap(), and llvm::orc::ReexportsGenerator::tryToGenerate().

◆ registerJITDispatchHandlers()

Error llvm::orc::ExecutionSession::registerJITDispatchHandlers ( JITDylib JD,
JITDispatchHandlerAssociationMap  WFs 
)

For each tag symbol name, associate the corresponding AsyncHandlerWrapperFunction with the address of that symbol.

The handler becomes callable from the executor using the ORC runtime __orc_rt_jit_dispatch function and the given tag.

Tag symbols will be looked up in JD using LookupKind::Static, JITDylibLookupFlags::MatchAllSymbols (hidden tags will be found), and LookupFlags::WeaklyReferencedSymbol. Missing tag definitions will not cause an error, the handler will simply be dropped.

Definition at line 1898 of file Core.cpp.

References assert(), llvm::dbgs(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::formatv(), llvm::orc::SymbolLookupSet::fromMapKeys(), I, llvm::inconvertibleErrorCode(), LLVM_DEBUG, lookup(), llvm::orc::MatchAllSymbols, llvm::Error::success(), and llvm::orc::WeaklyReferencedSymbol.

Referenced by llvm::orc::ReOptimizeLayer::reigsterRuntimeFunctions().

◆ registerResourceManager()

void llvm::orc::ExecutionSession::registerResourceManager ( ResourceManager RM)

Register the given ResourceManager with this ExecutionSession.

Managers will be notified of events in reverse order of registration.

Definition at line 1639 of file Core.cpp.

References runSessionLocked().

Referenced by llvm::orc::LinkGraphLinkingLayer::LinkGraphLinkingLayer(), and llvm::orc::RTDyldObjectLinkingLayer::RTDyldObjectLinkingLayer().

◆ removeJITDylib()

Error llvm::orc::ExecutionSession::removeJITDylib ( JITDylib JD)
inline

Calls removeJTIDylibs on the gives JITDylib.

Definition at line 1477 of file Core.h.

References removeJITDylibs().

◆ removeJITDylibs()

Error llvm::orc::ExecutionSession::removeJITDylibs ( std::vector< JITDylibSP JDsToRemove)

Removes the given JITDylibs from the ExecutionSession.

This method clears all resources held for the JITDylibs, puts them in the closed state, and clears all references to them that are held by the ExecutionSession or other JITDylibs. No further code can be added to the removed JITDylibs, and the JITDylib objects will be freed once any remaining JITDylibSPs pointing to them are destroyed.

This method does not run static destructors for code contained in the JITDylibs, and each JITDylib can only be removed once.

JITDylibs will be removed in the order given. Teardown is usually independent for each JITDylib, but not always. In particular, where the ORC runtime is used it is expected that teardown off all JITDylibs will depend on it, so the JITDylib containing the ORC runtime must be removed last. If the client has introduced any other dependencies they should be accounted for in the removal order too.

Definition at line 1682 of file Core.cpp.

References assert(), llvm::find(), I, llvm::joinErrors(), runSessionLocked(), and llvm::Error::success().

Referenced by endSession(), and removeJITDylib().

◆ reportError()

void llvm::orc::ExecutionSession::reportError ( Error  Err)
inline

◆ runJITDispatchHandler()

void llvm::orc::ExecutionSession::runJITDispatchHandler ( SendResultFunction  SendResult,
ExecutorAddr  HandlerFnTagAddr,
ArrayRef< char ArgBuffer 
)

Run a registered jit-side wrapper function.

This should be called by the ExecutorProcessControl instance in response to incoming jit-dispatch requests from the executor.

Definition at line 1937 of file Core.cpp.

References llvm::orc::shared::WrapperFunctionResult::createOutOfBandError(), llvm::ArrayRef< T >::data(), F, llvm::formatv(), I, and llvm::ArrayRef< T >::size().

◆ runSessionLocked()

template<typename Func >
decltype(auto) llvm::orc::ExecutionSession::runSessionLocked ( Func &&  F)
inline

◆ setErrorReporter()

ExecutionSession & llvm::orc::ExecutionSession::setErrorReporter ( ErrorReporter  ReportError)
inline

Set the error reporter function.

Definition at line 1482 of file Core.h.

◆ setPlatform()

void llvm::orc::ExecutionSession::setPlatform ( std::unique_ptr< Platform P)
inline

Set the Platform for this ExecutionSession.

Definition at line 1412 of file Core.h.

References P.

Referenced by llvm::orc::ExecutorNativePlatform::operator()().

◆ wrapAsyncWithSPS() [1/2]

template<typename SPSSignature , typename ClassT , typename... MethodArgTs>
static JITDispatchHandlerFunction llvm::orc::ExecutionSession::wrapAsyncWithSPS ( ClassT *  Instance,
void(ClassT::*)(MethodArgTs...)  Method 
)
inlinestatic

Wrap a class method that takes concrete argument types (and a sender for a concrete return type) to produce an AsyncHandlerWrapperFunction.

Uses SPS to unpack the arguments and pack the result.

This function is intended to support easy construction of AsyncHandlerWrapperFunctions that can be associated with a tag (using registerJITDispatchHandler) and called from the executor.

Definition at line 1684 of file Core.h.

References llvm::orc::Instance.

◆ wrapAsyncWithSPS() [2/2]

template<typename SPSSignature , typename HandlerT >
static JITDispatchHandlerFunction llvm::orc::ExecutionSession::wrapAsyncWithSPS ( HandlerT &&  H)
inlinestatic

Wrap a handler that takes concrete argument types (and a sender for a concrete return type) to produce an AsyncHandlerWrapperFunction.

Uses SPS to unpack the arguments and pack the result.

This function is intended to support easy construction of AsyncHandlerWrapperFunctions that can be associated with a tag (using registerJITDispatchHandler) and called from the executor.

Definition at line 1666 of file Core.h.

References H.

Referenced by llvm::orc::ReOptimizeLayer::reigsterRuntimeFunctions().

Friends And Related Function Documentation

◆ InProgressFullLookupState

friend class InProgressFullLookupState
friend

Definition at line 1357 of file Core.h.

◆ InProgressLookupFlagsState

friend class InProgressLookupFlagsState
friend

Definition at line 1356 of file Core.h.

◆ JITDylib

friend class JITDylib
friend

Definition at line 1358 of file Core.h.

Referenced by createBareJITDylib().

◆ LookupState

friend class LookupState
friend

Definition at line 1359 of file Core.h.

◆ MaterializationResponsibility

friend class MaterializationResponsibility
friend

Definition at line 1360 of file Core.h.

◆ ResourceTracker

friend class ResourceTracker
friend

Definition at line 1361 of file Core.h.


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