Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 1 | //===--------------- SimpleExecutorDylibManager.h ---------------*- C++ -*-===// |
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 | // A simple dynamic library management class. Allows dynamic libraries to be |
||
10 | // loaded and searched. |
||
11 | // |
||
12 | // FIXME: The functionality in this file should be moved to the ORC runtime. |
||
13 | // |
||
14 | //===----------------------------------------------------------------------===// |
||
15 | |||
16 | #ifndef LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_SIMPLEEXECUTORDYLIBMANAGER_H |
||
17 | #define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_SIMPLEEXECUTORDYLIBMANAGER_H |
||
18 | |||
19 | #include "llvm/ADT/DenseSet.h" |
||
20 | #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h" |
||
21 | #include "llvm/ExecutionEngine/Orc/Shared/SimpleRemoteEPCUtils.h" |
||
22 | #include "llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h" |
||
23 | #include "llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h" |
||
24 | #include "llvm/ExecutionEngine/Orc/TargetProcess/ExecutorBootstrapService.h" |
||
25 | #include "llvm/Support/DynamicLibrary.h" |
||
26 | #include "llvm/Support/Error.h" |
||
27 | |||
28 | #include <mutex> |
||
29 | |||
30 | namespace llvm { |
||
31 | namespace orc { |
||
32 | namespace rt_bootstrap { |
||
33 | |||
34 | /// Simple page-based allocator. |
||
35 | class SimpleExecutorDylibManager : public ExecutorBootstrapService { |
||
36 | public: |
||
37 | virtual ~SimpleExecutorDylibManager(); |
||
38 | |||
39 | Expected<tpctypes::DylibHandle> open(const std::string &Path, uint64_t Mode); |
||
40 | Expected<std::vector<ExecutorAddr>> lookup(tpctypes::DylibHandle H, |
||
41 | const RemoteSymbolLookupSet &L); |
||
42 | |||
43 | Error shutdown() override; |
||
44 | void addBootstrapSymbols(StringMap<ExecutorAddr> &M) override; |
||
45 | |||
46 | private: |
||
47 | using DylibSet = DenseSet<void *>; |
||
48 | |||
49 | static llvm::orc::shared::CWrapperFunctionResult |
||
50 | openWrapper(const char *ArgData, size_t ArgSize); |
||
51 | |||
52 | static llvm::orc::shared::CWrapperFunctionResult |
||
53 | lookupWrapper(const char *ArgData, size_t ArgSize); |
||
54 | |||
55 | std::mutex M; |
||
56 | DylibSet Dylibs; |
||
57 | }; |
||
58 | |||
59 | } // end namespace rt_bootstrap |
||
60 | } // end namespace orc |
||
61 | } // end namespace llvm |
||
62 | |||
63 | #endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_SIMPLEEXECUTORDYLIBMANAGER_H |