Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:52

0001 //===--------------- SimpleExecutorDylibManager.h ---------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // A simple dynamic library management class. Allows dynamic libraries to be
0010 // loaded and searched.
0011 //
0012 // FIXME: The functionality in this file should be moved to the ORC runtime.
0013 //
0014 //===----------------------------------------------------------------------===//
0015 
0016 #ifndef LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_SIMPLEEXECUTORDYLIBMANAGER_H
0017 #define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_SIMPLEEXECUTORDYLIBMANAGER_H
0018 
0019 #include "llvm/ADT/DenseSet.h"
0020 #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
0021 #include "llvm/ExecutionEngine/Orc/Shared/ExecutorSymbolDef.h"
0022 #include "llvm/ExecutionEngine/Orc/Shared/SimpleRemoteEPCUtils.h"
0023 #include "llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h"
0024 #include "llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h"
0025 #include "llvm/ExecutionEngine/Orc/TargetProcess/ExecutorBootstrapService.h"
0026 #include "llvm/Support/DynamicLibrary.h"
0027 #include "llvm/Support/Error.h"
0028 
0029 #include <mutex>
0030 
0031 namespace llvm {
0032 namespace orc {
0033 namespace rt_bootstrap {
0034 
0035 /// Simple page-based allocator.
0036 class SimpleExecutorDylibManager : public ExecutorBootstrapService {
0037 public:
0038   virtual ~SimpleExecutorDylibManager();
0039 
0040   Expected<tpctypes::DylibHandle> open(const std::string &Path, uint64_t Mode);
0041   Expected<std::vector<ExecutorSymbolDef>>
0042   lookup(tpctypes::DylibHandle H, const RemoteSymbolLookupSet &L);
0043 
0044   Error shutdown() override;
0045   void addBootstrapSymbols(StringMap<ExecutorAddr> &M) override;
0046 
0047 private:
0048   using DylibSet = DenseSet<void *>;
0049 
0050   static llvm::orc::shared::CWrapperFunctionResult
0051   openWrapper(const char *ArgData, size_t ArgSize);
0052 
0053   static llvm::orc::shared::CWrapperFunctionResult
0054   lookupWrapper(const char *ArgData, size_t ArgSize);
0055 
0056   std::mutex M;
0057   DylibSet Dylibs;
0058 };
0059 
0060 } // end namespace rt_bootstrap
0061 } // end namespace orc
0062 } // end namespace llvm
0063 
0064 #endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_SIMPLEEXECUTORDYLIBMANAGER_H