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

Base utilities for ExecutionSession. More...

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

Inheritance diagram for llvm::orc::ExecutionSessionBase:
[legend]

Public Types

using ErrorReporter = std::function< void(Error)>
 For reporting errors. More...
 
using DispatchMaterializationFunction = std::function< void(VSO &V, 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

 ExecutionSessionBase (std::shared_ptr< SymbolStringPool > SSP=nullptr)
 Construct an ExecutionSessionBase. More...
 
SymbolStringPool & getSymbolStringPool () const
 Returns 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...
 
ExecutionSessionBase & setErrorReporter (ErrorReporter ReportError)
 Set the error reporter function. More...
 
ExecutionSessionBase & setDispatchMaterialization (DispatchMaterializationFunction DispatchMaterialization)
 Set the materialization dispatch function. More...
 
void reportError (Error Err)
 Report a error for this execution session. 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...
 
void legacyFailQuery (AsynchronousSymbolQuery &Q, Error Err)
 
Expected< SymbolMap > legacyLookup (ExecutionSessionBase &ES, LegacyAsyncLookupFunction AsyncLookup, SymbolNameSet Names, bool WaiUntilReady, RegisterDependenciesFunction RegisterDependencies)
 A legacy lookup function for JITSymbolResolverAdapter. More...
 
void lookup (const VSOList &VSOs, const SymbolNameSet &Symbols, SymbolsResolvedCallback OnResolve, SymbolsReadyCallback OnReady, RegisterDependenciesFunction RegisterDependencies)
 Search the given VSO list for the given symbols. More...
 
Expected< SymbolMap > lookup (const VSOList &VSOs, const SymbolNameSet &Symbols, RegisterDependenciesFunction RegisterDependencies, bool WaitUntilReady=true)
 Blocking version of lookup above. More...
 
void dispatchMaterialization (VSO &V, std::unique_ptr< MaterializationUnit > MU)
 Materialize the given unit. More...
 

Friends

class VSO
 

Detailed Description

Base utilities for ExecutionSession.

Definition at line 348 of file Core.h.

Member Typedef Documentation

◆ DispatchMaterializationFunction

For dispatching MaterializationUnit::materialize calls.

Definition at line 358 of file Core.h.

◆ ErrorReporter

For reporting errors.

Definition at line 354 of file Core.h.

◆ LegacyAsyncLookupFunction

Definition at line 405 of file Core.h.

Constructor & Destructor Documentation

◆ ExecutionSessionBase()

llvm::orc::ExecutionSessionBase::ExecutionSessionBase ( std::shared_ptr< SymbolStringPool >  SSP = nullptr)
inline

Construct an ExecutionSessionBase.

SymbolStringPools may be shared between ExecutionSessions.

Definition at line 363 of file Core.h.

Member Function Documentation

◆ allocateVModule()

VModuleKey llvm::orc::ExecutionSessionBase::allocateVModule ( )
inline

Allocate a module key for a new module to add to the JIT.

Definition at line 394 of file Core.h.

◆ dispatchMaterialization()

void llvm::orc::ExecutionSessionBase::dispatchMaterialization ( VSO &  V,
std::unique_ptr< MaterializationUnit >  MU 
)
inline

Materialize the given unit.

Definition at line 448 of file Core.h.

◆ getSymbolStringPool()

SymbolStringPool& llvm::orc::ExecutionSessionBase::getSymbolStringPool ( ) const
inline

◆ legacyFailQuery()

void llvm::orc::ExecutionSessionBase::legacyFailQuery ( AsynchronousSymbolQuery &  Q,
Error  Err 
)

Definition at line 145 of file Core.cpp.

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

◆ legacyLookup()

Expected< SymbolMap > llvm::orc::ExecutionSessionBase::legacyLookup ( ExecutionSessionBase &  ES,
LegacyAsyncLookupFunction  AsyncLookup,
SymbolNameSet  Names,
bool  WaiUntilReady,
RegisterDependenciesFunction  RegisterDependencies 
)

A legacy lookup function for JITSymbolResolverAdapter.

Do not use – this will be removed soon.

Definition at line 161 of file Core.cpp.

References _, llvm::Lock, and llvm::Error::success().

Referenced by llvm::orc::JITSymbolResolverAdapter::lookup().

◆ lookup() [1/2]

void llvm::orc::ExecutionSessionBase::lookup ( const VSOList &  VSOs,
const SymbolNameSet &  Symbols,
SymbolsResolvedCallback  OnResolve,
SymbolsReadyCallback  OnReady,
RegisterDependenciesFunction  RegisterDependencies 
)

Search the given VSO list for the given symbols.

The OnResolve callback will be called once all requested symbols are resolved, or if an error occurs prior to resolution.

The OnReady callback will be called once all requested symbols are ready, or if an error occurs after resolution but before all symbols are ready.

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

References assert(), and llvm::Lock.

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

◆ lookup() [2/2]

Expected< SymbolMap > llvm::orc::ExecutionSessionBase::lookup ( const VSOList &  VSOs,
const SymbolNameSet &  Symbols,
RegisterDependenciesFunction  RegisterDependencies,
bool  WaitUntilReady = true 
)

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

References _, llvm::Lock, and llvm::Error::success().

◆ releaseVModule()

void llvm::orc::ExecutionSessionBase::releaseVModule ( VModuleKey  Key)
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.

Definition at line 399 of file Core.h.

◆ reportError()

void llvm::orc::ExecutionSessionBase::reportError ( Error  Err)
inline

Report a error for this execution session.

Unhandled errors can be sent here to log them.

Definition at line 391 of file Core.h.

Referenced by llvm::orc::ObjectTransformLayer2::emit(), llvm::orc::IRTransformLayer2::emit(), llvm::orc::IRCompileLayer2::emit(), and llvm::orc::RTDyldObjectLinkingLayer2::emit().

◆ runSessionLocked()

template<typename Func >
auto llvm::orc::ExecutionSessionBase::runSessionLocked ( Func &&  F) -> decltype(F())
inline

Run the given lambda with the session mutex locked.

Definition at line 370 of file Core.h.

References F(), and llvm::Lock.

◆ setDispatchMaterialization()

ExecutionSessionBase& llvm::orc::ExecutionSessionBase::setDispatchMaterialization ( DispatchMaterializationFunction  DispatchMaterialization)
inline

Set the materialization dispatch function.

Definition at line 382 of file Core.h.

◆ setErrorReporter()

ExecutionSessionBase& llvm::orc::ExecutionSessionBase::setErrorReporter ( ErrorReporter  ReportError)
inline

Set the error reporter function.

Definition at line 376 of file Core.h.

Friends And Related Function Documentation

◆ VSO

friend class VSO
friend

Definition at line 350 of file Core.h.


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