@@ -64,40 +64,6 @@ SimpleRemoteEPC::~SimpleRemoteEPC() {
64
64
assert (Disconnected && " Destroyed without disconnection" );
65
65
}
66
66
67
- Error SimpleRemoteEPC::setup (std::unique_ptr<SimpleRemoteEPCTransport> T,
68
- const SimpleRemoteEPCExecutorInfo &EI) {
69
- using namespace SimpleRemoteEPCDefaultBootstrapSymbolNames ;
70
- LLVM_DEBUG ({
71
- dbgs () << " SimpleRemoteEPC received setup message:\n "
72
- << " Triple: " << EI.TargetTriple << " \n "
73
- << " Page size: " << EI.PageSize << " \n "
74
- << " Bootstrap symbols:\n " ;
75
- for (const auto &KV : EI.BootstrapSymbols )
76
- dbgs () << " " << KV.first () << " : "
77
- << formatv (" {0:x16}" , KV.second .getValue ()) << " \n " ;
78
- });
79
- this ->T = std::move (T);
80
- TargetTriple = Triple (EI.TargetTriple );
81
- PageSize = EI.PageSize ;
82
-
83
- if (auto Err = EI.getBootstrapSymbols (
84
- {{JDI.JITDispatchContextAddress , ExecutorSessionObjectName},
85
- {JDI.JITDispatchFunctionAddress , DispatchFnName},
86
- {LoadDylibAddr, " __llvm_orc_load_dylib" },
87
- {LookupSymbolsAddr, " __llvm_orc_lookup_symbols" },
88
- {RunAsMainAddr, " __llvm_orc_run_as_main" }}))
89
- return Err;
90
-
91
- if (!MemMgr)
92
- if (auto Err = setupDefaultMemoryManager (EI))
93
- return Err;
94
- if (!MemAccess)
95
- if (auto Err = setupDefaultMemoryAccess (EI))
96
- return Err;
97
-
98
- return Error::success ();
99
- }
100
-
101
67
Expected<tpctypes::DylibHandle>
102
68
SimpleRemoteEPC::loadDylib (const char *DylibPath) {
103
69
Expected<tpctypes::DylibHandle> H ((tpctypes::DylibHandle ()));
@@ -201,37 +167,22 @@ void SimpleRemoteEPC::handleDisconnect(Error Err) {
201
167
}
202
168
}
203
169
204
- void SimpleRemoteEPC::setMemoryManager (
205
- std::unique_ptr<jitlink::JITLinkMemoryManager> MemMgr) {
206
- OwnedMemMgr = std::move (MemMgr);
207
- this ->MemMgr = OwnedMemMgr.get ();
208
- }
209
-
210
- void SimpleRemoteEPC::setMemoryAccess (std::unique_ptr<MemoryAccess> MemAccess) {
211
- OwnedMemAccess = std::move (MemAccess);
212
- this ->MemAccess = OwnedMemAccess.get ();
213
- }
214
-
215
- Error SimpleRemoteEPC::setupDefaultMemoryManager (
216
- const SimpleRemoteEPCExecutorInfo &EI) {
217
-
170
+ Expected<std::unique_ptr<jitlink::JITLinkMemoryManager>>
171
+ SimpleRemoteEPC::createMemoryManager () {
218
172
EPCGenericJITLinkMemoryManager::FuncAddrs FAs;
219
-
220
- if (auto Err = EI.getBootstrapSymbols (
173
+ if (auto Err = getBootstrapSymbols (
221
174
{{FAs.Reserve , " __llvm_orc_memory_reserve" },
222
175
{FAs.Finalize , " __llvm_orc_memory_finalize" },
223
176
{FAs.Deallocate , " __llvm_orc_memory_deallocate" }}))
224
- return Err;
177
+ return std::move ( Err) ;
225
178
226
- setMemoryManager (
227
- std::make_unique<EPCGenericJITLinkMemoryManager>(*this , FAs));
228
- return Error::success ();
179
+ return std::make_unique<EPCGenericJITLinkMemoryManager>(*this , FAs);
229
180
}
230
181
231
- Error SimpleRemoteEPC::setupDefaultMemoryAccess (
232
- const SimpleRemoteEPCExecutorInfo &EI ) {
182
+ Expected<std::unique_ptr<ExecutorProcessControl::MemoryAccess>>
183
+ SimpleRemoteEPC::createMemoryAccess ( ) {
233
184
234
- return Error::success () ;
185
+ return nullptr ;
235
186
}
236
187
237
188
Error SimpleRemoteEPC::handleSetup (uint64_t SeqNo, ExecutorAddress TagAddr,
@@ -279,6 +230,46 @@ void SimpleRemoteEPC::prepareToReceiveSetupMessage(
279
230
};
280
231
}
281
232
233
+ Error SimpleRemoteEPC::setup (std::unique_ptr<SimpleRemoteEPCTransport> T,
234
+ SimpleRemoteEPCExecutorInfo EI) {
235
+ using namespace SimpleRemoteEPCDefaultBootstrapSymbolNames ;
236
+ LLVM_DEBUG ({
237
+ dbgs () << " SimpleRemoteEPC received setup message:\n "
238
+ << " Triple: " << EI.TargetTriple << " \n "
239
+ << " Page size: " << EI.PageSize << " \n "
240
+ << " Bootstrap symbols:\n " ;
241
+ for (const auto &KV : EI.BootstrapSymbols )
242
+ dbgs () << " " << KV.first () << " : "
243
+ << formatv (" {0:x16}" , KV.second .getValue ()) << " \n " ;
244
+ });
245
+ this ->T = std::move (T);
246
+ TargetTriple = Triple (EI.TargetTriple );
247
+ PageSize = EI.PageSize ;
248
+ BootstrapSymbols = std::move (EI.BootstrapSymbols );
249
+
250
+ if (auto Err = getBootstrapSymbols (
251
+ {{JDI.JITDispatchContextAddress , ExecutorSessionObjectName},
252
+ {JDI.JITDispatchFunctionAddress , DispatchFnName},
253
+ {LoadDylibAddr, " __llvm_orc_load_dylib" },
254
+ {LookupSymbolsAddr, " __llvm_orc_lookup_symbols" },
255
+ {RunAsMainAddr, " __llvm_orc_run_as_main" }}))
256
+ return Err;
257
+
258
+ if (auto MemMgr = createMemoryManager ()) {
259
+ OwnedMemMgr = std::move (*MemMgr);
260
+ this ->MemMgr = OwnedMemMgr.get ();
261
+ } else
262
+ return MemMgr.takeError ();
263
+
264
+ if (auto MemAccess = createMemoryAccess ()) {
265
+ OwnedMemAccess = std::move (*MemAccess);
266
+ this ->MemAccess = OwnedMemAccess.get ();
267
+ } else
268
+ return MemAccess.takeError ();
269
+
270
+ return Error::success ();
271
+ }
272
+
282
273
Error SimpleRemoteEPC::handleResult (uint64_t SeqNo, ExecutorAddress TagAddr,
283
274
SimpleRemoteEPCArgBytesVector ArgBytes) {
284
275
SendResultFunction SendResult;
0 commit comments