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

Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and VSOs. More...

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

Public Member Functions

 MaterializationResponsibility (MaterializationResponsibility &&)=default
 
MaterializationResponsibility & operator= (MaterializationResponsibility &&)=default
 
 ~MaterializationResponsibility ()
 Destruct a MaterializationResponsibility instance. More...
 
VSO & getTargetVSO () const
 Returns the target VSO that these symbols are being materialized into. More...
 
SymbolFlagsMap getSymbols ()
 Returns the symbol flags map for this responsibility instance. More...
 
SymbolNameSet getRequestedSymbols ()
 Returns the names of any symbols covered by this MaterializationResponsibility object that have queries pending. More...
 
void resolve (const SymbolMap &Symbols)
 Resolves the given symbols. More...
 
void finalize ()
 Finalizes all symbols tracked by this instance. More...
 
Error defineMaterializing (const SymbolFlagsMap &SymbolFlags)
 Adds new symbols to the VSO and this responsibility instance. More...
 
void failMaterialization ()
 Notify all unfinalized symbols that an error has occurred. More...
 
void replace (std::unique_ptr< MaterializationUnit > MU)
 Transfers responsibility to the given MaterializationUnit for all symbols defined by that MaterializationUnit. More...
 
MaterializationResponsibility delegate (const SymbolNameSet &Symbols)
 Delegates responsibility for the given symbols to the returned materialization responsibility. More...
 
void addDependencies (const SymbolStringPtr &Name, const SymbolDependenceMap &Dependencies)
 
void addDependenciesForAll (const SymbolDependenceMap &Dependencies)
 Add dependencies that apply to all symbols covered by this instance. More...
 

Friends

class MaterializationUnit
 

Detailed Description

Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and VSOs.

An instance of this class is passed to MaterializationUnits when their materialize method is called. It allows MaterializationUnits to resolve and finalize symbols, or abandon materialization by notifying any unmaterialized symbols of an error.

Definition at line 124 of file Core.h.

Constructor & Destructor Documentation

◆ MaterializationResponsibility()

llvm::orc::MaterializationResponsibility::MaterializationResponsibility ( MaterializationResponsibility &&  )
default

◆ ~MaterializationResponsibility()

llvm::orc::MaterializationResponsibility::~MaterializationResponsibility ( )

Destruct a MaterializationResponsibility instance.

In debug mode this asserts that all symbols being tracked have been either finalized or notified of an error.

Definition at line 596 of file Core.cpp.

References assert().

Member Function Documentation

◆ addDependencies()

void llvm::orc::MaterializationResponsibility::addDependencies ( const SymbolStringPtr &  Name,
const SymbolDependenceMap &  Dependencies 
)

Definition at line 688 of file Core.cpp.

References assert().

◆ addDependenciesForAll()

void llvm::orc::MaterializationResponsibility::addDependenciesForAll ( const SymbolDependenceMap &  Dependencies)

Add dependencies that apply to all symbols covered by this instance.

Definition at line 695 of file Core.cpp.

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

◆ defineMaterializing()

Error llvm::orc::MaterializationResponsibility::defineMaterializing ( const SymbolFlagsMap &  SymbolFlags)

Adds new symbols to the VSO and this responsibility instance.

VSO entries start out in the materializing state.

This method can be used by materialization units that want to add additional symbols at materialization time (e.g. stubs, compile callbacks, metadata).

Definition at line 636 of file Core.cpp.

References I, and llvm::JITSymbolFlags::Materializing.

◆ delegate()

MaterializationResponsibility llvm::orc::MaterializationResponsibility::delegate ( const SymbolNameSet &  Symbols)

Delegates responsibility for the given symbols to the returned materialization responsibility.

Useful for breaking up work between threads, or different kinds of materialization processes.

Definition at line 672 of file Core.cpp.

References assert(), and I.

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

◆ failMaterialization()

void llvm::orc::MaterializationResponsibility::failMaterialization ( )

Notify all unfinalized symbols that an error has occurred.

This will remove all symbols covered by this MaterializationResponsibilty from V, and send an error to any queries waiting on these symbols.

Definition at line 653 of file Core.cpp.

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

◆ finalize()

void llvm::orc::MaterializationResponsibility::finalize ( )

Finalizes all symbols tracked by this instance.

Definition at line 625 of file Core.cpp.

References assert().

Referenced by llvm::orc::AbsoluteSymbolsMaterializationUnit::AbsoluteSymbolsMaterializationUnit(), and llvm::orc::RTDyldObjectLinkingLayer2::emit().

◆ getRequestedSymbols()

SymbolNameSet llvm::orc::MaterializationResponsibility::getRequestedSymbols ( )

Returns the names of any symbols covered by this MaterializationResponsibility object that have queries pending.

This information can be used to return responsibility for unrequested symbols back to the VSO via the delegate method.

Definition at line 601 of file Core.cpp.

Referenced by llvm::orc::ExtractingIRMaterializationUnit::ExtractingIRMaterializationUnit(), and llvm::orc::ReExportsMaterializationUnit::ReExportsMaterializationUnit().

◆ getSymbols()

SymbolFlagsMap llvm::orc::MaterializationResponsibility::getSymbols ( )
inline

Returns the symbol flags map for this responsibility instance.

Definition at line 141 of file Core.h.

References finalize, and llvm::object::replace().

◆ getTargetVSO()

VSO& llvm::orc::MaterializationResponsibility::getTargetVSO ( ) const
inline

Returns the target VSO that these symbols are being materialized into.

Definition at line 138 of file Core.h.

Referenced by llvm::orc::CompileOnDemandLayer2::emit(), and llvm::orc::ReExportsMaterializationUnit::ReExportsMaterializationUnit().

◆ operator=()

MaterializationResponsibility& llvm::orc::MaterializationResponsibility::operator= ( MaterializationResponsibility &&  )
default

◆ replace()

void llvm::orc::MaterializationResponsibility::replace ( std::unique_ptr< MaterializationUnit >  MU)

Transfers responsibility to the given MaterializationUnit for all symbols defined by that MaterializationUnit.

This allows materializers to break up work based on run-time information (e.g. by introspecting which symbols have actually been looked up and materializing only those).

Definition at line 663 of file Core.cpp.

Referenced by extractAliases(), llvm::orc::ExtractingIRMaterializationUnit::ExtractingIRMaterializationUnit(), and llvm::orc::ReExportsMaterializationUnit::ReExportsMaterializationUnit().

◆ resolve()

void llvm::orc::MaterializationResponsibility::resolve ( const SymbolMap &  Symbols)

Resolves the given symbols.

Individual calls to this method may resolve a subset of the symbols, but all symbols must have been resolved prior to calling finalize.

Definition at line 605 of file Core.cpp.

References assert(), I, and llvm::JITSymbolFlags::Weak.

Referenced by llvm::orc::AbsoluteSymbolsMaterializationUnit::AbsoluteSymbolsMaterializationUnit(), and llvm::orc::RTDyldObjectLinkingLayer2::emit().

Friends And Related Function Documentation

◆ MaterializationUnit

friend class MaterializationUnit
friend

Definition at line 125 of file Core.h.


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