LLVM
8.0.1
|
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and JDs. More...
#include "llvm/ExecutionEngine/Orc/Core.h"
Public Member Functions | |
MaterializationResponsibility (MaterializationResponsibility &&)=default | |
MaterializationResponsibility & | operator= (MaterializationResponsibility &&)=delete |
~MaterializationResponsibility () | |
Destruct a MaterializationResponsibility instance. More... | |
JITDylib & | getTargetJITDylib () const |
Returns the target JITDylib that these symbols are being materialized into. More... | |
VModuleKey | getVModuleKey () const |
Returns the VModuleKey for this instance. More... | |
const SymbolFlagsMap & | getSymbols () |
Returns the symbol flags map for this responsibility instance. More... | |
SymbolNameSet | getRequestedSymbols () const |
Returns the names of any symbols covered by this MaterializationResponsibility object that have queries pending. More... | |
void | resolve (const SymbolMap &Symbols) |
Notifies the target JITDylib that the given symbols have been resolved. More... | |
void | emit () |
Notifies the target JITDylib (and any pending queries on that JITDylib) that all symbols covered by this MaterializationResponsibility instance have been emitted. More... | |
Error | defineMaterializing (const SymbolFlagsMap &SymbolFlags) |
Adds new symbols to the JITDylib and this responsibility instance. More... | |
void | failMaterialization () |
Notify all not-yet-emitted covered by this MaterializationResponsibility instance 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, VModuleKey NewKey=VModuleKey()) |
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 |
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.
|
default |
llvm::orc::MaterializationResponsibility::~MaterializationResponsibility | ( | ) |
Destruct a MaterializationResponsibility instance.
In debug mode this asserts that all symbols being tracked have been either emitted or notified of an error.
Definition at line 384 of file Core.cpp.
References assert(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::empty().
void llvm::orc::MaterializationResponsibility::addDependencies | ( | const SymbolStringPtr & | Name, |
const SymbolDependenceMap & | Dependencies | ||
) |
Definition at line 489 of file Core.cpp.
References assert(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count().
void llvm::orc::MaterializationResponsibility::addDependenciesForAll | ( | const SymbolDependenceMap & | Dependencies | ) |
Error llvm::orc::MaterializationResponsibility::defineMaterializing | ( | const SymbolFlagsMap & | SymbolFlags | ) |
Adds new symbols to the JITDylib and this responsibility instance.
JITDylib 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 426 of file Core.cpp.
References I, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), and llvm::JITSymbolFlags::Materializing.
MaterializationResponsibility llvm::orc::MaterializationResponsibility::delegate | ( | const SymbolNameSet & | Symbols, |
VModuleKey | NewKey = VModuleKey() |
||
) |
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 467 of file Core.cpp.
References assert(), 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, and Name.
Referenced by llvm::orc::ReExportsMaterializationUnit::getName().
void llvm::orc::MaterializationResponsibility::emit | ( | ) |
Notifies the target JITDylib (and any pending queries on that JITDylib) that all symbols covered by this MaterializationResponsibility instance have been emitted.
Definition at line 415 of file Core.cpp.
References assert().
Referenced by llvm::orc::AbsoluteSymbolsMaterializationUnit::getName().
void llvm::orc::MaterializationResponsibility::failMaterialization | ( | ) |
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.
Definition at line 443 of file Core.cpp.
References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert().
Referenced by llvm::orc::ObjectTransformLayer::emit(), llvm::orc::IRTransformLayer::emit(), llvm::orc::IRCompileLayer::emit(), llvm::orc::RTDyldObjectLinkingLayer::emit(), and llvm::orc::LazyReexportsMaterializationUnit::getName().
SymbolNameSet llvm::orc::MaterializationResponsibility::getRequestedSymbols | ( | ) | const |
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.
Definition at line 389 of file Core.cpp.
Referenced by llvm::orc::LazyReexportsMaterializationUnit::getName(), and llvm::orc::ReExportsMaterializationUnit::getName().
|
inline |
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.
|
inline |
Returns the target JITDylib that these symbols are being materialized into.
Definition at line 169 of file Core.h.
Referenced by llvm::orc::BasicIRLayerMaterializationUnit::BasicIRLayerMaterializationUnit(), llvm::orc::CompileOnDemandLayer::emit(), and llvm::orc::ReExportsMaterializationUnit::getName().
|
inline |
Returns the VModuleKey for this instance.
Definition at line 172 of file Core.h.
Referenced by llvm::orc::IRCompileLayer::emit(), and llvm::orc::RTDyldObjectLinkingLayer::emit().
|
delete |
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 453 of file Core.cpp.
References llvm::dbgs(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::erase(), llvm::orc::JITDylib::getExecutionSession(), llvm::orc::JITDylib::getName(), LLVM_DEBUG, and llvm::orc::ExecutionSession::runSessionLocked().
Referenced by llvm::orc::LazyReexportsMaterializationUnit::getName(), and llvm::orc::ReExportsMaterializationUnit::getName().
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.
Definition at line 393 of file Core.cpp.
References assert(), llvm::dbgs(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::orc::JITDylib::getName(), I, LLVM_DEBUG, and llvm::JITSymbolFlags::Weak.
Referenced by llvm::orc::AbsoluteSymbolsMaterializationUnit::getName().
|
friend |