LLVM  7.0.0
Classes | Public Types | Public Member Functions | Friends | List of all members
llvm::orc::VSO Class Reference

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

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

Public Types

using FallbackDefinitionGeneratorFunction = std::function< SymbolNameSet(VSO &Parent, const SymbolNameSet &Names)>
 
using AsynchronousSymbolQuerySet = std::set< std::shared_ptr< AsynchronousSymbolQuery > >
 

Public Member Functions

 VSO (const VSO &)=delete
 
VSO & operator= (const VSO &)=delete
 
 VSO (VSO &&)=delete
 
VSO & operator= (VSO &&)=delete
 
const std::string & getName () const
 Get the name for this VSO. More...
 
ExecutionSessionBase & getExecutionSession () const
 Get a reference to the ExecutionSession for this VSO. More...
 
void setFallbackDefinitionGenerator (FallbackDefinitionGeneratorFunction FallbackDefinitionGenerator)
 Set a fallback defenition generator. More...
 
void setSearchOrder (VSOList NewSearchOrder, bool SearchThisVSOFirst=true)
 Set the search order to be used when fixing up definitions in VSO. More...
 
void addToSearchOrder (VSO &V)
 Add the given VSO to the search order for definitions in this VSO. More...
 
void replaceInSearchOrder (VSO &OldV, VSO &NewV)
 Replace OldV with NewV in the search order if OldV is present. More...
 
void removeFromSearchOrder (VSO &V)
 Remove the given VSO from the search order for this VSO if it is present. More...
 
template<typename Func >
auto withSearchOrderDo (Func &&F) -> decltype(F(std::declval< const VSOList &>()))
 Do something with the search order (run under the session lock). More...
 
template<typename UniquePtrToMaterializationUnit >
std::enable_if< std::is_convertible< typename std::decay< UniquePtrToMaterializationUnit >::type, std::unique_ptr< MaterializationUnit > >::value, Error >::type define (UniquePtrToMaterializationUnit &&MU)
 Define all symbols provided by the materialization unit to be part of the given VSO. More...
 
SymbolFlagsMap lookupFlags (const SymbolNameSet &Names)
 Search the given VSO for the symbols in Symbols. More...
 
void dump (raw_ostream &OS)
 Dump current VSO 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 ExecutionSessionBase
 
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. VSO state changes must be made via an ExecutionSession to guarantee that they are synchronized with respect to other VSO operations.

Definition at line 544 of file Core.h.

Member Typedef Documentation

◆ AsynchronousSymbolQuerySet

Definition at line 554 of file Core.h.

◆ FallbackDefinitionGeneratorFunction

Definition at line 551 of file Core.h.

Constructor & Destructor Documentation

◆ VSO() [1/2]

llvm::orc::VSO::VSO ( const VSO &  )
delete

Referenced by dump().

◆ VSO() [2/2]

llvm::orc::VSO::VSO ( VSO &&  )
delete

Member Function Documentation

◆ addToSearchOrder()

void llvm::orc::VSO::addToSearchOrder ( VSO &  V)

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

Definition at line 1216 of file Core.cpp.

◆ define()

template<typename UniquePtrToMaterializationUnit >
std::enable_if< std::is_convertible< typename std::decay<UniquePtrToMaterializationUnit>::type, std::unique_ptr<MaterializationUnit> >::value, Error>::type llvm::orc::VSO::define ( UniquePtrToMaterializationUnit &&  MU)
inline

Define all symbols provided by the materialization unit to be part of the given VSO.

defineImpl succeeded.

Definition at line 621 of file Core.h.

References assert().

Referenced by llvm::orc::IRLayer::add(), llvm::orc::ObjectLayer::add(), llvm::orc::LLJIT::defineAbsolute(), llvm::orc::LocalCXXRuntimeOverrides2::enable(), and llvm::orc::DynamicLibraryFallbackGenerator::operator()().

◆ dump()

void llvm::orc::VSO::dump ( raw_ostream &  OS)

◆ getExecutionSession()

ExecutionSessionBase& llvm::orc::VSO::getExecutionSession ( ) const
inline

Get a reference to the ExecutionSession for this VSO.

Definition at line 565 of file Core.h.

Referenced by llvm::orc::ReExportsMaterializationUnit::ReExportsMaterializationUnit().

◆ getName()

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

Get the name for this VSO.

Definition at line 562 of file Core.h.

◆ legacyLookup()

SymbolNameSet llvm::orc::VSO::legacyLookup ( std::shared_ptr< AsynchronousSymbolQuery >  Q,
SymbolNameSet  Names 
)

FIXME: Remove this when we remove the old ORC layers.

Search the given VSOs 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 1351 of file Core.cpp.

References assert(), D, E, I, llvm::Lock, llvm::JITSymbolFlags::Materializing, MI, and llvm::None.

◆ lookupFlags()

SymbolFlagsMap llvm::orc::VSO::lookupFlags ( const SymbolNameSet &  Names)

Search the given VSO for the symbols in Symbols.

If found, store the flags for each symbol in Flags. Returns any unresolved symbols.

Definition at line 1237 of file Core.cpp.

References assert(), D, E, I, llvm::JITSymbolFlags::Materializing, MI, Result, and llvm::JITSymbolFlags::stripTransientFlags().

Referenced by llvm::orc::buildSimpleReexportsAliasMap().

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ removeFromSearchOrder()

void llvm::orc::VSO::removeFromSearchOrder ( VSO &  V)

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

Otherwise this operation is a no-op.

Definition at line 1229 of file Core.cpp.

References llvm::find(), and I.

◆ replaceInSearchOrder()

void llvm::orc::VSO::replaceInSearchOrder ( VSO &  OldV,
VSO &  NewV 
)

Replace OldV with NewV in the search order if OldV is present.

Otherwise this operation is a no-op.

Definition at line 1220 of file Core.cpp.

References llvm::find(), and I.

◆ setFallbackDefinitionGenerator()

void llvm::orc::VSO::setFallbackDefinitionGenerator ( FallbackDefinitionGeneratorFunction  FallbackDefinitionGenerator)
inline

Set a fallback defenition generator.

If set, lookup and lookupFlags will pass the unresolved symbols set to the fallback definition generator, allowing it to add a new definition to the VSO.

Definition at line 570 of file Core.h.

◆ setSearchOrder()

void llvm::orc::VSO::setSearchOrder ( VSOList  NewSearchOrder,
bool  SearchThisVSOFirst = true 
)

Set the search order to be used when fixing up definitions in VSO.

This will replace the previous search order, and apply to any symbol resolutions made for definitions in this VSO after the call to setSearchOrder (even if the definition itself was added before the call).

If SearchThisVSOFirst is set, which by default it is, then this VSO will add itself to the beginning of the SearchOrder (Clients should not put this VSO in the list in this case, to avoid redundant lookups).

If SearchThisVSOFirst 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 VSO by a facade VSO. 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 1209 of file Core.cpp.

◆ withSearchOrderDo()

template<typename Func >
auto llvm::orc::VSO::withSearchOrderDo ( Func &&  F) -> decltype(F(std::declval<const VSOList &>()))
inline

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

Definition at line 608 of file Core.h.

References F().

Friends And Related Function Documentation

◆ AsynchronousSymbolQuery

friend class AsynchronousSymbolQuery
friend

Definition at line 545 of file Core.h.

◆ ExecutionSession

friend class ExecutionSession
friend

Definition at line 546 of file Core.h.

◆ ExecutionSessionBase

friend class ExecutionSessionBase
friend

Definition at line 547 of file Core.h.

◆ MaterializationResponsibility

friend class MaterializationResponsibility
friend

Definition at line 548 of file Core.h.


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