LLVM  6.0.0svn
Classes | Public Member Functions | Friends | List of all members
llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager Class Reference

Remote-mapped RuntimeDyld-compatible memory manager. More...

#include "llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h"

Inheritance diagram for llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager:
Inheritance graph
[legend]
Collaboration diagram for llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager:
Collaboration graph
[legend]

Public Member Functions

 ~RemoteRTDyldMemoryManager ()
 
 RemoteRTDyldMemoryManager (const RemoteRTDyldMemoryManager &)=delete
 
RemoteRTDyldMemoryManageroperator= (const RemoteRTDyldMemoryManager &)=delete
 
 RemoteRTDyldMemoryManager (RemoteRTDyldMemoryManager &&)=default
 
RemoteRTDyldMemoryManageroperator= (RemoteRTDyldMemoryManager &&)=default
 
uint8_t * allocateCodeSection (uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName) override
 Allocate a memory block of (at least) the given size suitable for executable code. More...
 
uint8_t * allocateDataSection (uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName, bool IsReadOnly) override
 Allocate a memory block of (at least) the given size suitable for data. More...
 
void reserveAllocationSpace (uintptr_t CodeSize, uint32_t CodeAlign, uintptr_t RODataSize, uint32_t RODataAlign, uintptr_t RWDataSize, uint32_t RWDataAlign) override
 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. More...
 
bool needsToReserveAllocationSpace () override
 Override to return true to enable the reserveAllocationSpace callback. More...
 
void registerEHFrames (uint8_t *Addr, uint64_t LoadAddr, size_t Size) override
 Register the EH frames with the runtime so that c++ exceptions work. More...
 
void deregisterEHFrames () override
 
void notifyObjectLoaded (RuntimeDyld &Dyld, const object::ObjectFile &Obj) override
 This method is called after an object has been loaded into memory but before relocations are applied to the loaded sections. More...
 
bool finalizeMemory (std::string *ErrMsg=nullptr) override
 This method is called when object loading is complete and section page permissions can be applied. More...
 
- Public Member Functions inherited from llvm::RuntimeDyld::MemoryManager
 MemoryManager ()=default
 
virtual ~MemoryManager ()=default
 

Friends

class OrcRemoteTargetClient
 

Detailed Description

Remote-mapped RuntimeDyld-compatible memory manager.

Definition at line 60 of file OrcRemoteTargetClient.h.

Constructor & Destructor Documentation

◆ ~RemoteRTDyldMemoryManager()

llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager::~RemoteRTDyldMemoryManager ( )
inline

Definition at line 64 of file OrcRemoteTargetClient.h.

References llvm::dbgs(), DEBUG, operator=(), and RemoteRTDyldMemoryManager().

◆ RemoteRTDyldMemoryManager() [1/2]

llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager::RemoteRTDyldMemoryManager ( const RemoteRTDyldMemoryManager )
delete

◆ RemoteRTDyldMemoryManager() [2/2]

llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager::RemoteRTDyldMemoryManager ( RemoteRTDyldMemoryManager &&  )
default

Member Function Documentation

◆ allocateCodeSection()

uint8_t* llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager::allocateCodeSection ( uintptr_t  Size,
unsigned  Alignment,
unsigned  SectionID,
StringRef  SectionName 
)
inlineoverridevirtual

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.

Implements llvm::RuntimeDyld::MemoryManager.

Definition at line 76 of file OrcRemoteTargetClient.h.

◆ allocateDataSection()

uint8_t* llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager::allocateDataSection ( uintptr_t  Size,
unsigned  Alignment,
unsigned  SectionID,
StringRef  SectionName,
bool  IsReadOnly 
)
inlineoverridevirtual

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::RuntimeDyld::MemoryManager.

Definition at line 88 of file OrcRemoteTargetClient.h.

◆ deregisterEHFrames()

void llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager::deregisterEHFrames ( )
inlineoverridevirtual

◆ finalizeMemory()

bool llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager::finalizeMemory ( std::string *  ErrMsg = nullptr)
inlineoverridevirtual

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::RuntimeDyld::MemoryManager.

Definition at line 178 of file OrcRemoteTargetClient.h.

References llvm::dbgs(), DEBUG, llvm::handleAllErrors(), llvm::ErrorInfoBase::log(), llvm::sys::Memory::MF_EXEC, llvm::sys::Memory::MF_READ, and llvm::sys::Memory::MF_WRITE.

◆ needsToReserveAllocationSpace()

bool llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager::needsToReserveAllocationSpace ( )
inlineoverridevirtual

Override to return true to enable the reserveAllocationSpace callback.

Reimplemented from llvm::RuntimeDyld::MemoryManager.

Definition at line 149 of file OrcRemoteTargetClient.h.

◆ notifyObjectLoaded()

void llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager::notifyObjectLoaded ( RuntimeDyld RTDyld,
const object::ObjectFile Obj 
)
inlineoverridevirtual

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.

Reimplemented from llvm::RuntimeDyld::MemoryManager.

Definition at line 163 of file OrcRemoteTargetClient.h.

References llvm::dbgs(), and DEBUG.

◆ operator=() [1/2]

RemoteRTDyldMemoryManager& llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager::operator= ( const RemoteRTDyldMemoryManager )
delete

◆ operator=() [2/2]

RemoteRTDyldMemoryManager& llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager::operator= ( RemoteRTDyldMemoryManager &&  )
default

◆ registerEHFrames()

void llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager::registerEHFrames ( uint8_t *  Addr,
uint64_t  LoadAddr,
size_t  Size 
)
inlineoverridevirtual

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.

Implements llvm::RuntimeDyld::MemoryManager.

Definition at line 151 of file OrcRemoteTargetClient.h.

Referenced by llvm::orc::remote::OrcRemoteTargetClient::terminateSession().

◆ reserveAllocationSpace()

void llvm::orc::remote::OrcRemoteTargetClient::RemoteRTDyldMemoryManager::reserveAllocationSpace ( uintptr_t  CodeSize,
uint32_t  CodeAlign,
uintptr_t  RODataSize,
uint32_t  RODataAlign,
uintptr_t  RWDataSize,
uint32_t  RWDataAlign 
)
inlineoverridevirtual

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::RuntimeDyld::MemoryManager.

Definition at line 110 of file OrcRemoteTargetClient.h.

References llvm::dbgs(), DEBUG, and llvm::format().

Friends And Related Function Documentation

◆ OrcRemoteTargetClient

friend class OrcRemoteTargetClient
friend

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