|
LLVM
10.0.0
|
An ExecutionSession represents a running JIT program. More...
#include "llvm/ExecutionEngine/Orc/Core.h"
Public Types | |
| using | ErrorReporter = std::function< void(Error)> |
| For reporting errors. More... | |
| using | DispatchMaterializationFunction = std::function< void(JITDylib &JD, std::unique_ptr< MaterializationUnit > MU)> |
| For dispatching MaterializationUnit::materialize calls. More... | |
| using | LegacyAsyncLookupFunction = std::function< SymbolNameSet(std::shared_ptr< AsynchronousSymbolQuery > Q, SymbolNameSet Names)> |
Public Member Functions | |
| ExecutionSession (std::shared_ptr< SymbolStringPool > SSP=nullptr) | |
| Construct an ExecutionSession. More... | |
| SymbolStringPtr | intern (StringRef SymName) |
| Add a symbol name to the SymbolStringPool and return a pointer to it. More... | |
| std::shared_ptr< SymbolStringPool > | getSymbolStringPool () const |
| Returns a shared_ptr to the SymbolStringPool for this ExecutionSession. More... | |
| template<typename Func > | |
| auto | runSessionLocked (Func &&F) -> decltype(F()) |
| Run the given lambda with the session mutex locked. More... | |
| JITDylib * | getJITDylibByName (StringRef Name) |
| Return a pointer to the "name" JITDylib. More... | |
| JITDylib & | createJITDylib (std::string Name) |
| Add a new JITDylib to this ExecutionSession. More... | |
| VModuleKey | allocateVModule () |
| Allocate a module key for a new module to add to the JIT. More... | |
| void | releaseVModule (VModuleKey Key) |
| Return a module key to the ExecutionSession so that it can be re-used. More... | |
| ExecutionSession & | setErrorReporter (ErrorReporter ReportError) |
| Set the error reporter function. More... | |
| void | reportError (Error Err) |
| Report a error for this execution session. More... | |
| ExecutionSession & | setDispatchMaterialization (DispatchMaterializationFunction DispatchMaterialization) |
| Set the materialization dispatch function. More... | |
| void | legacyFailQuery (AsynchronousSymbolQuery &Q, Error Err) |
| Expected< SymbolMap > | legacyLookup (LegacyAsyncLookupFunction AsyncLookup, SymbolNameSet Names, SymbolState RequiredState, RegisterDependenciesFunction RegisterDependencies) |
| A legacy lookup function for JITSymbolResolverAdapter. More... | |
| void | lookup (LookupKind K, const JITDylibSearchOrder &SearchOrder, SymbolLookupSet Symbols, SymbolState RequiredState, SymbolsResolvedCallback NotifyComplete, RegisterDependenciesFunction RegisterDependencies) |
| Search the given JITDylib list for the given symbols. More... | |
| Expected< SymbolMap > | lookup (const JITDylibSearchOrder &SearchOrder, const SymbolLookupSet &Symbols, LookupKind K=LookupKind::Static, SymbolState RequiredState=SymbolState::Ready, RegisterDependenciesFunction RegisterDependencies=NoDependenciesToRegister) |
| Blocking version of lookup above. More... | |
| Expected< JITEvaluatedSymbol > | lookup (const JITDylibSearchOrder &SearchOrder, SymbolStringPtr Symbol) |
| Convenience version of blocking lookup. More... | |
| Expected< JITEvaluatedSymbol > | lookup (ArrayRef< JITDylib *> SearchOrder, SymbolStringPtr Symbol) |
| Convenience version of blocking lookup. More... | |
| Expected< JITEvaluatedSymbol > | lookup (ArrayRef< JITDylib *> SearchOrder, StringRef Symbol) |
| Convenience version of blocking lookup. More... | |
| void | dispatchMaterialization (JITDylib &JD, std::unique_ptr< MaterializationUnit > MU) |
| Materialize the given unit. More... | |
| void | dump (raw_ostream &OS) |
| Dump the state of all the JITDylibs in this session. More... | |
Friends | |
| class | JITDylib |
An ExecutionSession represents a running JIT program.
| using llvm::orc::ExecutionSession::DispatchMaterializationFunction = std::function<void( JITDylib &JD, std::unique_ptr<MaterializationUnit> MU)> |
| using llvm::orc::ExecutionSession::ErrorReporter = std::function<void(Error)> |
| using llvm::orc::ExecutionSession::LegacyAsyncLookupFunction = std::function<SymbolNameSet( std::shared_ptr<AsynchronousSymbolQuery> Q, SymbolNameSet Names)> |
| llvm::orc::ExecutionSession::ExecutionSession | ( | std::shared_ptr< SymbolStringPool > | SSP = nullptr | ) |
Construct an ExecutionSession.
SymbolStringPools may be shared between ExecutionSessions.
|
inline |
| 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.
Definition at line 1893 of file Core.cpp.
References assert(), getJITDylibByName(), JITDylib, and runSessionLocked().
|
inline |
Materialize the given unit.
Definition at line 1196 of file Core.h.
References llvm::dbgs(), llvm::dump(), llvm::orc::JITDylib::getName(), and LLVM_DEBUG.
Referenced by dump().
| void llvm::orc::ExecutionSession::dump | ( | raw_ostream & | OS | ) |
Dump the state of all the JITDylibs in this session.
Definition at line 2165 of file Core.cpp.
References assert(), dispatchMaterialization(), llvm::Lock, and runSessionLocked().
Return a pointer to the "name" JITDylib.
Ownership of JITDylib remains within Execution Session
Definition at line 1884 of file Core.cpp.
References Name, and runSessionLocked().
Referenced by createJITDylib().
|
inline |
Returns a shared_ptr to the SymbolStringPool for this ExecutionSession.
|
inline |
Add a symbol name to the SymbolStringPool and return a pointer to it.
Definition at line 1076 of file Core.h.
Referenced by llvm::orc::getObjectSymbolFlags(), llvm::orc::JITSymbolResolverAdapter::getResponsibilitySet(), llvm::orc::JITSymbolResolverAdapter::lookup(), lookup(), and llvm::orc::MangleAndInterner::operator()().
| void llvm::orc::ExecutionSession::legacyFailQuery | ( | AsynchronousSymbolQuery & | Q, |
| Error | Err | ||
| ) |
Definition at line 1902 of file Core.cpp.
Referenced by llvm::orc::JITSymbolResolverAdapter::lookup(), and llvm::orc::lookupWithLegacyFn().
| Expected< SymbolMap > llvm::orc::ExecutionSession::legacyLookup | ( | LegacyAsyncLookupFunction | AsyncLookup, |
| SymbolNameSet | Names, | ||
| SymbolState | RequiredState, | ||
| RegisterDependenciesFunction | RegisterDependencies | ||
| ) |
A legacy lookup function for JITSymbolResolverAdapter.
Do not use – this will be removed soon.
Definition at line 1917 of file Core.cpp.
References _, runSessionLocked(), and llvm::Error::success().
| void llvm::orc::ExecutionSession::lookup | ( | LookupKind | K, |
| const JITDylibSearchOrder & | SearchOrder, | ||
| SymbolLookupSet | Symbols, | ||
| SymbolState | RequiredState, | ||
| SymbolsResolvedCallback | NotifyComplete, | ||
| RegisterDependenciesFunction | RegisterDependencies | ||
| ) |
Search the given JITDylib list 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 1984 of file Core.cpp.
References assert(), llvm::dbgs(), LLVM_DEBUG, and runSessionLocked().
Referenced by llvm::orc::LazyCallThroughManager::callThroughToSymbol(), and lookup().
| Expected< SymbolMap > llvm::orc::ExecutionSession::lookup | ( | const JITDylibSearchOrder & | SearchOrder, |
| const 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 2087 of file Core.cpp.
References _, lookup(), and llvm::Error::success().
| Expected< JITEvaluatedSymbol > llvm::orc::ExecutionSession::lookup | ( | const JITDylibSearchOrder & | SearchOrder, |
| SymbolStringPtr | Symbol | ||
| ) |
Convenience version of blocking lookup.
Searches each of the JITDylibs in the search order in turn for the given symbol.
Definition at line 2141 of file Core.cpp.
References assert(), lookup(), llvm::orc::NoDependenciesToRegister, llvm::orc::Ready, and llvm::orc::Static.
| Expected< JITEvaluatedSymbol > llvm::orc::ExecutionSession::lookup | ( | ArrayRef< JITDylib *> | SearchOrder, |
| SymbolStringPtr | Symbol | ||
| ) |
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 2155 of file Core.cpp.
References lookup(), and llvm::orc::makeJITDylibSearchOrder().
| Expected< JITEvaluatedSymbol > llvm::orc::ExecutionSession::lookup | ( | ArrayRef< JITDylib *> | SearchOrder, |
| StringRef | Symbol | ||
| ) |
|
inline |
Return a module key to the ExecutionSession so that it can be re-used.
This should only be done once all resources associated with the original key have been released.
|
inline |
Report a error for this execution session.
Unhandled errors can be sent here to log them.
Definition at line 1118 of file Core.h.
Referenced by llvm::orc::LazyCallThroughManager::callThroughToSymbol(), llvm::orc::ObjectTransformLayer::emit(), llvm::orc::IRTransformLayer::emit(), llvm::orc::IRCompileLayer::emit(), llvm::orc::RTDyldObjectLinkingLayer::emit(), and llvm::orc::LazyReexportsMaterializationUnit::getName().
|
inline |
Run the given lambda with the session mutex locked.
Definition at line 1082 of file Core.h.
References F(), llvm::Lock, and Name.
Referenced by createJITDylib(), dump(), getJITDylibByName(), llvm::orc::IRMaterializationUnit::getName(), legacyLookup(), lookup(), and llvm::orc::MaterializationResponsibility::replace().
|
inline |
|
inline |
|
friend |
Definition at line 1060 of file Core.h.
Referenced by createJITDylib().
1.8.13