class EPCGenericRTDyldMemoryManager

Declaration

class EPCGenericRTDyldMemoryManager : public MemoryManager { /* full declaration omitted */ };

Description

Remote-mapped RuntimeDyld-compatible memory manager.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:26

Inherits from: RuntimeDyld::MemoryManager

Member Variables

private llvm::orc::ExecutorProcessControl& EPC
private llvm::orc::EPCGenericRTDyldMemoryManager:: SymbolAddrs SAs
private std::mutex M
private std::vector<AllocGroup> Unmapped
private std::vector<AllocGroup> Unfinalized
private std::vector<ExecutorAddr> FinalizedAllocs
private std::string ErrMsg

Method Overview

Inherited from RuntimeDyld::MemoryManager:

Methods

static Expected<std::unique_ptr<
    EPCGenericRTDyldMemoryManager>>
CreateWithDefaultBootstrapSymbols(
    llvm::orc::ExecutorProcessControl& EPC)

Description

Create an EPCGenericRTDyldMemoryManager using the given EPC, looking up the default symbol names in the bootstrap symbol set.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:41

Parameters

llvm::orc::ExecutorProcessControl& EPC

EPCGenericRTDyldMemoryManager(
    llvm::orc::ExecutorProcessControl& EPC,
    llvm::orc::EPCGenericRTDyldMemoryManager::
        SymbolAddrs SAs)

Description

Create an EPCGenericRTDyldMemoryManager using the given EPC and symbol addrs.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:45

Parameters

llvm::orc::ExecutorProcessControl& EPC
llvm::orc::EPCGenericRTDyldMemoryManager:: SymbolAddrs SAs

EPCGenericRTDyldMemoryManager(
    const llvm::orc::
        EPCGenericRTDyldMemoryManager&)

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:47

Parameters

const llvm::orc::EPCGenericRTDyldMemoryManager&

EPCGenericRTDyldMemoryManager(
    llvm::orc::EPCGenericRTDyldMemoryManager&&)

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:50

Parameters

llvm::orc::EPCGenericRTDyldMemoryManager&&

uint8_t* allocateCodeSection(
    uintptr_t Size,
    unsigned int Alignment,
    unsigned int SectionID,
    llvm::StringRef SectionName)

Description

Allocate a memory block of (at least) the given size suitable for executable code. The SectionID is a unique identifier assigned by the RuntimeDyld instance, and optionally recorded by the memory manager to access a loaded section.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:55

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)

Description

Allocate a memory block of (at least) the given size suitable for data. The SectionID is a unique identifier assigned by the JIT engine, and optionally recorded by the memory manager to access a loaded section.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:59

Parameters

uintptr_t Size
unsigned int Alignment
unsigned int SectionID
llvm::StringRef SectionName
bool IsReadOnly

void deregisterEHFrames()

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:72

bool finalizeMemory(std::string* ErrMsg = nullptr)

Description

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. Returns true if an error occurred, false otherwise.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:77

Parameters

std::string* ErrMsg = nullptr

void mapAllocsToRemoteAddrs(
    llvm::RuntimeDyld& Dyld,
    std::vector<Alloc>& Allocs,
    llvm::orc::ExecutorAddr NextAddr)

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:110

Parameters

llvm::RuntimeDyld& Dyld
std::vector<Alloc>& Allocs
llvm::orc::ExecutorAddr NextAddr

bool needsToReserveAllocationSpace()

Description

Override to return true to enable the reserveAllocationSpace callback.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:68

void notifyObjectLoaded(
    llvm::RuntimeDyld& Dyld,
    const object::ObjectFile& Obj)

Description

This method is called after an object has been loaded into memory but before relocations are applied to the loaded sections. Memory managers which are preparing code for execution in an external address space can use this call to remap the section addresses for the newly loaded object. For clients that do not need access to an ExecutionEngine instance this method should be preferred to its cousin MCJITMemoryManager::notifyObjectLoaded as this method is compatible with ORC JIT stacks.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:74

Parameters

llvm::RuntimeDyld& Dyld
const object::ObjectFile& Obj

void registerEHFrames(uint8_t* Addr,
                      uint64_t LoadAddr,
                      size_t Size)

Description

Register the EH frames with the runtime so that c++ exceptions work. \p Addr parameter provides the local address of the EH frame section data, while \p LoadAddr provides the address of the data in the target address space. If the section has not been remapped (which will usually be the case for local execution) these two values will be the same.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:70

Parameters

uint8_t* Addr
uint64_t LoadAddr
size_t Size

void reserveAllocationSpace(uintptr_t CodeSize,
                            uint32_t CodeAlign,
                            uintptr_t RODataSize,
                            uint32_t RODataAlign,
                            uintptr_t RWDataSize,
                            uint32_t RWDataAlign)

Description

Inform the memory manager about the total amount of memory required to allocate all sections to be loaded:\p CodeSize - the total size of all code sections\p DataSizeRO - the total size of all read-only data sections\p DataSizeRW - the total size of all read-write data sections Note that by default the callback is disabled. To enable it redefine the method needsToReserveAllocationSpace to return true.

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:63

Parameters

uintptr_t CodeSize
uint32_t CodeAlign
uintptr_t RODataSize
uint32_t RODataAlign
uintptr_t RWDataSize
uint32_t RWDataAlign

~EPCGenericRTDyldMemoryManager()

Declared at: llvm/include/llvm/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.h:53