LLVM 20.0.0git
|
#include "llvm/ExecutionEngine/Orc/MemoryMapper.h"
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. | |
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. | |
char * | prepare (ExecutorAddr Addr, size_t ContentSize) override |
Provides working memory. | |
void | deinitialize (ArrayRef< ExecutorAddr > Allocations, OnDeinitializedFunction OnDeInitialized) override |
Runs previously specified deinitialization actions Executor addresses returned by initialize should be passed. | |
void | release (ArrayRef< ExecutorAddr > Reservations, OnReleasedFunction OnRelease) override |
Release address space acquired through reserve() | |
~InProcessMemoryMapper () override | |
Public Member Functions inherited from llvm::orc::MemoryMapper | |
virtual unsigned int | getPageSize ()=0 |
virtual void | reserve (size_t NumBytes, OnReservedFunction OnReserved)=0 |
Reserves address space in executor process. | |
virtual char * | prepare (ExecutorAddr Addr, size_t ContentSize)=0 |
Provides working memory. | |
virtual void | initialize (AllocInfo &AI, OnInitializedFunction OnInitialized)=0 |
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. | |
virtual void | deinitialize (ArrayRef< ExecutorAddr > Allocations, OnDeinitializedFunction OnDeInitialized)=0 |
Runs previously specified deinitialization actions Executor addresses returned by initialize should be passed. | |
virtual void | release (ArrayRef< ExecutorAddr > Reservations, OnReleasedFunction OnRelease)=0 |
Release address space acquired through reserve() | |
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)> |
Definition at line 82 of file MemoryMapper.h.
llvm::orc::InProcessMemoryMapper::InProcessMemoryMapper | ( | size_t | PageSize | ) |
Definition at line 32 of file MemoryMapper.cpp.
|
override |
Definition at line 177 of file MemoryMapper.cpp.
References llvm::cantFail(), F, llvm::orc::ExecutorAddr::fromPtr(), P, llvm::release, and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size().
|
static |
Definition at line 36 of file MemoryMapper.cpp.
References llvm::sys::Process::getPageSize().
|
overridevirtual |
Runs previously specified deinitialization actions Executor addresses returned by initialize should be passed.
Implements llvm::orc::MemoryMapper.
Definition at line 110 of file MemoryMapper.cpp.
References llvm::sampleprof::Base, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::erase(), llvm::errorCodeToError(), llvm::joinErrors(), llvm::sys::Memory::MF_READ, llvm::sys::Memory::MF_WRITE, llvm::sys::Memory::protectMappedMemory(), llvm::reverse(), llvm::orc::shared::runDeallocActions(), Size, and llvm::Error::success().
Referenced by release().
|
inlineoverridevirtual |
Implements llvm::orc::MemoryMapper.
Definition at line 88 of file MemoryMapper.h.
|
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 65 of file MemoryMapper.cpp.
References llvm::orc::MemoryMapper::AllocInfo::Actions, llvm::sampleprof::Base, llvm::errorCodeToError(), llvm::orc::Exec, llvm::sys::Memory::InvalidateInstructionCache(), llvm::orc::MemoryMapper::AllocInfo::MappingBase, llvm::sys::Memory::protectMappedMemory(), llvm::orc::shared::runFinalizeActions(), llvm::orc::MemoryMapper::AllocInfo::Segments, Size, llvm::orc::ExecutorAddr::toPtr(), and llvm::orc::toSysMemoryProtectionFlags().
|
overridevirtual |
Provides working memory.
Implements llvm::orc::MemoryMapper.
Definition at line 61 of file MemoryMapper.cpp.
References Addr.
|
overridevirtual |
Release address space acquired through reserve()
Implements llvm::orc::MemoryMapper.
Definition at line 140 of file MemoryMapper.cpp.
References llvm::sampleprof::Base, deinitialize(), E, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::erase(), llvm::errorCodeToError(), F, llvm::joinErrors(), P, llvm::sys::Memory::releaseMappedMemory(), Size, and llvm::Error::success().
|
overridevirtual |
Reserves address space in executor process.
Implements llvm::orc::MemoryMapper.
Definition at line 43 of file MemoryMapper.cpp.
References llvm::sys::Memory::allocateMappedMemory(), llvm::errorCodeToError(), llvm::orc::ExecutorAddr::fromPtr(), llvm::sys::Memory::MF_READ, and llvm::sys::Memory::MF_WRITE.