EPCGenericJITLinkMemoryManager(ExecutorProcessControl &EPC, FuncAddrs FAs)
: EPC(EPC), FAs(FAs) {}
- /// Create using the standard memory access function names from the ORC
- /// runtime.
+ /// Create using the standard memory allocation function names from the
+ /// ORCTargetProcess library.
static Expected<std::unique_ptr<EPCGenericJITLinkMemoryManager>>
- CreateUsingOrcRTFuncs(ExecutionSession &ES, JITDylib &OrcRuntimeJD);
+ CreateUsingOrcRTFuncs(ExecutorProcessControl &EPC);
Expected<std::unique_ptr<Allocation>>
allocate(const jitlink::JITLinkDylib *JD,
EPCGenericMemoryAccess(ExecutorProcessControl &EPC, FuncAddrs FAs)
: EPC(EPC), FAs(FAs) {}
- /// Create using the standard memory access function names from the ORC
- /// runtime.
+ /// Create using the standard memory access function names from the
+ /// ORCTargetProcess library.
static Expected<std::unique_ptr<EPCGenericMemoryAccess>>
- CreateUsingOrcRTFuncs(ExecutionSession &ES, JITDylib &OrcRuntimeJD);
+ CreateUsingOrcRTFuncs(ExecutorProcessControl &EPC);
void writeUInt8sAsync(ArrayRef<tpctypes::UInt8Write> Ws,
WriteResultFn OnWriteComplete) override {
/// Create from a ExecutorProcessControl instance.
Expected<std::unique_ptr<EPCGenericJITLinkMemoryManager>>
-EPCGenericJITLinkMemoryManager::CreateUsingOrcRTFuncs(ExecutionSession &ES,
- JITDylib &OrcRuntimeJD) {
+EPCGenericJITLinkMemoryManager::CreateUsingOrcRTFuncs(
+ ExecutorProcessControl &EPC) {
+
+ auto H = EPC.loadDylib("");
+ if (!H)
+ return H.takeError();
StringRef GlobalPrefix = "";
- if (ES.getExecutorProcessControl().getTargetTriple().isOSBinFormatMachO())
+ if (EPC.getTargetTriple().isOSBinFormatMachO())
GlobalPrefix = "_";
FuncAddrs FAs;
if (auto Err = lookupAndRecordAddrs(
- ES, LookupKind::Static, makeJITDylibSearchOrder(&OrcRuntimeJD),
- {{ES.intern((GlobalPrefix + "__orc_rt_reserve").str()), &FAs.Reserve},
- {ES.intern((GlobalPrefix + "__orc_rt_finalize").str()),
+ EPC, *H,
+ {{EPC.intern((GlobalPrefix + "__orc_rt_reserve").str()), &FAs.Reserve},
+ {EPC.intern((GlobalPrefix + "__orc_rt_finalize").str()),
&FAs.Finalize},
- {ES.intern((GlobalPrefix + "__orc_rt_deallocate").str()),
+ {EPC.intern((GlobalPrefix + "__orc_rt_deallocate").str()),
&FAs.Deallocate}}))
return std::move(Err);
- return std::make_unique<EPCGenericJITLinkMemoryManager>(
- ES.getExecutorProcessControl(), FAs);
+ return std::make_unique<EPCGenericJITLinkMemoryManager>(EPC, std::move(FAs));
}
Expected<std::unique_ptr<jitlink::JITLinkMemoryManager::Allocation>>
/// Create from a ExecutorProcessControl instance.
Expected<std::unique_ptr<EPCGenericMemoryAccess>>
-EPCGenericMemoryAccess::CreateUsingOrcRTFuncs(ExecutionSession &ES,
- JITDylib &OrcRuntimeJD) {
+EPCGenericMemoryAccess::CreateUsingOrcRTFuncs(ExecutorProcessControl &EPC) {
+
+ auto H = EPC.loadDylib("");
+ if (!H)
+ return H.takeError();
StringRef GlobalPrefix = "";
- if (ES.getExecutorProcessControl().getTargetTriple().isOSBinFormatMachO())
+ if (EPC.getTargetTriple().isOSBinFormatMachO())
GlobalPrefix = "_";
FuncAddrs FAs;
if (auto Err = lookupAndRecordAddrs(
- ES, LookupKind::Static, makeJITDylibSearchOrder(&OrcRuntimeJD),
- {{ES.intern((GlobalPrefix + "__orc_rt_write_uint8s_wrapper").str()),
+ EPC, *H,
+ {{EPC.intern((GlobalPrefix + "__orc_rt_write_uint8s_wrapper").str()),
&FAs.WriteUInt8s},
- {ES.intern((GlobalPrefix + "__orc_rt_write_uint16s_wrapper").str()),
+ {EPC.intern((GlobalPrefix + "__orc_rt_write_uint16s_wrapper").str()),
&FAs.WriteUInt16s},
- {ES.intern((GlobalPrefix + "__orc_rt_write_uint32s_wrapper").str()),
+ {EPC.intern((GlobalPrefix + "__orc_rt_write_uint32s_wrapper").str()),
&FAs.WriteUInt32s},
- {ES.intern((GlobalPrefix + "__orc_rt_write_uint64s_wrapper").str()),
+ {EPC.intern((GlobalPrefix + "__orc_rt_write_uint64s_wrapper").str()),
&FAs.WriteUInt64s},
- {ES.intern((GlobalPrefix + "__orc_rt_write_buffers_wrapper").str()),
+ {EPC.intern((GlobalPrefix + "__orc_rt_write_buffers_wrapper").str()),
&FAs.WriteBuffers}}))
return std::move(Err);
- return std::make_unique<EPCGenericMemoryAccess>(
- ES.getExecutorProcessControl(), FAs);
+ return std::make_unique<EPCGenericMemoryAccess>(EPC, std::move(FAs));
}
} // end namespace orc