13#ifndef LLVM_EXECUTIONENGINE_ORC_MAPPERJITLINKMEMORYMANAGER_H
14#define LLVM_EXECUTIONENGINE_ORC_MAPPERJITLINKMEMORYMANAGER_H
34 std::unique_ptr<MemoryMapper> Mapper,
35 bool ColocatePerJITDylib =
false);
37 template <
class MemoryMapperType,
class... Args>
40 auto Mapper = MemoryMapperType::Create(std::forward<Args>(
A)...);
42 return Mapper.takeError();
44 return std::make_unique<MapperJITLinkMemoryManager>(ReservationGranularity,
52 if constexpr (
sizeof(
void *) >= 8)
63 OnAllocatedFunction OnAllocated)
override;
65 using JITLinkMemoryManager::allocate;
67 void deallocate(std::vector<FinalizedAlloc> Allocs,
68 OnDeallocatedFunction OnDeallocated)
override;
70 using JITLinkMemoryManager::deallocate;
116 size_t ReservationUnits;
121 bool ColocatePerJITDylib;
132 AvailableMemoryMap::Allocator AMAllocator;
142 std::unique_ptr<AvailableMemoryMap> AvailPool;
154 std::unique_ptr<MemoryMapper> Mapper;
160LLVM_ABI Expected<std::unique_ptr<MapperJITLinkMemoryManager>>
162 std::optional<size_t> ReservationGranularity = std::nullopt);
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file implements a coalescing interval map for small objects.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Represents a JITDylib as seen by JITLink.
Manages allocations of JIT memory.
MapperJITLinkMemoryManager(size_t ReservationGranularity, std::unique_ptr< MemoryMapper > Mapper, bool ColocatePerJITDylib=false)
If ColocatePerJITDylib is true each JITDylib draws from its own pool of reservations,...
static Expected< std::unique_ptr< MapperJITLinkMemoryManager > > CreateWithMapper(size_t ReservationGranularity, Args &&...A)
size_t reservationUnits() const
The reservation granularity passed to the constructor: each slab reserved from the executor address s...
void allowSlabGrowth()
Allow each JITDylib to grow into additional reservations on demand (the default).
static constexpr size_t defaultSlabSize()
The default per-slab reservation size used by createColocatingInProcessMemoryManager: 1 GiB on 64-bit...
unique_function< Error( const jitlink::JITLinkDylib *JD, size_t RequestedSize)> SlabGrowthPolicy
Policy invoked before reserving an additional slab for a JITDylib (i.e.
void setSlabPolicy(SlabGrowthPolicy Policy)
Set a custom slab-growth policy. See SlabGrowthPolicy above.
void denySlabGrowth()
Restrict each JITDylib to a single reservation ("slab").
void notifyDestroying(jitlink::JITLinkDylib &JD) override
Called when a registered JITDylib is destroyed (see jitlink::JITLinkDylib::notifyOnDestruction).
unique_function is a type-erasing functor similar to std::function.
LLVM_ABI Expected< std::unique_ptr< MapperJITLinkMemoryManager > > createColocatingInProcessMemoryManager(std::optional< size_t > ReservationGranularity=std::nullopt)
Create an in-process slab allocator that colocates each JITDylib's objects within its own reservation...
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key