LLVM 22.0.0git
EPCGenericDylibManager.cpp
Go to the documentation of this file.
1//===------- EPCGenericDylibManager.cpp -- Dylib management via EPC -------===//
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 {
16namespace orc {
17namespace shared {
18
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
42template <>
44 DylibManager::LookupRequest> {
45 using MemberSerialization =
47
48public:
49 static size_t size(const DylibManager::LookupRequest &LR) {
50 return MemberSerialization::size(ExecutorAddr(LR.Handle), LR.Symbols);
51 }
52
53 static bool serialize(SPSOutputBuffer &OB,
55 return MemberSerialization::serialize(OB, ExecutorAddr(LR.Handle),
56 LR.Symbols);
57 }
58};
59
60} // end namespace shared
61
65 SymbolAddrs SAs;
66 if (auto Err = EPC.getBootstrapSymbols(
67 {{SAs.Instance, rt::SimpleExecutorDylibManagerInstanceName},
68 {SAs.Open, rt::SimpleExecutorDylibManagerOpenWrapperName},
69 {SAs.Lookup, rt::SimpleExecutorDylibManagerLookupWrapperName}}))
70 return std::move(Err);
71 return EPCGenericDylibManager(EPC, std::move(SAs));
72}
73
75 uint64_t Mode) {
77 if (auto Err =
79 SAs.Open, H, SAs.Instance, Path, Mode))
80 return std::move(Err);
81 return H;
82}
83
86 SymbolLookupCompleteFn Complete) {
88 SAs.Lookup,
89 [Complete = std::move(Complete)](
90 Error SerializationErr,
92 if (SerializationErr) {
93 cantFail(Result.takeError());
94 Complete(std::move(SerializationErr));
95 return;
96 }
97 Complete(std::move(Result));
98 },
99 SAs.Instance, H, Lookup);
100}
101
104 SymbolLookupCompleteFn Complete) {
106 SAs.Lookup,
107 [Complete = std::move(Complete)](
108 Error SerializationErr,
110 if (SerializationErr) {
111 cantFail(Result.takeError());
112 Complete(std::move(SerializationErr));
113 return;
114 }
115 Complete(std::move(Result));
116 },
117 SAs.Instance, H, Lookup);
118}
119
120} // end namespace orc
121} // end namespace llvm
#define H(x, y, z)
Definition MD5.cpp:57
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
static int Lookup(ArrayRef< TableEntry > Table, unsigned Opcode)
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Tagged union holding either a T or a Error.
Definition Error.h:485
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
static LLVM_ABI Expected< EPCGenericDylibManager > CreateWithDefaultBootstrapSymbols(ExecutorProcessControl &EPC)
Create an EPCGenericMemoryAccess instance from a given set of function addrs.
LLVM_ABI void lookupAsync(tpctypes::DylibHandle H, const SymbolLookupSet &Lookup, SymbolLookupCompleteFn Complete)
Looks up symbols within the given dylib.
LLVM_ABI Expected< tpctypes::DylibHandle > open(StringRef Path, uint64_t Mode)
Loads the dylib with the given name.
unique_function< void(Expected< std::vector< ExecutorSymbolDef > >)> SymbolLookupCompleteFn
Represents an address in the executor process.
ExecutorProcessControl supports interaction with a JIT target process.
A set of symbols to look up, each associated with a SymbolLookupFlags value.
Definition Core.h:195
std::pair< SymbolStringPtr, SymbolLookupFlags > value_type
Definition Core.h:197
A utility class for serializing to a blob from a variadic list.
Output char buffer with overflow check.
static bool serialize(SPSOutputBuffer &OB, const DylibManager::LookupRequest &LR)
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.
shared::SPSExpected< shared::SPSSequence< shared::SPSExecutorSymbolDef > >( shared::SPSExecutorAddr, shared::SPSExecutorAddr, shared::SPSRemoteSymbolLookupSet) SPSSimpleExecutorDylibManagerLookupSignature
Definition OrcRTBridge.h:69
shared::SPSExpected< shared::SPSExecutorAddr >(shared::SPSExecutorAddr, shared::SPSString, uint64_t) SPSSimpleExecutorDylibManagerOpenSignature
Definition OrcRTBridge.h:65
SPSTuple< SPSString, bool > SPSRemoteSymbolLookupSetElement
SPSTuple< uint64_t, SPSRemoteSymbolLookupSet > SPSRemoteSymbolLookup
ExecutorAddr DylibHandle
A handle used to represent a loaded dylib in the target process.
std::vector< RemoteSymbolLookupSetElement > RemoteSymbolLookupSet
This is an optimization pass for GlobalISel generic memory operations.
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
Definition Error.h:769
A pair of a dylib and a set of symbols to be looked up.