16#ifndef LLVM_EXECUTIONENGINE_ORC_LAZYREEXPORTS_H
17#define LLVM_EXECUTIONENGINE_ORC_LAZYREEXPORTS_H
74 using ReexportsMap = std::map<ExecutorAddr, ReexportsEntry>;
76 using NotifiersMap = std::map<ExecutorAddr, NotifyResolvedFunction>;
82 ReexportsMap Reexports;
83 NotifiersMap Notifiers;
95 template <
typename ORCABI>
Error init() {
99 NotifyLandingResolved) {
101 std::move(NotifyLandingResolved));
105 return TP.takeError();
107 this->TP = std::move(*TP);
112 std::unique_ptr<TrampolinePool> TP;
117 template <
typename ORCABI>
120 auto LLCTM = std::unique_ptr<LocalLazyCallThroughManager>(
123 if (
auto Err = LLCTM->init<ORCABI>())
124 return std::move(Err);
126 return std::move(LLCTM);
134 ExecutorAddr ErrorHandlerAddr);
152 void materialize(std::unique_ptr<MaterializationResponsibility> R)
override;
167inline std::unique_ptr<LazyReexportsMaterializationUnit>
172 return std::make_unique<LazyReexportsMaterializationUnit>(
173 LCTManager, RSManager, SourceJD, std::move(CallableAliases), SrcJDLoc);
178 friend std::unique_ptr<MaterializationUnit>
183 Expected<std::vector<ExecutorSymbolDef>> EntryAddrs)>;
202 struct CallThroughInfo {
211 using ResolveSendResultFn =
218 std::unique_ptr<MaterializationUnit>
221 void emitReentryTrampolines(std::unique_ptr<MaterializationResponsibility> MR,
223 void emitRedirectableSymbols(
224 std::unique_ptr<MaterializationResponsibility> MR,
226 Expected<std::vector<ExecutorSymbolDef>> ReentryPoints);
227 void resolve(ResolveSendResultFn SendResult,
ExecutorAddr ReentryStubAddr);
240inline std::unique_ptr<MaterializationUnit>
242 return LRM.createLazyReexports(std::move(Reexports));
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
An ExecutionSession represents a running JIT program.
Represents an address in the executor process.
Represents a JIT'd dynamic library.
Manages a set of 'lazy call-through' trampolines.
ExecutorAddr reportCallThroughError(Error Err)
Expected< ReexportsEntry > findReexport(ExecutorAddr TrampolineAddr)
Error notifyResolved(ExecutorAddr TrampolineAddr, ExecutorAddr ResolvedAddr)
void setTrampolinePool(TrampolinePool &TP)
void resolveTrampolineLandingAddress(ExecutorAddr TrampolineAddr, TrampolinePool::NotifyLandingResolvedFunction NotifyLandingResolved)
virtual ~LazyCallThroughManager()=default
Expected< ExecutorAddr > getCallThroughTrampoline(JITDylib &SourceJD, SymbolStringPtr SymbolName, NotifyResolvedFunction NotifyResolved)
void handleTransferResources(JITDylib &JD, ResourceKey DstK, ResourceKey SrcK) override
This function will be called inside the session lock.
unique_function< void(ResourceTrackerSP RT, size_t NumTrampolines, OnTrampolinesReadyFn OnTrampolinesReady)> EmitTrampolinesFn
friend std::unique_ptr< MaterializationUnit > lazyReexports(LazyReexportsManager &, SymbolAliasMap)
Define lazy-reexports based on the given SymbolAliasMap.
Error handleRemoveResources(JITDylib &JD, ResourceKey K) override
This function will be called outside the session lock.
LazyReexportsManager & operator=(LazyReexportsManager &&)=delete
LazyReexportsManager(LazyReexportsManager &&)=delete
static Expected< std::unique_ptr< LazyReexportsManager > > Create(EmitTrampolinesFn EmitTrampolines, RedirectableSymbolManager &RSMgr, JITDylib &PlatformJD)
Create a LazyReexportsManager that uses the ORC runtime for reentry.
A materialization unit that builds lazy re-exports.
StringRef getName() const override
Return the name of this materialization unit.
A lazy call-through manager that builds trampolines in the current process.
static Expected< std::unique_ptr< LocalLazyCallThroughManager > > Create(ExecutionSession &ES, ExecutorAddr ErrorHandlerAddr)
Create a LocalLazyCallThroughManager using the given ABI.
static Expected< std::unique_ptr< LocalTrampolinePool > > Create(ResolveLandingFunction ResolveLanding)
Creates a LocalTrampolinePool with the given RunCallback function.
A MaterializationUnit represents a set of symbol definitions that can be materialized as a group,...
Base class for managing redirectable symbols in which a call gets redirected to another symbol in run...
Listens for ResourceTracker operations.
Pointer to a pooled string representing a symbol name.
Base class for pools of compiler re-entry trampolines.
unique_function< void(ExecutorAddr) const > NotifyLandingResolvedFunction
unique_function is a type-erasing functor similar to std::function.
Expected< std::unique_ptr< LazyCallThroughManager > > createLocalLazyCallThroughManager(const Triple &T, ExecutionSession &ES, ExecutorAddr ErrorHandlerAddr)
Create a LocalLazyCallThroughManager from the given triple and execution session.
std::unique_ptr< LazyReexportsMaterializationUnit > lazyReexports(LazyCallThroughManager &LCTManager, RedirectableSymbolManager &RSManager, JITDylib &SourceJD, SymbolAliasMap CallableAliases, ImplSymbolMap *SrcJDLoc=nullptr)
Define lazy-reexports based on the given SymbolAliasMap.
This is an optimization pass for GlobalISel generic memory operations.
SymbolStringPtr SymbolName