LLVM  16.0.0git
Classes | Public Member Functions | Static Public Member Functions | List of all members
llvm::orc::InProcessMemoryMapper Class Reference

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

Inheritance diagram for llvm::orc::InProcessMemoryMapper:
Inheritance graph
[legend]
Collaboration diagram for llvm::orc::InProcessMemoryMapper:
Collaboration graph
[legend]

Public Member Functions

 InProcessMemoryMapper (size_t PageSize)
 
unsigned int getPageSize () override
 
void reserve (size_t NumBytes, OnReservedFunction OnReserved) override
 Reserves address space in executor process. More...
 
void initialize (AllocInfo &AI, OnInitializedFunction OnInitialized) override
 Ensures executor memory is synchronized with working copy memory, sends functions to be called after initilization and before deinitialization and applies memory protections Returns a unique address identifying the allocation. More...
 
char * prepare (ExecutorAddr Addr, size_t ContentSize) override
 Provides working memory. More...
 
void deinitialize (ArrayRef< ExecutorAddr > Allocations, OnDeinitializedFunction OnDeInitialized) override
 Runs previously specified deinitialization actions Executor addresses returned by initialize should be passed. More...
 
void release (ArrayRef< ExecutorAddr > Reservations, OnReleasedFunction OnRelease) override
 Release address space acquired through reserve() More...
 
 ~InProcessMemoryMapper () override
 
- Public Member Functions inherited from llvm::orc::MemoryMapper
virtual ~MemoryMapper ()
 

Static Public Member Functions

static Expected< std::unique_ptr< InProcessMemoryMapper > > Create ()
 

Additional Inherited Members

- Public Types inherited from llvm::orc::MemoryMapper
using OnReservedFunction = unique_function< void(Expected< ExecutorAddrRange >)>
 
using OnInitializedFunction = unique_function< void(Expected< ExecutorAddr >)>
 
using OnDeinitializedFunction = unique_function< void(Error)>
 
using OnReleasedFunction = unique_function< void(Error)>
 

Detailed Description

Definition at line 81 of file MemoryMapper.h.

Constructor & Destructor Documentation

◆ InProcessMemoryMapper()

llvm::orc::InProcessMemoryMapper::InProcessMemoryMapper ( size_t  PageSize)

Definition at line 29 of file MemoryMapper.cpp.

◆ ~InProcessMemoryMapper()

llvm::orc::InProcessMemoryMapper::~InProcessMemoryMapper ( )
override

Member Function Documentation

◆ Create()

Expected< std::unique_ptr< InProcessMemoryMapper > > llvm::orc::InProcessMemoryMapper::Create ( )
static

Definition at line 33 of file MemoryMapper.cpp.

References llvm::sys::Process::getPageSize().

◆ deinitialize()

void llvm::orc::InProcessMemoryMapper::deinitialize ( ArrayRef< ExecutorAddr Allocations,
OnDeinitializedFunction  OnDeInitialized 
)
overridevirtual

Runs previously specified deinitialization actions Executor addresses returned by initialize should be passed.

Implements llvm::orc::MemoryMapper.

Definition at line 105 of file MemoryMapper.cpp.

References llvm::sampleprof::Base, llvm::reverse(), and llvm::Error::success().

◆ getPageSize()

unsigned int llvm::orc::InProcessMemoryMapper::getPageSize ( )
inlineoverridevirtual

Implements llvm::orc::MemoryMapper.

Definition at line 87 of file MemoryMapper.h.

◆ initialize()

void llvm::orc::InProcessMemoryMapper::initialize ( AllocInfo AI,
OnInitializedFunction  OnInitialized 
)
overridevirtual

Ensures executor memory is synchronized with working copy memory, sends functions to be called after initilization and before deinitialization and applies memory protections Returns a unique address identifying the allocation.

This address should be passed to deinitialize to run deallocation actions (and reset permissions where possible).

Implements llvm::orc::MemoryMapper.

Definition at line 62 of file MemoryMapper.cpp.

References llvm::orc::MemoryMapper::AllocInfo::Actions, llvm::sampleprof::Base, llvm::errorCodeToError(), llvm::sys::Memory::InvalidateInstructionCache(), llvm::orc::MemoryMapper::AllocInfo::MappingBase, llvm::sys::Memory::MF_EXEC, move, llvm::sys::Memory::protectMappedMemory(), llvm::orc::shared::runFinalizeActions(), llvm::orc::MemoryMapper::AllocInfo::Segments, and llvm::orc::ExecutorAddr::toPtr().

◆ prepare()

char * llvm::orc::InProcessMemoryMapper::prepare ( ExecutorAddr  Addr,
size_t  ContentSize 
)
overridevirtual

Provides working memory.

Implements llvm::orc::MemoryMapper.

Definition at line 58 of file MemoryMapper.cpp.

References Addr.

◆ release()

void llvm::orc::InProcessMemoryMapper::release ( ArrayRef< ExecutorAddr Reservations,
OnReleasedFunction  OnRelease 
)
overridevirtual

Release address space acquired through reserve()

Implements llvm::orc::MemoryMapper.

Definition at line 135 of file MemoryMapper.cpp.

Referenced by ~InProcessMemoryMapper().

◆ reserve()

void llvm::orc::InProcessMemoryMapper::reserve ( size_t  NumBytes,
OnReservedFunction  OnReserved 
)
overridevirtual

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