LLVM 24.0.0git
EPCGenericDylibManagerSPS.cpp
Go to the documentation of this file.
1//===- EPCGenericDylibManagerSPS.cpp - SPS dylib management ---------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
14
15namespace llvm::orc::shared {
16
17// Serialize a local SymbolLookupSet directly as an SPSRemoteSymbolLookupSet,
18// avoiding a std::string copy of each (potentially large) symbol name.
19template <>
21 SymbolLookupSet::value_type> {
22public:
23 static size_t size(const SymbolLookupSet::value_type &V) {
25 *V.first, V.second == SymbolLookupFlags::RequiredSymbol);
26 }
27
28 static bool serialize(SPSOutputBuffer &OB,
31 OB, *V.first, V.second == SymbolLookupFlags::RequiredSymbol);
32 }
33};
34
35template <>
38public:
39 static constexpr bool available = true;
40};
41
42} // namespace llvm::orc::shared
43
44namespace llvm::orc::sps {
45
48 auto &ES = JD.getExecutionSession();
50 // Instance is the executor-side manager object -- a data symbol passed as the
51 // first argument to each call, not a wrapper to proxy.
52 if (auto Err = lookupAndRecordAddrs(
55 &B.Instance}}))
56 return std::move(Err);
57 // The proxies resolve to the specs' default (NativeDylibManager) names.
58 if (auto Err = buildProxies(JD, proxyInit<DylibMgrOpenProxySpec>(&B.Open),
60 return std::move(Err);
61 return std::make_unique<EPCGenericDylibManager>(ES, std::move(B));
62}
63
68
69} // namespace llvm::orc::sps
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Tagged union holding either a T or a Error.
Definition Error.h:485
An ExecutionSession represents a running JIT program.
Definition Core.h:1111
JITDylib & getBootstrapJITDylib()
Returns a reference to the bootstrap JITDylib.
Definition Core.h:1177
Represents a JIT'd dynamic library.
Definition Core.h:675
ExecutionSession & getExecutionSession() const
Get a reference to the ExecutionSession for this JITDylib.
Definition Core.h:694
A set of symbols to look up, each associated with a SymbolLookupFlags value.
std::pair< SymbolStringPtr, SymbolLookupFlags > value_type
A utility class for serializing to a blob from a variadic list.
Output char buffer with overflow check.
Specialize to describe how to serialize/deserialize to/from the given concrete type.
Specialize this to implement 'trivial' sequence serialization for a concrete sequence type.
constexpr char NativeDylibManagerInstanceName[]
The executor-side dylib-manager instance.
SPSTuple< SPSString, bool > SPSRemoteSymbolLookupSetElement
LLVM_ABI Expected< std::unique_ptr< EPCGenericDylibManager > > createEPCGenericDylibManager(JITDylib &JD)
Create an EPCGenericDylibManager for the ORC runtime's NativeDylibManager interface,...
JITDylibSearchOrder makeJITDylibSearchOrder(ArrayRef< JITDylib * > JDs, JITDylibLookupFlags Flags=JITDylibLookupFlags::MatchExportedSymbolsOnly)
Convenience function for creating a search order from an ArrayRef of JITDylib*, all with the same fla...
Definition Core.h:153
ProxyInit< FnT > proxyInit(Proxy< FnT > *P, typename Proxy< FnT >::DispatchFn Dispatch, StringRef Name, SymbolLookupFlags LookupFlags=SymbolLookupFlags::RequiredSymbol)
Definition Proxy.h:168
LLVM_ABI void lookupAndRecordAddrs(unique_function< void(Error)> OnRecorded, ExecutionSession &ES, LookupKind K, const JITDylibSearchOrder &SearchOrder, std::vector< std::pair< SymbolStringPtr, ExecutorAddr * > > Pairs, SymbolLookupFlags LookupFlags=SymbolLookupFlags::RequiredSymbol)
Record addresses of the given symbols in the given ExecutorAddrs.
Error buildProxies(JITDylib &JD)
buildProxies base case.
Definition Proxy.h:189
The resolved controller-side handle to an executor-side dylib manager: the address of the manager ins...