LLVM API Documentation

Public Member Functions
llvm::LinkingMemoryManager Class Reference

#include <MCJIT.h>

Inheritance diagram for llvm::LinkingMemoryManager:
Inheritance graph
[legend]
Collaboration diagram for llvm::LinkingMemoryManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LinkingMemoryManager (MCJIT *Parent, RTDyldMemoryManager *MM)
uint64_t getSymbolAddress (const std::string &Name) override
uint8_t * allocateCodeSection (uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName) override
uint8_t * allocateDataSection (uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName, bool IsReadOnly) override
void reserveAllocationSpace (uintptr_t CodeSize, uintptr_t DataSizeRO, uintptr_t DataSizeRW) override
bool needsToReserveAllocationSpace () override
 Override to return true to enable the reserveAllocationSpace callback.
void notifyObjectLoaded (ExecutionEngine *EE, const ObjectImage *Obj) override
void registerEHFrames (uint8_t *Addr, uint64_t LoadAddr, size_t Size) override
void deregisterEHFrames (uint8_t *Addr, uint64_t LoadAddr, size_t Size) override
bool finalizeMemory (std::string *ErrMsg=nullptr) override

Detailed Description

Definition at line 29 of file lib/ExecutionEngine/MCJIT/MCJIT.h.


Constructor & Destructor Documentation

Definition at line 31 of file lib/ExecutionEngine/MCJIT/MCJIT.h.


Member Function Documentation

uint8_t* llvm::LinkingMemoryManager::allocateCodeSection ( uintptr_t  Size,
unsigned  Alignment,
unsigned  SectionID,
StringRef  SectionName 
) [inline, override, virtual]

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

Implements llvm::RTDyldMemoryManager.

Definition at line 37 of file lib/ExecutionEngine/MCJIT/MCJIT.h.

uint8_t* llvm::LinkingMemoryManager::allocateDataSection ( uintptr_t  Size,
unsigned  Alignment,
unsigned  SectionID,
StringRef  SectionName,
bool  IsReadOnly 
) [inline, override, virtual]

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.

Implements llvm::RTDyldMemoryManager.

Definition at line 43 of file lib/ExecutionEngine/MCJIT/MCJIT.h.

void llvm::LinkingMemoryManager::deregisterEHFrames ( uint8_t *  Addr,
uint64_t  LoadAddr,
size_t  Size 
) [inline, override, virtual]

Reimplemented from llvm::RTDyldMemoryManager.

Definition at line 69 of file lib/ExecutionEngine/MCJIT/MCJIT.h.

bool llvm::LinkingMemoryManager::finalizeMemory ( std::string *  ErrMsg = nullptr) [inline, override, virtual]

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.

Implements llvm::RTDyldMemoryManager.

Definition at line 74 of file lib/ExecutionEngine/MCJIT/MCJIT.h.

Referenced by llvm::MCJIT::finalizeLoadedModules().

uint64_t LinkingMemoryManager::getSymbolAddress ( const std::string &  Name) [override, virtual]

This method returns the address of the specified function or variable. It is used to resolve symbols during module linking.

Reimplemented from llvm::RTDyldMemoryManager.

Definition at line 568 of file MCJIT.cpp.

References llvm::MCJIT::getSymbolAddress(), and llvm::ExecutionEngine::isSymbolSearchingDisabled().

Override to return true to enable the reserveAllocationSpace callback.

Reimplemented from llvm::RTDyldMemoryManager.

Definition at line 55 of file lib/ExecutionEngine/MCJIT/MCJIT.h.

void llvm::LinkingMemoryManager::notifyObjectLoaded ( ExecutionEngine EE,
const ObjectImage  
) [inline, override, virtual]

This method is called after an object has been loaded into memory but before relocations are applied to the loaded sections. The object load may have been initiated by MCJIT to resolve an external symbol for another object that is being finalized. In that case, the object about which the memory manager is being notified will be finalized immediately after the memory manager returns from this call.

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.

Reimplemented from llvm::RTDyldMemoryManager.

Definition at line 59 of file lib/ExecutionEngine/MCJIT/MCJIT.h.

Referenced by llvm::MCJIT::NotifyObjectEmitted().

void llvm::LinkingMemoryManager::registerEHFrames ( uint8_t *  Addr,
uint64_t  LoadAddr,
size_t  Size 
) [inline, override, virtual]

Register the EH frames with the runtime so that c++ exceptions work.

Addr parameter provides the local address of the EH frame section data, while 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.

Reimplemented from llvm::RTDyldMemoryManager.

Definition at line 64 of file lib/ExecutionEngine/MCJIT/MCJIT.h.

void llvm::LinkingMemoryManager::reserveAllocationSpace ( uintptr_t  CodeSize,
uintptr_t  DataSizeRO,
uintptr_t  DataSizeRW 
) [inline, override, virtual]

Inform the memory manager about the total amount of memory required to allocate all sections to be loaded: CodeSize - the total size of all code sections DataSizeRO - the total size of all read-only data sections 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.

Reimplemented from llvm::RTDyldMemoryManager.

Definition at line 50 of file lib/ExecutionEngine/MCJIT/MCJIT.h.


The documentation for this class was generated from the following files: