class SectionMemoryManager
Declaration
class SectionMemoryManager : public RTDyldMemoryManager { /* full declaration omitted */ };
Description
This is a simple memory manager which implements the methods called by the RuntimeDyld class to allocate memory for section-based loading of objects, usually those generated by the MCJIT execution engine. This memory manager allocates all section memory as read-write. The RuntimeDyld will copy JITed section memory into these allocated blocks and perform any necessary linking and relocations. Any client using this memory manager MUST ensure that section-specific page permissions have been applied before attempting to execute functions in the JITed object. Permissions can be applied either by calling MCJIT::finalizeObject or by calling SectionMemoryManager::finalizeMemory directly. Clients of MCJIT should call MCJIT::finalizeObject.
Declared at: llvm/include/llvm/ExecutionEngine/SectionMemoryManager.h:39
Inherits from: RTDyldMemoryManager
Member Variables
- private llvm::SectionMemoryManager::MemoryGroup CodeMem
- private llvm::SectionMemoryManager::MemoryGroup RWDataMem
- private llvm::SectionMemoryManager::MemoryGroup RODataMem
- private llvm::SectionMemoryManager::MemoryMapper& MMapper
Inherited from RTDyldMemoryManager:
Method Overview
- public SectionMemoryManager(llvm::SectionMemoryManager::MemoryMapper * MM = nullptr)
- public SectionMemoryManager(const llvm::SectionMemoryManager &)
- public uint8_t * allocateCodeSection(uintptr_t Size, unsigned int Alignment, unsigned int SectionID, llvm::StringRef SectionName)
- public uint8_t * allocateDataSection(uintptr_t Size, unsigned int Alignment, unsigned int SectionID, llvm::StringRef SectionName, bool isReadOnly)
- private uint8_t * allocateSection(llvm::SectionMemoryManager::AllocationPurpose Purpose, uintptr_t Size, unsigned int Alignment)
- private void anchor()
- private std::error_code applyMemoryGroupPermissions(llvm::SectionMemoryManager::MemoryGroup & MemGroup, unsigned int Permissions)
- public bool finalizeMemory(std::string * ErrMsg = nullptr)
- public virtual void invalidateInstructionCache()
- public ~SectionMemoryManager()
Inherited from RTDyldMemoryManager:
- public deregisterEHFrames
- public deregisterEHFramesInProcess
- public findSymbol
- public findSymbolInLogicalDylib
- public getPointerToNamedFunction
- public getSymbolAddress
- public getSymbolAddressInLogicalDylib
- public getSymbolAddressInProcess
- public registerEHFrames
- public registerEHFramesInProcess
Inherited from LegacyJITSymbolResolver:
Inherited from JITSymbolResolver:
Inherited from MCJITMemoryManager:
Inherited from RuntimeDyld::MemoryManager:
- public allocateCodeSection
- public allocateDataSection
- public allocateTLSSection
- public allowStubAllocation
- public deregisterEHFrames
- public finalizeMemory
- public needsToReserveAllocationSpace
- public notifyObjectLoaded
- public registerEHFrames
- public reserveAllocationSpace
Methods
¶SectionMemoryManager(
llvm::SectionMemoryManager::MemoryMapper* MM =
nullptr)
SectionMemoryManager(
llvm::SectionMemoryManager::MemoryMapper* MM =
nullptr)
Description
Creates a SectionMemoryManager instance with \p MM as the associated memory mapper. If \p MM is nullptr then a default memory mapper is used that directly calls into the operating system.
Declared at: llvm/include/llvm/ExecutionEngine/SectionMemoryManager.h:107
Parameters
- llvm::SectionMemoryManager::MemoryMapper* MM = nullptr
¶SectionMemoryManager(
const llvm::SectionMemoryManager&)
SectionMemoryManager(
const llvm::SectionMemoryManager&)
Declared at: llvm/include/llvm/ExecutionEngine/SectionMemoryManager.h:108
Parameters
- const llvm::SectionMemoryManager&
¶uint8_t* allocateCodeSection(
uintptr_t Size,
unsigned int Alignment,
unsigned int SectionID,
llvm::StringRef SectionName)
uint8_t* allocateCodeSection(
uintptr_t Size,
unsigned int Alignment,
unsigned int SectionID,
llvm::StringRef SectionName)
Description
Allocates a memory block of (at least) the given size suitable for executable code. The value of \p Alignment must be a power of two. If \p Alignment is zero a default alignment of 16 will be used.
Declared at: llvm/include/llvm/ExecutionEngine/SectionMemoryManager.h:117
Parameters
- uintptr_t Size
- unsigned int Alignment
- unsigned int SectionID
- llvm::StringRef SectionName
¶uint8_t* allocateDataSection(
uintptr_t Size,
unsigned int Alignment,
unsigned int SectionID,
llvm::StringRef SectionName,
bool isReadOnly)
uint8_t* allocateDataSection(
uintptr_t Size,
unsigned int Alignment,
unsigned int SectionID,
llvm::StringRef SectionName,
bool isReadOnly)
Description
Allocates a memory block of (at least) the given size suitable for executable code. The value of \p Alignment must be a power of two. If \p Alignment is zero a default alignment of 16 will be used.
Declared at: llvm/include/llvm/ExecutionEngine/SectionMemoryManager.h:126
Parameters
- uintptr_t Size
- unsigned int Alignment
- unsigned int SectionID
- llvm::StringRef SectionName
- bool isReadOnly
¶uint8_t* allocateSection(
llvm::SectionMemoryManager::AllocationPurpose
Purpose,
uintptr_t Size,
unsigned int Alignment)
uint8_t* allocateSection(
llvm::SectionMemoryManager::AllocationPurpose
Purpose,
uintptr_t Size,
unsigned int Alignment)
Declared at: llvm/include/llvm/ExecutionEngine/SectionMemoryManager.h:177
Parameters
- llvm::SectionMemoryManager::AllocationPurpose Purpose
- uintptr_t Size
- unsigned int Alignment
¶void anchor()
void anchor()
Declared at: llvm/include/llvm/ExecutionEngine/SectionMemoryManager.h:183
¶std::error_code applyMemoryGroupPermissions(
llvm::SectionMemoryManager::MemoryGroup&
MemGroup,
unsigned int Permissions)
std::error_code applyMemoryGroupPermissions(
llvm::SectionMemoryManager::MemoryGroup&
MemGroup,
unsigned int Permissions)
Declared at: llvm/include/llvm/ExecutionEngine/SectionMemoryManager.h:180
Parameters
- llvm::SectionMemoryManager::MemoryGroup& MemGroup
- unsigned int Permissions
¶bool finalizeMemory(std::string* ErrMsg = nullptr)
bool finalizeMemory(std::string* ErrMsg = nullptr)
Description
Update section-specific memory permissions and other attributes. This method is called when object loading is complete and section page permissions can be applied. It is up to the memory manager implementation to decide whether or not to act on this method. The memory manager will typically allocate all sections as read-write and then apply specific permissions when this method is called. Code sections cannot be executed until this function has been called. In addition, any cache coherency operations needed to reliably use the memory are also performed.
Declared at: llvm/include/llvm/ExecutionEngine/SectionMemoryManager.h:141
Parameters
- std::string* ErrMsg = nullptr
Returns
true if an error occurred, false otherwise.
¶virtual void invalidateInstructionCache()
virtual void invalidateInstructionCache()
Description
Invalidate instruction cache for code sections. Some platforms with separate data cache and instruction cache require explicit cache flush, otherwise JIT code manipulations (like resolved relocations) will get to the data cache but not to the instruction cache. This method is called from finalizeMemory.
Declared at: llvm/include/llvm/ExecutionEngine/SectionMemoryManager.h:150
¶~SectionMemoryManager()
~SectionMemoryManager()
Declared at: llvm/include/llvm/ExecutionEngine/SectionMemoryManager.h:110