|
LLVM
10.0.0
|
A symbol table that supports asynchoronous symbol queries. More...
#include "llvm/ExecutionEngine/Orc/Core.h"
Classes | |
| class | DefinitionGenerator |
| Definition generators can be attached to JITDylibs to generate new definitions for otherwise unresolved symbols during lookup. More... | |
Public Types | |
| 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... | |
| template<typename GeneratorT > | |
| GeneratorT & | addGenerator (std::unique_ptr< GeneratorT > DefGenerator) |
| Adds a definition generator to this JITDylib and returns a referenece to it. More... | |
| void | removeGenerator (DefinitionGenerator &G) |
| Remove a definition generator from this JITDylib. More... | |
| void | setSearchOrder (JITDylibSearchOrder NewSearchOrder, bool SearchThisJITDylibFirst=true) |
| Set the search order to be used when fixing up definitions in JITDylib. More... | |
| void | addToSearchOrder (JITDylib &JD, JITDylibLookupFlags JDLookupFlags=JITDylibLookupFlags::MatchExportedSymbolsOnly) |
| Add the given JITDylib to the search order for definitions in this JITDylib. More... | |
| void | replaceInSearchOrder (JITDylib &OldJD, JITDylib &NewJD, JITDylibLookupFlags JDLookupFlags=JITDylibLookupFlags::MatchExportedSymbolsOnly) |
| 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 JITDylibSearchOrder &>())) |
| 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... | |
| Expected< SymbolFlagsMap > | lookupFlags (LookupKind K, JITDylibLookupFlags JDLookupFlags, SymbolLookupSet LookupSet) |
| Search the given JITDylib for the symbols in Symbols. More... | |
| void | dump (raw_ostream &OS) |
| Dump current JITDylib state to OS. More... | |
| Expected< 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> > |
|
delete |
| GeneratorT & llvm::orc::JITDylib::addGenerator | ( | std::unique_ptr< GeneratorT > | DefGenerator | ) |
Adds a definition generator to this JITDylib and returns a referenece to it.
When JITDylibs are searched during lookup, if no existing definition of a symbol is found, then any generators that have been added are run (in the order that they were added) to potentially generate a definition.
Definition at line 1239 of file Core.h.
References G.
| void llvm::orc::JITDylib::addToSearchOrder | ( | JITDylib & | JD, |
| JITDylibLookupFlags | JDLookupFlags = JITDylibLookupFlags::MatchExportedSymbolsOnly |
||
| ) |
| 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 1253 of file Core.h.
References assert().
Referenced by llvm::orc::IRLayer::add(), llvm::orc::ObjectLayer::add(), llvm::orc::Speculator::addSpeculationRuntime(), llvm::orc::LocalCXXRuntimeOverrides::enable(), llvm::orc::DynamicLibrarySearchGenerator::tryToGenerate(), and llvm::orc::ReexportsGenerator::tryToGenerate().
| 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 1269 of file Core.h.
References assert().
| void llvm::orc::JITDylib::dump | ( | raw_ostream & | OS | ) |
Dump current JITDylib state to OS.
Definition at line 1704 of file Core.cpp.
References assert(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::begin(), llvm::orc::MaterializationUnit::doDiscard(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty(), llvm::find_if(), llvm::format(), llvm::orc::MaterializationUnit::getSymbols(), I, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), JITDylib(), llvm::lower_bound(), llvm::orc::MatchAllSymbols, MI, Name, llvm::orc::NeverSearched, and llvm::Error::success().
|
inline |
Get a reference to the ExecutionSession for this JITDylib.
Definition at line 808 of file Core.h.
References assert(), llvm::dump(), llvm::orc::Emitted, F(), G, getFlags(), llvm::orc::MatchExportedSymbolsOnly, llvm::orc::Materializing, Name, llvm::orc::NeverSearched, llvm::replace(), and llvm::orc::Resolved.
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 805 of file Core.h.
Referenced by llvm::orc::BasicIRLayerMaterializationUnit::BasicIRLayerMaterializationUnit(), llvm::orc::MaterializationResponsibility::defineMaterializing(), llvm::orc::ExecutionSession::dispatchMaterialization(), llvm::orc::MaterializationResponsibility::failMaterialization(), llvm::orc::IRMaterializationUnit::getName(), llvm::orc::ReExportsMaterializationUnit::getName(), llvm::orc::MaterializationResponsibility::notifyEmitted(), llvm::orc::MaterializationResponsibility::notifyResolved(), and llvm::orc::MaterializationResponsibility::replace().
| Expected< 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 1583 of file Core.cpp.
References assert().
| Expected< SymbolFlagsMap > llvm::orc::JITDylib::lookupFlags | ( | LookupKind | K, |
| JITDylibLookupFlags | JDLookupFlags, | ||
| SymbolLookupSet | LookupSet | ||
| ) |
Search the given JITDylib for the symbols in Symbols.
If found, store the flags for each symbol in Flags. If any required symbols are not found then an error will be returned.
Definition at line 1443 of file Core.cpp.
References llvm::orc::SymbolLookupSet::empty().
Referenced by llvm::orc::buildSimpleReexportsAliasMap(), and llvm::orc::ReexportsGenerator::tryToGenerate().
| 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 1387 of file Core.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty(), I, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::orc::Materializing, Name, and llvm::Error::success().
| void llvm::orc::JITDylib::removeFromSearchOrder | ( | JITDylib & | JD | ) |
| void llvm::orc::JITDylib::removeGenerator | ( | DefinitionGenerator & | G | ) |
Remove a definition generator from this JITDylib.
The given generator must exist in this JITDylib's generators list (i.e. have been added and not yet removed).
Definition at line 805 of file Core.cpp.
References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::begin(), llvm::JITSymbolFlags::Common, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::orc::Emitted, 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(), llvm::find_if(), G, getFlags(), H, llvm::JITSymbolFlags::HasError, I, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::orc::Materializing, MI, Name, llvm::orc::Ready, llvm::orc::Resolved, SI, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size(), llvm::Error::success(), and llvm::JITSymbolFlags::Weak.
| void llvm::orc::JITDylib::replaceInSearchOrder | ( | JITDylib & | OldJD, |
| JITDylib & | NewJD, | ||
| JITDylibLookupFlags | JDLookupFlags = JITDylibLookupFlags::MatchExportedSymbolsOnly |
||
| ) |
| void llvm::orc::JITDylib::setSearchOrder | ( | JITDylibSearchOrder | NewSearchOrder, |
| bool | SearchThisJITDylibFirst = 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.
Definition at line 1345 of file Core.cpp.
References llvm::orc::MatchAllSymbols.
| auto llvm::orc::JITDylib::withSearchOrderDo | ( | Func && | F | ) | -> decltype(F(std::declval<const JITDylibSearchOrder &>())) |
|
friend |
|
friend |
|
friend |
1.8.13