LLVM 20.0.0git
Classes | Public Types | Public Member Functions | List of all members
llvm::jitlink::JITLinkMemoryManager Class Referenceabstract

Manages allocations of JIT memory. More...

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

Inheritance diagram for llvm::jitlink::JITLinkMemoryManager:
Inheritance graph
[legend]

Classes

class  FinalizedAlloc
 Represents a finalized allocation. More...
 
class  InFlightAlloc
 Represents an allocation which has not been finalized yet. More...
 

Public Types

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.
 

Public Member Functions

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.
 

Detailed Description

Manages allocations of JIT memory.

Instances of this class may be accessed concurrently from multiple threads and their implemetations should include any necessary synchronization.

Definition at line 43 of file JITLinkMemoryManager.h.

Member Typedef Documentation

◆ AllocResult

Typedef for the argument to be passed to OnAllocatedFunction.

Definition at line 143 of file JITLinkMemoryManager.h.

◆ OnAllocatedFunction

Called when allocation has been completed.

Definition at line 146 of file JITLinkMemoryManager.h.

◆ OnDeallocatedFunction

Called when deallocation has completed.

Definition at line 149 of file JITLinkMemoryManager.h.

Constructor & Destructor Documentation

◆ ~JITLinkMemoryManager()

llvm::jitlink::JITLinkMemoryManager::~JITLinkMemoryManager ( )
virtualdefault

Member Function Documentation

◆ allocate() [1/2]

AllocResult llvm::jitlink::JITLinkMemoryManager::allocate ( const JITLinkDylib JD,
LinkGraph G 
)
inline

Convenience function for blocking allocation.

Definition at line 163 of file JITLinkMemoryManager.h.

References llvm::Alloc, allocate(), and G.

◆ allocate() [2/2]

virtual void llvm::jitlink::JITLinkMemoryManager::allocate ( const JITLinkDylib JD,
LinkGraph G,
OnAllocatedFunction  OnAllocated 
)
pure 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.

Implemented in llvm::orc::EPCGenericJITLinkMemoryManager, llvm::orc::MapperJITLinkMemoryManager, llvm::jitlink::InProcessMemoryManager, and llvm::jitlink::InProcessMemoryManager.

Referenced by allocate(), and llvm::jitlink::SimpleSegmentAlloc::Create().

◆ deallocate() [1/4]

Error llvm::jitlink::JITLinkMemoryManager::deallocate ( FinalizedAlloc  Alloc)
inline

Convenience function for blocking deallocation of a single alloc.

Definition at line 196 of file JITLinkMemoryManager.h.

References llvm::Alloc, and deallocate().

◆ deallocate() [2/4]

void llvm::jitlink::JITLinkMemoryManager::deallocate ( FinalizedAlloc  Alloc,
OnDeallocatedFunction  OnDeallocated 
)
inline

Convenience function for deallocation of a single alloc.

Definition at line 180 of file JITLinkMemoryManager.h.

References llvm::Alloc, and deallocate().

◆ deallocate() [3/4]

Error llvm::jitlink::JITLinkMemoryManager::deallocate ( std::vector< FinalizedAlloc Allocs)
inline

Convenience function for blocking deallocation.

Definition at line 187 of file JITLinkMemoryManager.h.

References deallocate().

◆ deallocate() [4/4]

virtual void llvm::jitlink::JITLinkMemoryManager::deallocate ( std::vector< FinalizedAlloc Allocs,
OnDeallocatedFunction  OnDeallocated 
)
pure virtual

Deallocate a list of allocation objects.

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

Implemented in llvm::jitlink::InProcessMemoryManager, llvm::orc::EPCGenericJITLinkMemoryManager, llvm::orc::MapperJITLinkMemoryManager, and llvm::jitlink::InProcessMemoryManager.

Referenced by deallocate(), llvm::orc::ObjectLinkingLayerJITLinkContext::notifyEmitted(), and llvm::orc::DebugObject::~DebugObject().


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