1*1b1f1c77SAnubhab Ghosh //===---------- ExecutorSharedMemoryMapperService.cpp -----------*- C++ -*-===// 2*1b1f1c77SAnubhab Ghosh // 3*1b1f1c77SAnubhab Ghosh // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*1b1f1c77SAnubhab Ghosh // See https://llvm.org/LICENSE.txt for license information. 5*1b1f1c77SAnubhab Ghosh // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*1b1f1c77SAnubhab Ghosh // 7*1b1f1c77SAnubhab Ghosh //===----------------------------------------------------------------------===// 8*1b1f1c77SAnubhab Ghosh 9*1b1f1c77SAnubhab Ghosh #include "llvm/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.h" 10*1b1f1c77SAnubhab Ghosh 11*1b1f1c77SAnubhab Ghosh #include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h" 12*1b1f1c77SAnubhab Ghosh #include "llvm/Support/Process.h" 13*1b1f1c77SAnubhab Ghosh #include "llvm/Support/WindowsError.h" 14*1b1f1c77SAnubhab Ghosh 15*1b1f1c77SAnubhab Ghosh #include <sstream> 16*1b1f1c77SAnubhab Ghosh 17*1b1f1c77SAnubhab Ghosh #if defined(LLVM_ON_UNIX) 18*1b1f1c77SAnubhab Ghosh #include <errno.h> 19*1b1f1c77SAnubhab Ghosh #include <fcntl.h> 20*1b1f1c77SAnubhab Ghosh #include <sys/mman.h> 21*1b1f1c77SAnubhab Ghosh #include <unistd.h> 22*1b1f1c77SAnubhab Ghosh #endif 23*1b1f1c77SAnubhab Ghosh 24*1b1f1c77SAnubhab Ghosh #if defined(_WIN32) 25*1b1f1c77SAnubhab Ghosh static DWORD getWindowsProtectionFlags(unsigned Flags) { 26*1b1f1c77SAnubhab Ghosh switch (Flags & llvm::sys::Memory::MF_RWE_MASK) { 27*1b1f1c77SAnubhab Ghosh case llvm::sys::Memory::MF_READ: 28*1b1f1c77SAnubhab Ghosh return PAGE_READONLY; 29*1b1f1c77SAnubhab Ghosh case llvm::sys::Memory::MF_WRITE: 30*1b1f1c77SAnubhab Ghosh // Note: PAGE_WRITE is not supported by VirtualProtect 31*1b1f1c77SAnubhab Ghosh return PAGE_READWRITE; 32*1b1f1c77SAnubhab Ghosh case llvm::sys::Memory::MF_READ | llvm::sys::Memory::MF_WRITE: 33*1b1f1c77SAnubhab Ghosh return PAGE_READWRITE; 34*1b1f1c77SAnubhab Ghosh case llvm::sys::Memory::MF_READ | llvm::sys::Memory::MF_EXEC: 35*1b1f1c77SAnubhab Ghosh return PAGE_EXECUTE_READ; 36*1b1f1c77SAnubhab Ghosh case llvm::sys::Memory::MF_READ | llvm::sys::Memory::MF_WRITE | 37*1b1f1c77SAnubhab Ghosh llvm::sys::Memory::MF_EXEC: 38*1b1f1c77SAnubhab Ghosh return PAGE_EXECUTE_READWRITE; 39*1b1f1c77SAnubhab Ghosh case llvm::sys::Memory::MF_EXEC: 40*1b1f1c77SAnubhab Ghosh return PAGE_EXECUTE; 41*1b1f1c77SAnubhab Ghosh default: 42*1b1f1c77SAnubhab Ghosh llvm_unreachable("Illegal memory protection flag specified!"); 43*1b1f1c77SAnubhab Ghosh } 44*1b1f1c77SAnubhab Ghosh // Provide a default return value as required by some compilers. 45*1b1f1c77SAnubhab Ghosh return PAGE_NOACCESS; 46*1b1f1c77SAnubhab Ghosh } 47*1b1f1c77SAnubhab Ghosh #endif 48*1b1f1c77SAnubhab Ghosh 49*1b1f1c77SAnubhab Ghosh namespace llvm { 50*1b1f1c77SAnubhab Ghosh namespace orc { 51*1b1f1c77SAnubhab Ghosh namespace rt_bootstrap { 52*1b1f1c77SAnubhab Ghosh 53*1b1f1c77SAnubhab Ghosh Expected<std::pair<ExecutorAddr, std::string>> 54*1b1f1c77SAnubhab Ghosh ExecutorSharedMemoryMapperService::reserve(uint64_t Size) { 55*1b1f1c77SAnubhab Ghosh #if defined(LLVM_ON_UNIX) || defined(_WIN32) 56*1b1f1c77SAnubhab Ghosh 57*1b1f1c77SAnubhab Ghosh #if defined(LLVM_ON_UNIX) 58*1b1f1c77SAnubhab Ghosh 59*1b1f1c77SAnubhab Ghosh std::string SharedMemoryName; 60*1b1f1c77SAnubhab Ghosh { 61*1b1f1c77SAnubhab Ghosh std::stringstream SharedMemoryNameStream; 62*1b1f1c77SAnubhab Ghosh SharedMemoryNameStream << "/jitlink_" << sys::Process::getProcessId() << '_' 63*1b1f1c77SAnubhab Ghosh << (++SharedMemoryCount); 64*1b1f1c77SAnubhab Ghosh SharedMemoryName = SharedMemoryNameStream.str(); 65*1b1f1c77SAnubhab Ghosh } 66*1b1f1c77SAnubhab Ghosh 67*1b1f1c77SAnubhab Ghosh int SharedMemoryFile = 68*1b1f1c77SAnubhab Ghosh shm_open(SharedMemoryName.c_str(), O_RDWR | O_CREAT | O_EXCL, 0700); 69*1b1f1c77SAnubhab Ghosh if (SharedMemoryFile < 0) 70*1b1f1c77SAnubhab Ghosh return errorCodeToError(std::error_code(errno, std::generic_category())); 71*1b1f1c77SAnubhab Ghosh 72*1b1f1c77SAnubhab Ghosh // by default size is 0 73*1b1f1c77SAnubhab Ghosh if (ftruncate(SharedMemoryFile, Size) < 0) 74*1b1f1c77SAnubhab Ghosh return errorCodeToError(std::error_code(errno, std::generic_category())); 75*1b1f1c77SAnubhab Ghosh 76*1b1f1c77SAnubhab Ghosh void *Addr = mmap(nullptr, Size, PROT_NONE, MAP_SHARED, SharedMemoryFile, 0); 77*1b1f1c77SAnubhab Ghosh if (Addr == MAP_FAILED) 78*1b1f1c77SAnubhab Ghosh return errorCodeToError(std::error_code(errno, std::generic_category())); 79*1b1f1c77SAnubhab Ghosh 80*1b1f1c77SAnubhab Ghosh close(SharedMemoryFile); 81*1b1f1c77SAnubhab Ghosh 82*1b1f1c77SAnubhab Ghosh #elif defined(_WIN32) 83*1b1f1c77SAnubhab Ghosh 84*1b1f1c77SAnubhab Ghosh std::string SharedMemoryName; 85*1b1f1c77SAnubhab Ghosh { 86*1b1f1c77SAnubhab Ghosh std::stringstream SharedMemoryNameStream; 87*1b1f1c77SAnubhab Ghosh SharedMemoryNameStream << "jitlink_" << sys::Process::getProcessId() << '_' 88*1b1f1c77SAnubhab Ghosh << (++SharedMemoryCount); 89*1b1f1c77SAnubhab Ghosh SharedMemoryName = SharedMemoryNameStream.str(); 90*1b1f1c77SAnubhab Ghosh } 91*1b1f1c77SAnubhab Ghosh 92*1b1f1c77SAnubhab Ghosh std::wstring WideSharedMemoryName(SharedMemoryName.begin(), 93*1b1f1c77SAnubhab Ghosh SharedMemoryName.end()); 94*1b1f1c77SAnubhab Ghosh HANDLE SharedMemoryFile = CreateFileMappingW( 95*1b1f1c77SAnubhab Ghosh INVALID_HANDLE_VALUE, NULL, PAGE_EXECUTE_READWRITE, Size >> 32, 96*1b1f1c77SAnubhab Ghosh Size & 0xffffffff, WideSharedMemoryName.c_str()); 97*1b1f1c77SAnubhab Ghosh if (!SharedMemoryFile) 98*1b1f1c77SAnubhab Ghosh return errorCodeToError(mapWindowsError(GetLastError())); 99*1b1f1c77SAnubhab Ghosh 100*1b1f1c77SAnubhab Ghosh void *Addr = MapViewOfFile(SharedMemoryFile, 101*1b1f1c77SAnubhab Ghosh FILE_MAP_ALL_ACCESS | FILE_MAP_EXECUTE, 0, 0, 0); 102*1b1f1c77SAnubhab Ghosh if (!Addr) { 103*1b1f1c77SAnubhab Ghosh CloseHandle(SharedMemoryFile); 104*1b1f1c77SAnubhab Ghosh return errorCodeToError(mapWindowsError(GetLastError())); 105*1b1f1c77SAnubhab Ghosh } 106*1b1f1c77SAnubhab Ghosh 107*1b1f1c77SAnubhab Ghosh #endif 108*1b1f1c77SAnubhab Ghosh 109*1b1f1c77SAnubhab Ghosh { 110*1b1f1c77SAnubhab Ghosh std::lock_guard<std::mutex> Lock(Mutex); 111*1b1f1c77SAnubhab Ghosh Reservations[Addr].Size = Size; 112*1b1f1c77SAnubhab Ghosh #if defined(_WIN32) 113*1b1f1c77SAnubhab Ghosh Reservations[Addr].SharedMemoryFile = SharedMemoryFile; 114*1b1f1c77SAnubhab Ghosh #endif 115*1b1f1c77SAnubhab Ghosh } 116*1b1f1c77SAnubhab Ghosh 117*1b1f1c77SAnubhab Ghosh return std::make_pair(ExecutorAddr::fromPtr(Addr), 118*1b1f1c77SAnubhab Ghosh std::move(SharedMemoryName)); 119*1b1f1c77SAnubhab Ghosh #else 120*1b1f1c77SAnubhab Ghosh return make_error<StringError>( 121*1b1f1c77SAnubhab Ghosh "SharedMemoryMapper is not supported on this platform yet", 122*1b1f1c77SAnubhab Ghosh inconvertibleErrorCode()); 123*1b1f1c77SAnubhab Ghosh #endif 124*1b1f1c77SAnubhab Ghosh } 125*1b1f1c77SAnubhab Ghosh 126*1b1f1c77SAnubhab Ghosh Expected<ExecutorAddr> ExecutorSharedMemoryMapperService::initialize( 127*1b1f1c77SAnubhab Ghosh ExecutorAddr Reservation, tpctypes::SharedMemoryFinalizeRequest &FR) { 128*1b1f1c77SAnubhab Ghosh #if defined(LLVM_ON_UNIX) || defined(_WIN32) 129*1b1f1c77SAnubhab Ghosh 130*1b1f1c77SAnubhab Ghosh ExecutorAddr MinAddr(~0ULL); 131*1b1f1c77SAnubhab Ghosh 132*1b1f1c77SAnubhab Ghosh // Contents are already in place 133*1b1f1c77SAnubhab Ghosh for (auto &Segment : FR.Segments) { 134*1b1f1c77SAnubhab Ghosh if (Segment.Addr < MinAddr) 135*1b1f1c77SAnubhab Ghosh MinAddr = Segment.Addr; 136*1b1f1c77SAnubhab Ghosh 137*1b1f1c77SAnubhab Ghosh #if defined(LLVM_ON_UNIX) 138*1b1f1c77SAnubhab Ghosh 139*1b1f1c77SAnubhab Ghosh int NativeProt = 0; 140*1b1f1c77SAnubhab Ghosh if (Segment.Prot & tpctypes::WPF_Read) 141*1b1f1c77SAnubhab Ghosh NativeProt |= PROT_READ; 142*1b1f1c77SAnubhab Ghosh if (Segment.Prot & tpctypes::WPF_Write) 143*1b1f1c77SAnubhab Ghosh NativeProt |= PROT_WRITE; 144*1b1f1c77SAnubhab Ghosh if (Segment.Prot & tpctypes::WPF_Exec) 145*1b1f1c77SAnubhab Ghosh NativeProt |= PROT_EXEC; 146*1b1f1c77SAnubhab Ghosh 147*1b1f1c77SAnubhab Ghosh if (mprotect(Segment.Addr.toPtr<void *>(), Segment.Size, NativeProt)) 148*1b1f1c77SAnubhab Ghosh return errorCodeToError(std::error_code(errno, std::generic_category())); 149*1b1f1c77SAnubhab Ghosh 150*1b1f1c77SAnubhab Ghosh #elif defined(_WIN32) 151*1b1f1c77SAnubhab Ghosh 152*1b1f1c77SAnubhab Ghosh DWORD NativeProt = 153*1b1f1c77SAnubhab Ghosh getWindowsProtectionFlags(fromWireProtectionFlags(Segment.Prot)); 154*1b1f1c77SAnubhab Ghosh 155*1b1f1c77SAnubhab Ghosh if (!VirtualProtect(Segment.Addr.toPtr<void *>(), Segment.Size, NativeProt, 156*1b1f1c77SAnubhab Ghosh &NativeProt)) 157*1b1f1c77SAnubhab Ghosh return errorCodeToError(mapWindowsError(GetLastError())); 158*1b1f1c77SAnubhab Ghosh 159*1b1f1c77SAnubhab Ghosh #endif 160*1b1f1c77SAnubhab Ghosh 161*1b1f1c77SAnubhab Ghosh if (Segment.Prot & tpctypes::WPF_Exec) 162*1b1f1c77SAnubhab Ghosh sys::Memory::InvalidateInstructionCache(Segment.Addr.toPtr<void *>(), 163*1b1f1c77SAnubhab Ghosh Segment.Size); 164*1b1f1c77SAnubhab Ghosh } 165*1b1f1c77SAnubhab Ghosh 166*1b1f1c77SAnubhab Ghosh // Run finalization actions and get deinitlization action list. 167*1b1f1c77SAnubhab Ghosh auto DeinitializeActions = shared::runFinalizeActions(FR.Actions); 168*1b1f1c77SAnubhab Ghosh if (!DeinitializeActions) { 169*1b1f1c77SAnubhab Ghosh return DeinitializeActions.takeError(); 170*1b1f1c77SAnubhab Ghosh } 171*1b1f1c77SAnubhab Ghosh 172*1b1f1c77SAnubhab Ghosh { 173*1b1f1c77SAnubhab Ghosh std::lock_guard<std::mutex> Lock(Mutex); 174*1b1f1c77SAnubhab Ghosh Allocations[MinAddr].DeinitializationActions = 175*1b1f1c77SAnubhab Ghosh std::move(*DeinitializeActions); 176*1b1f1c77SAnubhab Ghosh Reservations[Reservation.toPtr<void *>()].Allocations.push_back(MinAddr); 177*1b1f1c77SAnubhab Ghosh } 178*1b1f1c77SAnubhab Ghosh 179*1b1f1c77SAnubhab Ghosh return MinAddr; 180*1b1f1c77SAnubhab Ghosh 181*1b1f1c77SAnubhab Ghosh #else 182*1b1f1c77SAnubhab Ghosh return make_error<StringError>( 183*1b1f1c77SAnubhab Ghosh "SharedMemoryMapper is not supported on this platform yet", 184*1b1f1c77SAnubhab Ghosh inconvertibleErrorCode()); 185*1b1f1c77SAnubhab Ghosh #endif 186*1b1f1c77SAnubhab Ghosh } 187*1b1f1c77SAnubhab Ghosh 188*1b1f1c77SAnubhab Ghosh Error ExecutorSharedMemoryMapperService::deinitialize( 189*1b1f1c77SAnubhab Ghosh const std::vector<ExecutorAddr> &Bases) { 190*1b1f1c77SAnubhab Ghosh Error AllErr = Error::success(); 191*1b1f1c77SAnubhab Ghosh 192*1b1f1c77SAnubhab Ghosh { 193*1b1f1c77SAnubhab Ghosh std::lock_guard<std::mutex> Lock(Mutex); 194*1b1f1c77SAnubhab Ghosh 195*1b1f1c77SAnubhab Ghosh for (auto Base : Bases) { 196*1b1f1c77SAnubhab Ghosh if (Error Err = shared::runDeallocActions( 197*1b1f1c77SAnubhab Ghosh Allocations[Base].DeinitializationActions)) { 198*1b1f1c77SAnubhab Ghosh AllErr = joinErrors(std::move(AllErr), std::move(Err)); 199*1b1f1c77SAnubhab Ghosh } 200*1b1f1c77SAnubhab Ghosh 201*1b1f1c77SAnubhab Ghosh Allocations.erase(Base); 202*1b1f1c77SAnubhab Ghosh } 203*1b1f1c77SAnubhab Ghosh } 204*1b1f1c77SAnubhab Ghosh 205*1b1f1c77SAnubhab Ghosh return AllErr; 206*1b1f1c77SAnubhab Ghosh } 207*1b1f1c77SAnubhab Ghosh 208*1b1f1c77SAnubhab Ghosh Error ExecutorSharedMemoryMapperService::release( 209*1b1f1c77SAnubhab Ghosh const std::vector<ExecutorAddr> &Bases) { 210*1b1f1c77SAnubhab Ghosh #if defined(LLVM_ON_UNIX) || defined(_WIN32) 211*1b1f1c77SAnubhab Ghosh Error Err = Error::success(); 212*1b1f1c77SAnubhab Ghosh 213*1b1f1c77SAnubhab Ghosh for (auto Base : Bases) { 214*1b1f1c77SAnubhab Ghosh std::vector<ExecutorAddr> AllocAddrs; 215*1b1f1c77SAnubhab Ghosh size_t Size; 216*1b1f1c77SAnubhab Ghosh 217*1b1f1c77SAnubhab Ghosh #if defined(_WIN32) 218*1b1f1c77SAnubhab Ghosh HANDLE SharedMemoryFile; 219*1b1f1c77SAnubhab Ghosh #endif 220*1b1f1c77SAnubhab Ghosh 221*1b1f1c77SAnubhab Ghosh { 222*1b1f1c77SAnubhab Ghosh std::lock_guard<std::mutex> Lock(Mutex); 223*1b1f1c77SAnubhab Ghosh auto &R = Reservations[Base.toPtr<void *>()]; 224*1b1f1c77SAnubhab Ghosh Size = R.Size; 225*1b1f1c77SAnubhab Ghosh 226*1b1f1c77SAnubhab Ghosh #if defined(_WIN32) 227*1b1f1c77SAnubhab Ghosh SharedMemoryFile = R.SharedMemoryFile; 228*1b1f1c77SAnubhab Ghosh #endif 229*1b1f1c77SAnubhab Ghosh 230*1b1f1c77SAnubhab Ghosh AllocAddrs.swap(R.Allocations); 231*1b1f1c77SAnubhab Ghosh } 232*1b1f1c77SAnubhab Ghosh 233*1b1f1c77SAnubhab Ghosh // deinitialize sub allocations 234*1b1f1c77SAnubhab Ghosh if (Error E = deinitialize(AllocAddrs)) 235*1b1f1c77SAnubhab Ghosh Err = joinErrors(std::move(Err), std::move(E)); 236*1b1f1c77SAnubhab Ghosh 237*1b1f1c77SAnubhab Ghosh #if defined(LLVM_ON_UNIX) 238*1b1f1c77SAnubhab Ghosh 239*1b1f1c77SAnubhab Ghosh if (munmap(Base.toPtr<void *>(), Size) != 0) 240*1b1f1c77SAnubhab Ghosh Err = joinErrors(std::move(Err), errorCodeToError(std::error_code( 241*1b1f1c77SAnubhab Ghosh errno, std::generic_category()))); 242*1b1f1c77SAnubhab Ghosh 243*1b1f1c77SAnubhab Ghosh #elif defined(_WIN32) 244*1b1f1c77SAnubhab Ghosh 245*1b1f1c77SAnubhab Ghosh if (!UnmapViewOfFile(Base.toPtr<void *>())) 246*1b1f1c77SAnubhab Ghosh Err = joinErrors(std::move(Err), 247*1b1f1c77SAnubhab Ghosh errorCodeToError(mapWindowsError(GetLastError()))); 248*1b1f1c77SAnubhab Ghosh 249*1b1f1c77SAnubhab Ghosh CloseHandle(SharedMemoryFile); 250*1b1f1c77SAnubhab Ghosh 251*1b1f1c77SAnubhab Ghosh #endif 252*1b1f1c77SAnubhab Ghosh 253*1b1f1c77SAnubhab Ghosh std::lock_guard<std::mutex> Lock(Mutex); 254*1b1f1c77SAnubhab Ghosh Reservations.erase(Base.toPtr<void *>()); 255*1b1f1c77SAnubhab Ghosh } 256*1b1f1c77SAnubhab Ghosh 257*1b1f1c77SAnubhab Ghosh return Err; 258*1b1f1c77SAnubhab Ghosh #else 259*1b1f1c77SAnubhab Ghosh return make_error<StringError>( 260*1b1f1c77SAnubhab Ghosh "SharedMemoryMapper is not supported on this platform yet", 261*1b1f1c77SAnubhab Ghosh inconvertibleErrorCode()); 262*1b1f1c77SAnubhab Ghosh #endif 263*1b1f1c77SAnubhab Ghosh } 264*1b1f1c77SAnubhab Ghosh 265*1b1f1c77SAnubhab Ghosh Error ExecutorSharedMemoryMapperService::shutdown() { 266*1b1f1c77SAnubhab Ghosh std::vector<ExecutorAddr> ReservationAddrs; 267*1b1f1c77SAnubhab Ghosh if (!Reservations.empty()) { 268*1b1f1c77SAnubhab Ghosh std::lock_guard<std::mutex> Lock(Mutex); 269*1b1f1c77SAnubhab Ghosh { 270*1b1f1c77SAnubhab Ghosh ReservationAddrs.reserve(Reservations.size()); 271*1b1f1c77SAnubhab Ghosh for (const auto &R : Reservations) { 272*1b1f1c77SAnubhab Ghosh ReservationAddrs.push_back(ExecutorAddr::fromPtr(R.getFirst())); 273*1b1f1c77SAnubhab Ghosh } 274*1b1f1c77SAnubhab Ghosh } 275*1b1f1c77SAnubhab Ghosh } 276*1b1f1c77SAnubhab Ghosh return release(ReservationAddrs); 277*1b1f1c77SAnubhab Ghosh 278*1b1f1c77SAnubhab Ghosh return Error::success(); 279*1b1f1c77SAnubhab Ghosh } 280*1b1f1c77SAnubhab Ghosh 281*1b1f1c77SAnubhab Ghosh void ExecutorSharedMemoryMapperService::addBootstrapSymbols( 282*1b1f1c77SAnubhab Ghosh StringMap<ExecutorAddr> &M) { 283*1b1f1c77SAnubhab Ghosh M[rt::ExecutorSharedMemoryMapperServiceInstanceName] = 284*1b1f1c77SAnubhab Ghosh ExecutorAddr::fromPtr(this); 285*1b1f1c77SAnubhab Ghosh M[rt::ExecutorSharedMemoryMapperServiceReserveWrapperName] = 286*1b1f1c77SAnubhab Ghosh ExecutorAddr::fromPtr(&reserveWrapper); 287*1b1f1c77SAnubhab Ghosh M[rt::ExecutorSharedMemoryMapperServiceInitializeWrapperName] = 288*1b1f1c77SAnubhab Ghosh ExecutorAddr::fromPtr(&initializeWrapper); 289*1b1f1c77SAnubhab Ghosh M[rt::ExecutorSharedMemoryMapperServiceDeinitializeWrapperName] = 290*1b1f1c77SAnubhab Ghosh ExecutorAddr::fromPtr(&deinitializeWrapper); 291*1b1f1c77SAnubhab Ghosh M[rt::ExecutorSharedMemoryMapperServiceReleaseWrapperName] = 292*1b1f1c77SAnubhab Ghosh ExecutorAddr::fromPtr(&releaseWrapper); 293*1b1f1c77SAnubhab Ghosh } 294*1b1f1c77SAnubhab Ghosh 295*1b1f1c77SAnubhab Ghosh llvm::orc::shared::CWrapperFunctionResult 296*1b1f1c77SAnubhab Ghosh ExecutorSharedMemoryMapperService::reserveWrapper(const char *ArgData, 297*1b1f1c77SAnubhab Ghosh size_t ArgSize) { 298*1b1f1c77SAnubhab Ghosh return shared::WrapperFunction< 299*1b1f1c77SAnubhab Ghosh rt::SPSExecutorSharedMemoryMapperServiceReserveSignature>:: 300*1b1f1c77SAnubhab Ghosh handle(ArgData, ArgSize, 301*1b1f1c77SAnubhab Ghosh shared::makeMethodWrapperHandler( 302*1b1f1c77SAnubhab Ghosh &ExecutorSharedMemoryMapperService::reserve)) 303*1b1f1c77SAnubhab Ghosh .release(); 304*1b1f1c77SAnubhab Ghosh } 305*1b1f1c77SAnubhab Ghosh 306*1b1f1c77SAnubhab Ghosh llvm::orc::shared::CWrapperFunctionResult 307*1b1f1c77SAnubhab Ghosh ExecutorSharedMemoryMapperService::initializeWrapper(const char *ArgData, 308*1b1f1c77SAnubhab Ghosh size_t ArgSize) { 309*1b1f1c77SAnubhab Ghosh return shared::WrapperFunction< 310*1b1f1c77SAnubhab Ghosh rt::SPSExecutorSharedMemoryMapperServiceInitializeSignature>:: 311*1b1f1c77SAnubhab Ghosh handle(ArgData, ArgSize, 312*1b1f1c77SAnubhab Ghosh shared::makeMethodWrapperHandler( 313*1b1f1c77SAnubhab Ghosh &ExecutorSharedMemoryMapperService::initialize)) 314*1b1f1c77SAnubhab Ghosh .release(); 315*1b1f1c77SAnubhab Ghosh } 316*1b1f1c77SAnubhab Ghosh 317*1b1f1c77SAnubhab Ghosh llvm::orc::shared::CWrapperFunctionResult 318*1b1f1c77SAnubhab Ghosh ExecutorSharedMemoryMapperService::deinitializeWrapper(const char *ArgData, 319*1b1f1c77SAnubhab Ghosh size_t ArgSize) { 320*1b1f1c77SAnubhab Ghosh return shared::WrapperFunction< 321*1b1f1c77SAnubhab Ghosh rt::SPSExecutorSharedMemoryMapperServiceDeinitializeSignature>:: 322*1b1f1c77SAnubhab Ghosh handle(ArgData, ArgSize, 323*1b1f1c77SAnubhab Ghosh shared::makeMethodWrapperHandler( 324*1b1f1c77SAnubhab Ghosh &ExecutorSharedMemoryMapperService::deinitialize)) 325*1b1f1c77SAnubhab Ghosh .release(); 326*1b1f1c77SAnubhab Ghosh } 327*1b1f1c77SAnubhab Ghosh 328*1b1f1c77SAnubhab Ghosh llvm::orc::shared::CWrapperFunctionResult 329*1b1f1c77SAnubhab Ghosh ExecutorSharedMemoryMapperService::releaseWrapper(const char *ArgData, 330*1b1f1c77SAnubhab Ghosh size_t ArgSize) { 331*1b1f1c77SAnubhab Ghosh return shared::WrapperFunction< 332*1b1f1c77SAnubhab Ghosh rt::SPSExecutorSharedMemoryMapperServiceReleaseSignature>:: 333*1b1f1c77SAnubhab Ghosh handle(ArgData, ArgSize, 334*1b1f1c77SAnubhab Ghosh shared::makeMethodWrapperHandler( 335*1b1f1c77SAnubhab Ghosh &ExecutorSharedMemoryMapperService::release)) 336*1b1f1c77SAnubhab Ghosh .release(); 337*1b1f1c77SAnubhab Ghosh } 338*1b1f1c77SAnubhab Ghosh 339*1b1f1c77SAnubhab Ghosh } // namespace rt_bootstrap 340*1b1f1c77SAnubhab Ghosh } // end namespace orc 341*1b1f1c77SAnubhab Ghosh } // end namespace llvm 342