LLVM 20.0.0git
|
A JITLinkMemoryManager that allocates in-process memory. More...
#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
Classes | |
class | IPInFlightAlloc |
Public Member Functions | |
InProcessMemoryManager (uint64_t PageSize) | |
Create an instance using the given page size. | |
void | allocate (const JITLinkDylib *JD, LinkGraph &G, OnAllocatedFunction OnAllocated) override |
Start the allocation process. | |
void | deallocate (std::vector< FinalizedAlloc > Alloc, OnDeallocatedFunction OnDeallocated) override |
Deallocate a list of allocation objects. | |
virtual void | allocate (const JITLinkDylib *JD, LinkGraph &G, OnAllocatedFunction OnAllocated)=0 |
Start the allocation process. | |
AllocResult | allocate (const JITLinkDylib *JD, LinkGraph &G) |
Convenience function for blocking allocation. | |
virtual void | deallocate (std::vector< FinalizedAlloc > Allocs, OnDeallocatedFunction OnDeallocated)=0 |
Deallocate a list of allocation objects. | |
void | deallocate (FinalizedAlloc Alloc, OnDeallocatedFunction OnDeallocated) |
Convenience function for deallocation of a single alloc. | |
Error | deallocate (std::vector< FinalizedAlloc > Allocs) |
Convenience function for blocking deallocation. | |
Error | deallocate (FinalizedAlloc Alloc) |
Convenience function for blocking deallocation of a single alloc. | |
Public Member Functions inherited from llvm::jitlink::JITLinkMemoryManager | |
virtual | ~JITLinkMemoryManager () |
virtual void | allocate (const JITLinkDylib *JD, LinkGraph &G, OnAllocatedFunction OnAllocated)=0 |
Start the allocation process. | |
AllocResult | allocate (const JITLinkDylib *JD, LinkGraph &G) |
Convenience function for blocking allocation. | |
virtual void | deallocate (std::vector< FinalizedAlloc > Allocs, OnDeallocatedFunction OnDeallocated)=0 |
Deallocate a list of allocation objects. | |
void | deallocate (FinalizedAlloc Alloc, OnDeallocatedFunction OnDeallocated) |
Convenience function for deallocation of a single alloc. | |
Error | deallocate (std::vector< FinalizedAlloc > Allocs) |
Convenience function for blocking deallocation. | |
Error | deallocate (FinalizedAlloc Alloc) |
Convenience function for blocking deallocation of a single alloc. | |
Static Public Member Functions | |
static Expected< std::unique_ptr< InProcessMemoryManager > > | Create () |
Attempts to auto-detect the host page size. | |
Additional Inherited Members | |
Public Types inherited from llvm::jitlink::JITLinkMemoryManager | |
using | AllocResult = Expected< std::unique_ptr< InFlightAlloc > > |
Typedef for the argument to be passed to OnAllocatedFunction. | |
using | OnAllocatedFunction = unique_function< void(AllocResult)> |
Called when allocation has been completed. | |
using | OnDeallocatedFunction = unique_function< void(Error)> |
Called when deallocation has completed. | |
A JITLinkMemoryManager that allocates in-process memory.
Definition at line 358 of file JITLinkMemoryManager.h.
|
inline |
Create an instance using the given page size.
Definition at line 366 of file JITLinkMemoryManager.h.
|
inline |
Convenience function for blocking allocation.
Definition at line 163 of file JITLinkMemoryManager.h.
|
overridevirtual |
Start the allocation process.
If the initial allocation is successful then the OnAllocated function will be called with a std::unique_ptr<InFlightAlloc> value. If the assocation is unsuccessful then the OnAllocated function will be called with an Error.
Scan the request and calculate the group and total sizes. Check that segment size is no larger than a page.
Check that the total size requested (including zero fill) is not larger than a size_t.
Implements llvm::jitlink::JITLinkMemoryManager.
Definition at line 335 of file JITLinkMemoryManager.cpp.
References llvm::alignTo(), llvm::sys::MemoryBlock::allocatedSize(), llvm::sys::Memory::allocateMappedMemory(), llvm::sys::MemoryBlock::base(), llvm::dbgs(), llvm::errorCodeToError(), llvm::formatv(), llvm::orc::ExecutorAddr::fromPtr(), G, llvm::inconvertibleErrorCode(), llvm::isPowerOf2_64(), LLVM_DEBUG, llvm::sys::Memory::MF_READ, llvm::sys::Memory::MF_WRITE, and llvm::orc::Standard.
|
virtual |
Start the allocation process.
If the initial allocation is successful then the OnAllocated function will be called with a std::unique_ptr<InFlightAlloc> value. If the assocation is unsuccessful then the OnAllocated function will be called with an Error.
Implements llvm::jitlink::JITLinkMemoryManager.
|
static |
Attempts to auto-detect the host page size.
Definition at line 328 of file JITLinkMemoryManager.cpp.
References llvm::sys::Process::getPageSize().
|
inline |
Convenience function for blocking deallocation of a single alloc.
Definition at line 196 of file JITLinkMemoryManager.h.
|
inline |
Convenience function for deallocation of a single alloc.
Definition at line 180 of file JITLinkMemoryManager.h.
|
overridevirtual |
Deallocate a list of allocation objects.
Dealloc actions will be run in reverse order (from the end of the vector to the start).
Run any deallocate calls.
Release the standard segments slab.
Implements llvm::jitlink::JITLinkMemoryManager.
Definition at line 442 of file JITLinkMemoryManager.cpp.
References llvm::Alloc, llvm::errorCodeToError(), llvm::joinErrors(), llvm::sys::Memory::releaseMappedMemory(), and llvm::Error::success().
|
inline |
Convenience function for blocking deallocation.
Definition at line 187 of file JITLinkMemoryManager.h.
|
virtual |
Deallocate a list of allocation objects.
Dealloc actions will be run in reverse order (from the end of the vector to the start).
Implements llvm::jitlink::JITLinkMemoryManager.