LLVM  10.0.0svn
Classes | Public Types | Public Member Functions | Friends | List of all members
llvm::orc::JITDylib Class Reference

A symbol table that supports asynchoronous symbol queries. More...

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

Classes

class  DefinitionGenerator
 

Public Types

using AsynchronousSymbolQuerySet = std::set< std::shared_ptr< AsynchronousSymbolQuery > >
 

Public Member Functions

 JITDylib (const JITDylib &)=delete
 
JITDyliboperator= (const JITDylib &)=delete
 
 JITDylib (JITDylib &&)=delete
 
JITDyliboperator= (JITDylib &&)=delete
 
const std::string & getName () const
 Get the name for this JITDylib. More...
 
ExecutionSessiongetExecutionSession () 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 (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...
 
Expected< SymbolFlagsMaplookupFlags (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...
 
Expected< SymbolNameSetlegacyLookup (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
 

Detailed Description

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.

Definition at line 495 of file Core.h.

Member Typedef Documentation

◆ AsynchronousSymbolQuerySet

Definition at line 508 of file Core.h.

Constructor & Destructor Documentation

◆ JITDylib() [1/2]

llvm::orc::JITDylib::JITDylib ( const JITDylib )
delete

Referenced by dump().

◆ JITDylib() [2/2]

llvm::orc::JITDylib::JITDylib ( JITDylib &&  )
delete

Member Function Documentation

◆ addGenerator()

template<typename GeneratorT >
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 945 of file Core.h.

References G.

◆ addToSearchOrder()

void llvm::orc::JITDylib::addToSearchOrder ( JITDylib JD,
bool  MatcNonExported = false 
)

Add the given JITDylib to the search order for definitions in this JITDylib.

Definition at line 1265 of file Core.cpp.

◆ define() [1/2]

template<typename MaterializationUnitType >
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 959 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().

◆ define() [2/2]

template<typename MaterializationUnitType >
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 975 of file Core.h.

References assert().

◆ dump()

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

◆ getExecutionSession()

ExecutionSession& llvm::orc::JITDylib::getExecutionSession ( ) const
inline

◆ getName()

const std::string& llvm::orc::JITDylib::getName ( ) const
inline

◆ legacyLookup()

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 1518 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::orc::Materializing, MI, Name, and llvm::Error::success().

◆ lookupFlags()

Expected< SymbolFlagsMap > llvm::orc::JITDylib::lookupFlags ( const SymbolNameSet Names)

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ remove()

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 1295 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(), llvm::orc::Materializing, and llvm::Error::success().

◆ removeFromSearchOrder()

void llvm::orc::JITDylib::removeFromSearchOrder ( JITDylib JD)

Remove the given JITDylib from the search order for this JITDylib if it is present.

Otherwise this operation is a no-op.

Definition at line 1284 of file Core.cpp.

References llvm::find_if(), and I.

◆ removeGenerator()

void llvm::orc::JITDylib::removeGenerator ( DefinitionGenerator G)

◆ replaceInSearchOrder()

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 1271 of file Core.cpp.

References llvm::find_if(), and I.

◆ setSearchOrder()

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.

Definition at line 1253 of file Core.cpp.

◆ withSearchOrderDo()

template<typename Func >
auto llvm::orc::JITDylib::withSearchOrderDo ( Func &&  F) -> decltype(F(std::declval<const JITDylibSearchList &>()))

Do something with the search order (run under the session lock).

Definition at line 953 of file Core.h.

References F().

Friends And Related Function Documentation

◆ AsynchronousSymbolQuery

friend class AsynchronousSymbolQuery
friend

Definition at line 496 of file Core.h.

◆ ExecutionSession

friend class ExecutionSession
friend

Definition at line 497 of file Core.h.

◆ MaterializationResponsibility

friend class MaterializationResponsibility
friend

Definition at line 498 of file Core.h.


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