class MaterializationResponsibility

Declaration

class MaterializationResponsibility { /* full declaration omitted */ };

Description

Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and JDs. An instance of this class is passed to MaterializationUnits when their materialize method is called. It allows MaterializationUnits to resolve and emit symbols, or abandon materialization by notifying any unmaterialized symbols of an error.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:519

Member Variables

private llvm::orc::JITDylib& JD
private llvm::orc::ResourceTrackerSP RT
private llvm::orc::SymbolFlagsMap SymbolFlags
private llvm::orc::SymbolStringPtr InitSymbol

Method Overview

Methods

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

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:524

Parameters

llvm::orc::MaterializationResponsibility&&

MaterializationResponsibility(
    llvm::orc::ResourceTrackerSP RT,
    llvm::orc::SymbolFlagsMap SymbolFlags,
    llvm::orc::SymbolStringPtr InitSymbol)

Description

Create a MaterializationResponsibility for the given JITDylib and initial symbols.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:643

Parameters

llvm::orc::ResourceTrackerSP RT
llvm::orc::SymbolFlagsMap SymbolFlags
llvm::orc::SymbolStringPtr InitSymbol

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

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:634

Parameters

const llvm::orc::SymbolStringPtr& Name
const llvm::orc::SymbolDependenceMap& Dependencies

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

Description

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

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:638

Parameters

const llvm::orc::SymbolDependenceMap& Dependencies

llvm::Error defineMaterializing(
    llvm::orc::SymbolFlagsMap SymbolFlags)

Description

Attempt to claim responsibility for new definitions. This method can be used to claim responsibility for symbols that are added to a materialization unit during the compilation process (e.g. literal pool symbols). Symbol linkage rules are the same as for symbols that are defined up front: duplicate strong definitions will result in errors. Duplicate weak definitions will be discarded (in which case they will not be added to this responsibility instance). This method can be used by materialization units that want to add additional symbols at materialization time (e.g. stubs, compile callbacks, metadata).

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:598

Parameters

llvm::orc::SymbolFlagsMap SymbolFlags

void defineNonExistent(
    ArrayRef<llvm::orc::SymbolStringPtr> Symbols)

Description

Define the given symbols as non-existent, removing it from the symbol table and notifying any pending queries. Queries that lookup up the symbol using the SymbolLookupFlags::WeaklyReferencedSymbol flag will behave as if the symbol had not been matched in the first place. Queries that required this symbol will fail with a missing symbol definition error. This method is intended to support cleanup of special symbols like initializer symbols: Queries using SymbolLookupFlags::WeaklyReferencedSymbol can be used to trigger their emission, and this method can be used to remove them from the JITDylib once materialization is complete.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:612

Parameters

ArrayRef<llvm::orc::SymbolStringPtr> Symbols

Expected<std::unique_ptr<
    MaterializationResponsibility>>
delegate(const llvm::orc::SymbolNameSet& Symbols)

Description

Delegates responsibility for the given symbols to the returned materialization responsibility. Useful for breaking up work between threads, or different kinds of materialization processes.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:632

Parameters

const llvm::orc::SymbolNameSet& Symbols

void failMaterialization()

Description

Notify all not-yet-emitted covered by this MaterializationResponsibility instance that an error has occurred. This will remove all symbols covered by this MaterializationResponsibilty from the target JITDylib, and send an error to any queries waiting on these symbols.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:619

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

Description

Returns the ExecutionSession for this instance.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:541

const llvm::orc::SymbolStringPtr&
getInitializerSymbol() const

Description

Returns the initialization pseudo-symbol, if any. This symbol will also be present in the SymbolFlagsMap for this MaterializationResponsibility object.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:552

llvm::orc::SymbolNameSet getRequestedSymbols()
    const

Description

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 JITDylib via the delegate method.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:558

const llvm::orc::SymbolFlagsMap& getSymbols()
    const

Description

Returns the symbol flags map for this responsibility instance. Note: The returned flags may have transient flags (Lazy, Materializing) set. These should be stripped with JITSymbolFlags::stripTransientFlags before using.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:547

llvm::orc::JITDylib& getTargetJITDylib() const

Description

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

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:538

llvm::Error notifyEmitted()

Description

Notifies the target JITDylib (and any pending queries on that JITDylib) that all symbols covered by this MaterializationResponsibility instance have been emitted. This method will return an error if any symbols being resolved have been moved to the error state due to the failure of a dependency. If this method returns an error then clients should log it and call failMaterialize. If no dependencies have been registered for the symbols covered by this MaterializationResponsibiility then this method is guaranteed to return Error::success() and can be wrapped with cantFail.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:585

llvm::Error notifyResolved(
    const llvm::orc::SymbolMap& Symbols)

Description

Notifies the target JITDylib that the given symbols have been resolved. This will update the given symbols' addresses in the JITDylib, and notify any pending queries on the given symbols of their resolution. The given symbols must be ones covered by this MaterializationResponsibility instance. Individual calls to this method may resolve a subset of the symbols, but all symbols must have been resolved prior to calling emit. This method will return an error if any symbols being resolved have been moved to the error state due to the failure of a dependency. If this method returns an error then clients should log it and call failMaterialize. If no dependencies have been registered for the symbols covered by this MaterializationResponsibiility then this method is guaranteed to return Error::success() and can be wrapped with cantFail.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:573

Parameters

const llvm::orc::SymbolMap& Symbols

llvm::Error replace(
    std::unique_ptr<MaterializationUnit> MU)

Description

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).

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:626

Parameters

std::unique_ptr<MaterializationUnit> MU

template <typename Func>
llvm::Error withResourceKeyDo(Func&& F) const

Description

Returns the ResourceTracker for this instance.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:534

Templates

Func

Parameters

Func&& F

~MaterializationResponsibility()

Description

Destruct a MaterializationResponsibility instance. In debug mode this asserts that all symbols being tracked have been either emitted or notified of an error.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/Core.h:531