//===- SimpleNativeMemoryMapSPSCI.cpp -------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // SPS Controller Interface implementation for SimpleNativeMemoryMap. // //===----------------------------------------------------------------------===// #include "orc-rt/sps-ci/SimpleNativeMemoryMapSPSCI.h" #include "orc-rt/SPSAllocAction.h" #include "orc-rt/SPSMemoryFlags.h" #include "orc-rt/SPSWrapperFunction.h" #include "orc-rt/SimpleNativeMemoryMap.h" namespace orc_rt { struct SPSSimpleNativeMemoryMapSegment; template <> class SPSSerializationTraits< SPSSimpleNativeMemoryMapSegment, SimpleNativeMemoryMap::InitializeRequest::Segment> { using SPSType = SPSTuple>; public: static bool deserialize(SPSInputBuffer &IB, SimpleNativeMemoryMap::InitializeRequest::Segment &S) { AllocGroup AG; ExecutorAddr Address; uint64_t Size; span Content; if (!SPSType::AsArgList::deserialize(IB, AG, Address, Size, Content)) return false; if (Size > std::numeric_limits::max()) return false; S = {AG, Address.toPtr(), static_cast(Size), Content}; return true; } }; struct SPSSimpleNativeMemoryMapInitializeRequest; template <> class SPSSerializationTraits { using SPSType = SPSTuple, SPSSequence>; public: static bool deserialize(SPSInputBuffer &IB, SimpleNativeMemoryMap::InitializeRequest &FR) { return SPSType::AsArgList::deserialize(IB, FR.Segments, FR.AAPs); } }; namespace sps_ci { ORC_RT_SPS_WRAPPER( orc_rt_sps_ci_SimpleNativeMemoryMap_reserve_sps_wrapper, SPSExpected(SPSExecutorAddr, SPSSize), WrapperFunction::handleWithAsyncMethod(&SimpleNativeMemoryMap::reserve)) ORC_RT_SPS_WRAPPER( orc_rt_sps_ci_SimpleNativeMemoryMap_releaseMultiple_sps_wrapper, SPSError(SPSExecutorAddr, SPSSequence), WrapperFunction::handleWithAsyncMethod( &SimpleNativeMemoryMap::releaseMultiple)) ORC_RT_SPS_WRAPPER( orc_rt_sps_ci_SimpleNativeMemoryMap_initialize_sps_wrapper, SPSExpected(SPSExecutorAddr, SPSSimpleNativeMemoryMapInitializeRequest), WrapperFunction::handleWithAsyncMethod(&SimpleNativeMemoryMap::initialize)) ORC_RT_SPS_WRAPPER( orc_rt_sps_ci_SimpleNativeMemoryMap_deinitializeMultiple_sps_wrapper, SPSError(SPSExecutorAddr, SPSSequence), WrapperFunction::handleWithAsyncMethod( &SimpleNativeMemoryMap::deinitializeMultiple)) static std::pair orc_rt_sps_ci_SimpleNativeMemoryMap_sps_interface[] = { ORC_RT_SYMTAB_PAIR( orc_rt_sps_ci_SimpleNativeMemoryMap_reserve_sps_wrapper), ORC_RT_SYMTAB_PAIR( orc_rt_sps_ci_SimpleNativeMemoryMap_releaseMultiple_sps_wrapper), ORC_RT_SYMTAB_PAIR( orc_rt_sps_ci_SimpleNativeMemoryMap_initialize_sps_wrapper), ORC_RT_SYMTAB_PAIR( orc_rt_sps_ci_SimpleNativeMemoryMap_deinitializeMultiple_sps_wrapper)}; Error addSimpleNativeMemoryMap(SimpleSymbolTable &ST) { return ST.addUnique(orc_rt_sps_ci_SimpleNativeMemoryMap_sps_interface); } } // namespace sps_ci } // namespace orc_rt