#include "llvm/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/WindowsError.h"
#include <sstream>
#if defined(LLVM_ON_UNIX)
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#if defined(__MVS__)
#include "llvm/Support/BLAKE3.h"
#include <sys/shm.h>
#endif
#include <unistd.h>
#endif
namespace llvm {
namespace orc {
namespace rt_bootstrap {
#if defined(_WIN32)
static DWORD getWindowsProtectionFlags(MemProt MP) {
if (MP == MemProt::Read)
return PAGE_READONLY;
if (MP == MemProt::Write ||
MP == (MemProt::Write | MemProt::Read)) {
return PAGE_READWRITE;
}
if (MP == (MemProt::Read | MemProt::Exec))
return PAGE_EXECUTE_READ;
if (MP == (MemProt::Read | MemProt::Write | MemProt::Exec))
return PAGE_EXECUTE_READWRITE;
if (MP == MemProt::Exec)
return PAGE_EXECUTE;
return PAGE_NOACCESS;
}
#endif
Expected<std::pair<ExecutorAddr, std::string>>
ExecutorSharedMemoryMapperService::reserve(uint64_t Size) { … }
Expected<ExecutorAddr> ExecutorSharedMemoryMapperService::initialize(
ExecutorAddr Reservation, tpctypes::SharedMemoryFinalizeRequest &FR) { … }
Error ExecutorSharedMemoryMapperService::deinitialize(
const std::vector<ExecutorAddr> &Bases) { … }
Error ExecutorSharedMemoryMapperService::release(
const std::vector<ExecutorAddr> &Bases) { … }
Error ExecutorSharedMemoryMapperService::shutdown() { … }
void ExecutorSharedMemoryMapperService::addBootstrapSymbols(
StringMap<ExecutorAddr> &M) { … }
llvm::orc::shared::CWrapperFunctionResult
ExecutorSharedMemoryMapperService::reserveWrapper(const char *ArgData,
size_t ArgSize) { … }
llvm::orc::shared::CWrapperFunctionResult
ExecutorSharedMemoryMapperService::initializeWrapper(const char *ArgData,
size_t ArgSize) { … }
llvm::orc::shared::CWrapperFunctionResult
ExecutorSharedMemoryMapperService::deinitializeWrapper(const char *ArgData,
size_t ArgSize) { … }
llvm::orc::shared::CWrapperFunctionResult
ExecutorSharedMemoryMapperService::releaseWrapper(const char *ArgData,
size_t ArgSize) { … }
}
}
}