| 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 | |
| 9 | #include "llvm/ExecutionEngine/Orc/EPCGenericDylibManagerSPS.h" |
| 10 | |
| 11 | #include "llvm/ExecutionEngine/Orc/Core.h" |
| 12 | #include "llvm/ExecutionEngine/Orc/LookupAndApply.h" |
| 13 | #include "llvm/ExecutionEngine/Orc/RecordProxy.h" |
| 14 | |
| 15 | namespace llvm::orc::sps { |
| 16 | |
| 17 | Expected<std::unique_ptr<EPCGenericDylibManager>> |
| 18 | createEPCGenericDylibManager(JITDylib &JD) { |
| 19 | auto &ES = JD.getExecutionSession(); |
| 20 | EPCGenericDylibManager::Bindings B; |
| 21 | // Instance is the executor-side manager object -- a data symbol passed as the |
| 22 | // first argument to each call, not a wrapper to proxy. The proxies resolve to |
| 23 | // the specs' default (NativeDylibManager) names. |
| 24 | if (auto Err = lookupAndApply( |
| 25 | JD, |
| 26 | PrepareFns: {recordAddr(Name: rt::sps_ci::NativeDylibManagerInstanceName, A: &B.Instance), |
| 27 | recordProxy<DylibMgrOpenProxySpec>(P: &B.Open), |
| 28 | recordProxy<DylibMgrResolveProxySpec>(P: &B.Resolve)})) |
| 29 | return std::move(Err); |
| 30 | return std::make_unique<EPCGenericDylibManager>(args&: ES, args: std::move(B)); |
| 31 | } |
| 32 | |
| 33 | Expected<std::unique_ptr<EPCGenericDylibManager>> |
| 34 | createEPCGenericDylibManager(ExecutionSession &ES) { |
| 35 | return createEPCGenericDylibManager(JD&: ES.getBootstrapJITDylib()); |
| 36 | } |
| 37 | |
| 38 | } // namespace llvm::orc::sps |
| 39 |