LLVM  15.0.0git
Classes | Public Member Functions | Static Public Member Functions | List of all members
llvm::jitlink::InProcessMemoryManager Class Reference

A JITLinkMemoryManager that allocates in-process memory. More...

#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"

Inheritance diagram for llvm::jitlink::InProcessMemoryManager:
Inheritance graph
[legend]
Collaboration diagram for llvm::jitlink::InProcessMemoryManager:
Collaboration graph
[legend]

Classes

class  IPInFlightAlloc
 

Public Member Functions

 InProcessMemoryManager (uint64_t PageSize)
 Create an instance using the given page size. More...
 
void allocate (const JITLinkDylib *JD, LinkGraph &G, OnAllocatedFunction OnAllocated) override
 Start the allocation process. More...
 
void deallocate (std::vector< FinalizedAlloc > Alloc, OnDeallocatedFunction OnDeallocated) override
 Deallocate a list of allocation objects. More...
 
virtual void allocate (const JITLinkDylib *JD, LinkGraph &G, OnAllocatedFunction OnAllocated)=0
 Start the allocation process. More...
 
AllocResult allocate (const JITLinkDylib *JD, LinkGraph &G)
 Convenience function for blocking allocation. More...
 
virtual void deallocate (std::vector< FinalizedAlloc > Allocs, OnDeallocatedFunction OnDeallocated)=0
 Deallocate a list of allocation objects. More...
 
void deallocate (FinalizedAlloc Alloc, OnDeallocatedFunction OnDeallocated)
 Convenience function for deallocation of a single alloc. More...
 
Error deallocate (std::vector< FinalizedAlloc > Allocs)
 Convenience function for blocking deallocation. More...
 
Error deallocate (FinalizedAlloc Alloc)
 Convenience function for blocking deallocation of a single alloc. More...
 

Static Public Member Functions

static Expected< std::unique_ptr< InProcessMemoryManager > > Create ()
 Attempts to auto-detect the host page size. More...
 

Additional Inherited Members

Detailed Description

A JITLinkMemoryManager that allocates in-process memory.

Definition at line 354 of file JITLinkMemoryManager.h.

Constructor & Destructor Documentation

◆ InProcessMemoryManager()

llvm::jitlink::InProcessMemoryManager::InProcessMemoryManager ( uint64_t  PageSize)
inline

Create an instance using the given page size.

Definition at line 362 of file JITLinkMemoryManager.h.

Member Function Documentation

◆ allocate() [1/3]

AllocResult llvm::jitlink::JITLinkMemoryManager::allocate
inline

Convenience function for blocking allocation.

Definition at line 163 of file JITLinkMemoryManager.h.

◆ allocate() [2/3]

void llvm::jitlink::InProcessMemoryManager::allocate ( const JITLinkDylib JD,
LinkGraph G,
OnAllocatedFunction  OnAllocated 
)
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 310 of file JITLinkMemoryManager.cpp.

References llvm::alignTo(), llvm::sys::MemoryBlock::allocatedSize(), llvm::sys::Memory::allocateMappedMemory(), llvm::sys::MemoryBlock::base(), llvm::ARCISD::BL, llvm::dbgs(), llvm::errorCodeToError(), llvm::formatv(), llvm::orc::ExecutorAddr::fromPtr(), G, llvm::inconvertibleErrorCode(), llvm::isPowerOf2_64(), LLVM_DEBUG, llvm::max(), llvm::sys::Memory::MF_READ, llvm::sys::Memory::MF_WRITE, and llvm::jitlink::Standard.

◆ allocate() [3/3]

virtual void llvm::jitlink::JITLinkMemoryManager::allocate

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.

◆ Create()

Expected< std::unique_ptr< InProcessMemoryManager > > llvm::jitlink::InProcessMemoryManager::Create ( )
static

Attempts to auto-detect the host page size.

Definition at line 303 of file JITLinkMemoryManager.cpp.

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

◆ deallocate() [1/5]

Error llvm::jitlink::JITLinkMemoryManager::deallocate
inline

Convenience function for blocking deallocation of a single alloc.

Definition at line 196 of file JITLinkMemoryManager.h.

◆ deallocate() [2/5]

void llvm::jitlink::JITLinkMemoryManager::deallocate
inline

Convenience function for deallocation of a single alloc.

Definition at line 180 of file JITLinkMemoryManager.h.

◆ deallocate() [3/5]

void llvm::jitlink::InProcessMemoryManager::deallocate ( std::vector< FinalizedAlloc Allocs,
OnDeallocatedFunction  OnDeallocated 
)
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 417 of file JITLinkMemoryManager.cpp.

References llvm::Lock, move, and llvm::Error::success().

◆ deallocate() [4/5]

Error llvm::jitlink::JITLinkMemoryManager::deallocate
inline

Convenience function for blocking deallocation.

Definition at line 187 of file JITLinkMemoryManager.h.

◆ deallocate() [5/5]

virtual void llvm::jitlink::JITLinkMemoryManager::deallocate

Deallocate a list of allocation objects.

Dealloc actions will be run in reverse order (from the end of the vector to the start).


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