19#ifndef LLVM_EXECUTIONENGINE_BACKPORT_SECTIONMEMORYMANAGER_H
20#define LLVM_EXECUTIONENGINE_BACKPORT_SECTIONMEMORYMANAGER_H
22#include "llvm/ADT/SmallVector.h"
23#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
24#include "llvm/Support/Alignment.h"
25#include "llvm/Support/Memory.h"
28#include <system_error>
79 virtual sys::MemoryBlock
81 const sys::MemoryBlock *
const NearBlock,
82 unsigned Flags, std::error_code &EC) = 0;
128#if LLVM_VERSION_MAJOR < 16
130 uintptr_t RODataSize,
131 uint32_t RODataAlign,
132 uintptr_t RWDataSize,
133 uint32_t RWDataAlign)
override;
136 uintptr_t RODataSize, Align RODataAlign,
137 uintptr_t RWDataSize, Align RWDataAlign)
override;
147 StringRef SectionName)
override;
155 unsigned SectionID, StringRef SectionName,
156 bool IsReadOnly)
override;
209 unsigned Permissions);
virtual std::error_code releaseMappedMemory(sys::MemoryBlock &M)=0
virtual sys::MemoryBlock allocateMappedMemory(AllocationPurpose Purpose, size_t NumBytes, const sys::MemoryBlock *const NearBlock, unsigned Flags, std::error_code &EC)=0
virtual std::error_code protectMappedMemory(const sys::MemoryBlock &Block, unsigned Flags)=0
std::unique_ptr< MemoryMapper > OwnedMMapper
SectionMemoryManager(const SectionMemoryManager &)=delete
SectionMemoryManager(MemoryMapper *MM=nullptr, bool ReserveAlloc=false)
virtual void invalidateInstructionCache()
~SectionMemoryManager() override
void operator=(const SectionMemoryManager &)=delete
virtual void reserveAllocationSpace(uintptr_t CodeSize, uint32_t CodeAlign, uintptr_t RODataSize, uint32_t RODataAlign, uintptr_t RWDataSize, uint32_t RWDataAlign) override
bool finalizeMemory(std::string *ErrMsg=nullptr) override
uint8_t * allocateSection(AllocationPurpose Purpose, uintptr_t Size, unsigned Alignment)
bool hasSpace(const MemoryGroup &MemGroup, uintptr_t Size) const
uint8_t * allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName, bool IsReadOnly) override
bool needsToReserveAllocationSpace() override
Enable reserveAllocationSpace when requested.
std::error_code applyMemoryGroupPermissions(MemoryGroup &MemGroup, unsigned Permissions)
uint8_t * allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName) override
unsigned PendingPrefixIndex
SmallVector< sys::MemoryBlock, 16 > AllocatedMem
SmallVector< sys::MemoryBlock, 16 > PendingMem
SmallVector< FreeMemBlock, 16 > FreeMem