class RuntimeDyld::MemoryManager

Declaration

class RuntimeDyld::MemoryManager { /* full declaration omitted */ };

Description

Memory Management.

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyld.h:92

Member Variables

private bool FinalizationLocked = false

Method Overview

Methods

MemoryManager()

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyld.h:96

virtual 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/RuntimeDyld.h:103

Parameters

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

virtual 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/RuntimeDyld.h:110

Parameters

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

virtual llvm::RuntimeDyld::MemoryManager::
    TLSSection
    allocateTLSSection(
        uintptr_t Size,
        unsigned int Alignment,
        unsigned int SectionID,
        llvm::StringRef SectionName)

Description

Allocate a memory block of (at least) the given size to be used for thread-local storage (TLS).

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyld.h:125

Parameters

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

virtual bool allowStubAllocation() const

Description

Override to return false to tell LLVM no stub space will be needed. This requires some guarantees depending on architecuture, but when you know what you are doing it saves allocated space.

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyld.h:149

virtual void anchor()

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyld.h:187

virtual void deregisterEHFrames()

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyld.h:159

virtual 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/RuntimeDyld.h:170

Parameters

std::string* ErrMsg = nullptr

virtual bool needsToReserveAllocationSpace()

Description

Override to return true to enable the reserveAllocationSpace callback.

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyld.h:144

virtual void notifyObjectLoaded(
    llvm::RuntimeDyld& RTDyld,
    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/RuntimeDyld.h:183

Parameters

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

virtual 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/RuntimeDyld.h:157

Parameters

uint8_t* Addr
uint64_t LoadAddr
size_t Size

virtual 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/RuntimeDyld.h:137

Parameters

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

virtual ~MemoryManager()

Declared at: llvm/include/llvm/ExecutionEngine/RuntimeDyld.h:97