LLVM
8.0.1
|
A symbol table that supports asynchoronous symbol queries. More...
#include "llvm/ExecutionEngine/Orc/Core.h"
Public Types | |
using | GeneratorFunction = std::function< SymbolNameSet(JITDylib &Parent, const SymbolNameSet &Names)> |
using | AsynchronousSymbolQuerySet = std::set< std::shared_ptr< AsynchronousSymbolQuery > > |
Public Member Functions | |
JITDylib (const JITDylib &)=delete | |
JITDylib & | operator= (const JITDylib &)=delete |
JITDylib (JITDylib &&)=delete | |
JITDylib & | operator= (JITDylib &&)=delete |
const std::string & | getName () const |
Get the name for this JITDylib. More... | |
ExecutionSession & | getExecutionSession () const |
Get a reference to the ExecutionSession for this JITDylib. More... | |
void | setGenerator (GeneratorFunction DefGenerator) |
Set a definition generator. More... | |
void | setSearchOrder (JITDylibSearchList NewSearchOrder, bool SearchThisJITDylibFirst=true, bool MatchNonExportedInThisDylib=true) |
Set the search order to be used when fixing up definitions in JITDylib. More... | |
void | addToSearchOrder (JITDylib &JD, bool MatcNonExported=false) |
Add the given JITDylib to the search order for definitions in this JITDylib. More... | |
void | replaceInSearchOrder (JITDylib &OldJD, JITDylib &NewJD, bool MatchNonExported=false) |
Replace OldJD with NewJD in the search order if OldJD is present. More... | |
void | removeFromSearchOrder (JITDylib &JD) |
Remove the given JITDylib from the search order for this JITDylib if it is present. More... | |
template<typename Func > | |
auto | withSearchOrderDo (Func &&F) -> decltype(F(std::declval< const JITDylibSearchList &>())) |
Do something with the search order (run under the session lock). More... | |
template<typename MaterializationUnitType > | |
Error | define (std::unique_ptr< MaterializationUnitType > &&MU) |
Define all symbols provided by the materialization unit to be part of this JITDylib. More... | |
template<typename MaterializationUnitType > | |
Error | define (std::unique_ptr< MaterializationUnitType > &MU) |
Define all symbols provided by the materialization unit to be part of this JITDylib. More... | |
Error | remove (const SymbolNameSet &Names) |
Tries to remove the given symbols. More... | |
SymbolFlagsMap | lookupFlags (const SymbolNameSet &Names) |
Search the given JITDylib for the symbols in Symbols. More... | |
void | dump (raw_ostream &OS) |
Dump current JITDylib state to OS. More... | |
SymbolNameSet | legacyLookup (std::shared_ptr< AsynchronousSymbolQuery > Q, SymbolNameSet Names) |
FIXME: Remove this when we remove the old ORC layers. More... | |
Friends | |
class | AsynchronousSymbolQuery |
class | ExecutionSession |
class | MaterializationResponsibility |
A symbol table that supports asynchoronous symbol queries.
Represents a virtual shared object. Instances can not be copied or moved, so their addresses may be used as keys for resource management. JITDylib state changes must be made via an ExecutionSession to guarantee that they are synchronized with respect to other JITDylib operations.
using llvm::orc::JITDylib::AsynchronousSymbolQuerySet = std::set<std::shared_ptr<AsynchronousSymbolQuery> > |
using llvm::orc::JITDylib::GeneratorFunction = std::function<SymbolNameSet( JITDylib &Parent, const SymbolNameSet &Names)> |
|
delete |
Error llvm::orc::JITDylib::define | ( | std::unique_ptr< MaterializationUnitType > && | MU | ) |
Define all symbols provided by the materialization unit to be part of this JITDylib.
This overload always takes ownership of the MaterializationUnit. If any errors occur, the MaterializationUnit consumed.
defineImpl succeeded.
Definition at line 881 of file Core.h.
References assert().
Referenced by llvm::orc::IRLayer::add(), llvm::orc::ObjectLayer::add(), llvm::orc::LocalCXXRuntimeOverrides::enable(), llvm::orc::DynamicLibrarySearchGenerator::operator()(), and llvm::orc::ReexportsGenerator::operator()().
Error llvm::orc::JITDylib::define | ( | std::unique_ptr< MaterializationUnitType > & | MU | ) |
Define all symbols provided by the materialization unit to be part of this JITDylib.
This overload only takes ownership of the MaterializationUnit no error is generated. If an error occurs, ownership remains with the caller. This may allow the caller to modify the MaterializationUnit to correct the issue, then re-call define.
defineImpl succeeded.
Definition at line 897 of file Core.h.
References assert().
void llvm::orc::JITDylib::dump | ( | raw_ostream & | OS | ) |
Dump current JITDylib state to OS.
Definition at line 1394 of file Core.cpp.
References assert(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::begin(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::count(), llvm::orc::MaterializationUnit::doDiscard(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::erase(), llvm::find_if(), llvm::format(), llvm::orc::MaterializationUnit::getSymbols(), I, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), JITDylib(), llvm::JITSymbolFlags::Lazy, llvm::JITSymbolFlags::Materializing, MI, and llvm::Error::success().
Referenced by llvm::orc::ExecutionSession::dump().
|
inline |
Get a reference to the ExecutionSession for this JITDylib.
Definition at line 516 of file Core.h.
Referenced by llvm::orc::BasicIRLayerMaterializationUnit::BasicIRLayerMaterializationUnit(), llvm::orc::IRMaterializationUnit::getName(), llvm::orc::LazyReexportsMaterializationUnit::getName(), llvm::orc::ReExportsMaterializationUnit::getName(), and llvm::orc::MaterializationResponsibility::replace().
|
inline |
Get the name for this JITDylib.
Definition at line 513 of file Core.h.
Referenced by llvm::orc::ExecutionSession::dispatchMaterialization(), llvm::orc::IRMaterializationUnit::getName(), llvm::orc::MaterializationResponsibility::replace(), and llvm::orc::MaterializationResponsibility::resolve().
SymbolNameSet llvm::orc::JITDylib::legacyLookup | ( | std::shared_ptr< AsynchronousSymbolQuery > | Q, |
SymbolNameSet | Names | ||
) |
FIXME: Remove this when we remove the old ORC layers.
Search the given JITDylibs in order for the symbols in Symbols. Results (once they become available) will be returned via the given Query.
If any symbol is not found then the unresolved symbols will be returned, and the query will not be applied. The Query is not failed and can be re-used in a subsequent lookup once the symbols have been added, or manually failed.
Definition at line 1269 of file Core.cpp.
References assert(), D, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::erase(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::Lock, llvm::JITSymbolFlags::Materializing, MI, Name, and llvm::None.
SymbolFlagsMap llvm::orc::JITDylib::lookupFlags | ( | const SymbolNameSet & | Names | ) |
Search the given JITDylib for the symbols in Symbols.
If found, store the flags for each symbol in Flags. Returns any unresolved symbols.
Definition at line 1146 of file Core.cpp.
References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), D, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::erase(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), I, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::JITSymbolFlags::Materializing, MI, Name, and llvm::JITSymbolFlags::stripTransientFlags().
Referenced by llvm::orc::buildSimpleReexportsAliasMap(), and llvm::orc::ReexportsGenerator::operator()().
Error llvm::orc::JITDylib::remove | ( | const SymbolNameSet & | Names | ) |
Tries to remove the given symbols.
If any symbols are not defined in this JITDylib this method will return a SymbolsNotFound error covering the missing symbols.
If all symbols are found but some symbols are in the process of being materialized this method will return a SymbolsCouldNotBeRemoved error.
On success, all symbols are removed. On failure, the JITDylib state is left unmodified (no symbols are removed).
Definition at line 1092 of file Core.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::erase(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), I, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), and llvm::Error::success().
void llvm::orc::JITDylib::removeFromSearchOrder | ( | JITDylib & | JD | ) |
void llvm::orc::JITDylib::replaceInSearchOrder | ( | JITDylib & | OldJD, |
JITDylib & | NewJD, | ||
bool | MatchNonExported = false |
||
) |
Replace OldJD with NewJD in the search order if OldJD is present.
Otherwise this operation is a no-op.
Definition at line 1068 of file Core.cpp.
References llvm::find_if(), and I.
|
inline |
Set a definition generator.
If set, whenever a symbol fails to resolve within this JITDylib, lookup and lookupFlags will pass the unresolved symbols set to the definition generator. The generator can optionally add a definition for the unresolved symbols to the dylib.
Definition at line 522 of file Core.h.
References llvm::dump(), F(), LLVM_MARK_AS_BITMASK_ENUM, Name, llvm::None, and replace().
void llvm::orc::JITDylib::setSearchOrder | ( | JITDylibSearchList | NewSearchOrder, |
bool | SearchThisJITDylibFirst = true , |
||
bool | MatchNonExportedInThisDylib = true |
||
) |
Set the search order to be used when fixing up definitions in JITDylib.
This will replace the previous search order, and apply to any symbol resolutions made for definitions in this JITDylib after the call to setSearchOrder (even if the definition itself was added before the call).
If SearchThisJITDylibFirst is set, which by default it is, then this JITDylib will add itself to the beginning of the SearchOrder (Clients should not put this JITDylib in the list in this case, to avoid redundant lookups).
If SearchThisJITDylibFirst is false then the search order will be used as given. The main motivation for this feature is to support deliberate shadowing of symbols in this JITDylib by a facade JITDylib. For example, the facade may resolve function names to stubs, and the stubs may compile lazily by looking up symbols in this dylib. Adding the facade dylib as the first in the search order (instead of this dylib) ensures that definitions within this dylib resolve to the lazy-compiling stubs, rather than immediately materializing the definitions in this dylib.
auto llvm::orc::JITDylib::withSearchOrderDo | ( | Func && | F | ) | -> decltype(F(std::declval<const JITDylibSearchList &>())) |
|
friend |
|
friend |
|
friend |