LLVM  14.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

struct  AllocActionCall
 Represents a call to a graph-memory-management support function in the executor. More...
 
struct  AllocActionCallPair
 A pair of AllocActionCalls, one to be run at finalization time, one to be run at deallocation time. More...
 
class  FinalizedAlloc
 Represents a finalized allocation. More...
 
class  InFlightAlloc
 Represents an allocation which has not been finalized yet. More...
 

Public Types

using AllocActions = std::vector< AllocActionCallPair >
 A vector of allocation actions to be run for this allocation. More...
 
using AllocResult = Expected< std::unique_ptr< InFlightAlloc > >
 Typedef for the argument to be passed to OnAllocatedFunction. More...
 
using OnAllocatedFunction = unique_function< void(AllocResult)>
 Called when allocation has been completed. More...
 
using OnDeallocatedFunction = unique_function< void(Error)>
 Called when deallocation has completed. More...
 

Public Member Functions

virtual ~JITLinkMemoryManager ()
 
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...
 

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 40 of file JITLinkMemoryManager.h.

Member Typedef Documentation

◆ AllocActions

A vector of allocation actions to be run for this allocation.

Finalize allocations will be run in order at finalize time. Dealloc actions will be run in reverse order at deallocation time.

Definition at line 81 of file JITLinkMemoryManager.h.

◆ AllocResult

Typedef for the argument to be passed to OnAllocatedFunction.

Definition at line 178 of file JITLinkMemoryManager.h.

◆ OnAllocatedFunction

Called when allocation has been completed.

Definition at line 181 of file JITLinkMemoryManager.h.

◆ OnDeallocatedFunction

Called when deallocation has completed.

Definition at line 184 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 198 of file JITLinkMemoryManager.h.

References 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::jitlink::InProcessMemoryManager, and llvm::orc::EPCGenericJITLinkMemoryManager.

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 231 of file JITLinkMemoryManager.h.

◆ deallocate() [2/4]

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

Convenience function for deallocation of a single alloc.

Definition at line 215 of file JITLinkMemoryManager.h.

◆ deallocate() [3/4]

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

Convenience function for blocking deallocation.

Definition at line 222 of file JITLinkMemoryManager.h.

References deallocate(), and move.

◆ 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::orc::EPCGenericJITLinkMemoryManager, and llvm::jitlink::InProcessMemoryManager.

Referenced by deallocate().


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