LLVM  14.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 
15 namespace llvm {
16 namespace orc {
17 namespace shared {
18 
19 template <>
21  SymbolLookupSet::value_type> {
22 public:
23  static size_t size(const SymbolLookupSet::value_type &V) {
25  *V.first, V.second == SymbolLookupFlags::RequiredSymbol);
26  }
27 
29  const SymbolLookupSet::value_type &V) {
31  OB, *V.first, V.second == SymbolLookupFlags::RequiredSymbol);
32  }
33 };
34 
35 template <>
38 public:
39  static constexpr bool available = true;
40 };
41 
42 template <>
44  ExecutorProcessControl::LookupRequest> {
45  using MemberSerialization =
47 
48 public:
49  static size_t size(const ExecutorProcessControl::LookupRequest &LR) {
51  }
52 
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 
74 Expected<tpctypes::DylibHandle> EPCGenericDylibManager::open(StringRef Path,
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  const SymbolLookupSet &Lookup) {
87  Expected<std::vector<ExecutorAddr>> Result((std::vector<ExecutorAddr>()));
88  if (auto Err =
90  SAs.Lookup, Result, SAs.Instance, H, Lookup))
91  return std::move(Err);
92  return Result;
93 }
94 
98  Expected<std::vector<ExecutorAddr>> Result((std::vector<ExecutorAddr>()));
99  if (auto Err =
101  SAs.Lookup, Result, SAs.Instance, H, Lookup))
102  return std::move(Err);
103  return Result;
104 }
105 
106 } // end namespace orc
107 } // end namespace llvm
llvm::orc::ExecutorAddr
Represents an address in the executor process.
Definition: ExecutorAddress.h:37
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::orc::RemoteSymbolLookupSet
std::vector< RemoteSymbolLookupSetElement > RemoteSymbolLookupSet
Definition: SimpleRemoteEPCUtils.h:146
llvm::orc::EPCGenericDylibManager::SymbolAddrs
Function addresses for memory access.
Definition: EPCGenericDylibManager.h:32
llvm::orc::shared::TrivialSPSSequenceSerialization
Specialize this to implement 'trivial' sequence serialization for a concrete sequence type.
Definition: SimplePackedSerialization.h:224
llvm::orc::ExecutorProcessControl::getBootstrapSymbols
Error getBootstrapSymbols(ArrayRef< std::pair< ExecutorAddr &, StringRef >> Pairs) const
For each (ExecutorAddr&, StringRef) pair, looks up the string in the bootstrap symbols map and writes...
Definition: ExecutorProcessControl.h:229
llvm::orc::shared::SPSSerializationTraits
Specialize to describe how to serialize/deserialize to/from the given concrete type.
Definition: SimplePackedSerialization.h:103
llvm::orc::EPCGenericDylibManager::CreateWithDefaultBootstrapSymbols
static Expected< EPCGenericDylibManager > CreateWithDefaultBootstrapSymbols(ExecutorProcessControl &EPC)
Create an EPCGenericMemoryAccess instance from a given set of function addrs.
Definition: EPCGenericDylibManager.cpp:63
SimpleRemoteEPCUtils.h
llvm::orc::SymbolLookupSet
A set of symbols to look up, each associated with a SymbolLookupFlags value.
Definition: Core.h:175
llvm::orc::shared::SPSOutputBuffer
Output char buffer with overflow check.
Definition: SimplePackedSerialization.h:53
llvm::orc::ExecutorProcessControl
ExecutorProcessControl supports interaction with a JIT target process.
Definition: ExecutorProcessControl.h:38
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::orc::shared::SPSTuple
SPS tag type for tuples.
Definition: SimplePackedSerialization.h:183
llvm::orc::ExecutorProcessControl::LookupRequest::Handle
tpctypes::DylibHandle Handle
Definition: ExecutorProcessControl.h:168
llvm::orc::rt::SPSSimpleExecutorDylibManagerLookupSignature
shared::SPSExpected< shared::SPSSequence< shared::SPSExecutorAddr > >(shared::SPSExecutorAddr, uint64_t, shared::SPSRemoteSymbolLookupSet) SPSSimpleExecutorDylibManagerLookupSignature
Definition: OrcRTBridge.h:51
llvm::orc::ExecutorProcessControl::LookupRequest::Symbols
const SymbolLookupSet & Symbols
Definition: ExecutorProcessControl.h:169
llvm::orc::EPCGenericDylibManager
Definition: EPCGenericDylibManager.h:29
llvm::orc::shared::TrivialSPSSequenceSerialization::available
static constexpr bool available
Definition: SimplePackedSerialization.h:226
llvm::orc::ExecutorProcessControl::LookupRequest
A pair of a dylib and a set of symbols to be looked up.
Definition: ExecutorProcessControl.h:165
llvm::orc::SymbolLookupSet::value_type
std::pair< SymbolStringPtr, SymbolLookupFlags > value_type
Definition: Core.h:177
uint64_t
llvm::orc::rt::SPSSimpleExecutorDylibManagerOpenSignature
shared::SPSExpected< uint64_t >(shared::SPSExecutorAddr, shared::SPSString, uint64_t) SPSSimpleExecutorDylibManagerOpenSignature
Definition: OrcRTBridge.h:47
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::orc::shared::SPSSerializationTraits< SPSRemoteSymbolLookupSetElement, SymbolLookupSet::value_type >::serialize
static bool serialize(SPSOutputBuffer &OB, const SymbolLookupSet::value_type &V)
Definition: EPCGenericDylibManager.cpp:28
size
i< reg-> size
Definition: README.txt:166
llvm::orc::shared::SPSSerializationTraits< SPSRemoteSymbolLookup, ExecutorProcessControl::LookupRequest >::size
static size_t size(const ExecutorProcessControl::LookupRequest &LR)
Definition: EPCGenericDylibManager.cpp:49
Mode
SI Whole Quad Mode
Definition: SIWholeQuadMode.cpp:262
EPCGenericDylibManager.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::orc::shared::SPSSerializationTraits< SPSRemoteSymbolLookupSetElement, SymbolLookupSet::value_type >::size
static size_t size(const SymbolLookupSet::value_type &V)
Definition: EPCGenericDylibManager.cpp:23
llvm::orc::shared::SPSSerializationTraits< SPSRemoteSymbolLookup, ExecutorProcessControl::LookupRequest >::serialize
static bool serialize(SPSOutputBuffer &OB, const ExecutorProcessControl::LookupRequest &LR)
Definition: EPCGenericDylibManager.cpp:53
H
#define H(x, y, z)
Definition: MD5.cpp:58
Lookup
static int Lookup(ArrayRef< TableEntry > Table, unsigned Opcode)
Definition: X86FloatingPoint.cpp:597
Core.h
lookup
static bool lookup(const GsymReader &GR, DataExtractor &Data, uint64_t &Offset, uint64_t BaseAddr, uint64_t Addr, SourceLocations &SrcLocs, llvm::Error &Err)
A Lookup helper functions.
Definition: InlineInfo.cpp:108
llvm::X86II::OB
@ OB
Definition: X86BaseInfo.h:801
llvm::orc::SymbolLookupFlags::RequiredSymbol
@ RequiredSymbol
OrcRTBridge.h
llvm::orc::shared::SPSArgList
A utility class for serializing to a blob from a variadic list.
Definition: SimplePackedSerialization.h:106