|
LLVM 24.0.0git
|
#include "llvm/ExecutionEngine/Orc/MapperJITLinkMemoryManager.h"
Classes | |
| class | InFlightAlloc |
Public Types | |
| using | SlabGrowthPolicy |
| Policy invoked before reserving an additional slab for a JITDylib (i.e. | |
| 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. | |
Public Member Functions | |
| 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, so all of a JITDylib's objects are colocated (kept within range of each other for direct, e.g. | |
| size_t | reservationUnits () const |
| The reservation granularity passed to the constructor: each slab reserved from the executor address space is a multiple of this. | |
| void | allocate (const jitlink::JITLinkDylib *JD, jitlink::LinkGraph &G, OnAllocatedFunction OnAllocated) override |
| Start the allocation process. | |
| void | deallocate (std::vector< FinalizedAlloc > Allocs, OnDeallocatedFunction OnDeallocated) override |
| Deallocate a list of allocation objects. | |
| void | denySlabGrowth () |
| Restrict each JITDylib to a single reservation ("slab"). | |
| void | allowSlabGrowth () |
| Allow each JITDylib to grow into additional reservations on demand (the default). | |
| void | setSlabPolicy (SlabGrowthPolicy Policy) |
| Set a custom slab-growth policy. See SlabGrowthPolicy above. | |
| void | notifyDestroying (jitlink::JITLinkDylib &JD) override |
| Called when a registered JITDylib is destroyed (see jitlink::JITLinkDylib::notifyOnDestruction). | |
| Public Member Functions inherited from llvm::jitlink::JITLinkMemoryManager | |
| virtual | ~JITLinkMemoryManager () |
| AllocResult | allocate (const JITLinkDylib *JD, LinkGraph &G) |
| Convenience function for blocking allocation. | |
| 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 | |
| template<class MemoryMapperType, class... Args> | |
| static Expected< std::unique_ptr< MapperJITLinkMemoryManager > > | CreateWithMapper (size_t ReservationGranularity, Args &&...A) |
| static constexpr size_t | defaultSlabSize () |
| The default per-slab reservation size used by createColocatingInProcessMemoryManager: 1 GiB on 64-bit hosts, 10 MiB on 32-bit hosts. | |
Definition at line 26 of file MapperJITLinkMemoryManager.h.
Policy invoked before reserving an additional slab for a JITDylib (i.e.
when its existing reservations can't satisfy a request). JD and RequestedSize identify the JITDylib and reservation size behind the request, for use in diagnostics. Returning an Error fails the triggering allocation.
Definition at line 77 of file MapperJITLinkMemoryManager.h.
| llvm::orc::MapperJITLinkMemoryManager::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, so all of a JITDylib's objects are colocated (kept within range of each other for direct, e.g.
32-bit PC-relative, references). If false (the default) a single shared pool is used for all JITDylibs.
Definition at line 57 of file MapperJITLinkMemoryManager.cpp.
References llvm::move().
Referenced by llvm::orc::MapperJITLinkMemoryManager::InFlightAlloc::InFlightAlloc().
|
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.
Implements llvm::jitlink::JITLinkMemoryManager.
Definition at line 119 of file MapperJITLinkMemoryManager.cpp.
References llvm::alignTo(), llvm::jitlink::BasicLayout::apply(), llvm::IntervalMap< KeyT, ValT, N, Traits >::begin(), llvm::orc::ExecutorAddrRange::empty(), llvm::End, llvm::IntervalMap< KeyT, ValT, N, Traits >::end(), G, llvm::jitlink::BasicLayout::getContiguousPageBasedLayoutSizes(), llvm::orc::Result, and llvm::jitlink::BasicLayout::segments().
| void llvm::orc::MapperJITLinkMemoryManager::allowSlabGrowth | ( | ) |
Allow each JITDylib to grow into additional reservations on demand (the default).
Objects in different slabs of the same JITDylib are not guaranteed to be within range of each other.
Note: LLJITBuilder::setColocatingSlabAllocator() overrides this default to denySlabGrowth() when no SlabGrowthPolicy is given.
Definition at line 94 of file MapperJITLinkMemoryManager.cpp.
References llvm::Error::success().
|
inlinestatic |
Definition at line 39 of file MapperJITLinkMemoryManager.h.
References A().
|
overridevirtual |
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.
Definition at line 233 of file MapperJITLinkMemoryManager.cpp.
References llvm::Size, and llvm::Error::success().
|
inlinestaticconstexpr |
The default per-slab reservation size used by createColocatingInProcessMemoryManager: 1 GiB on 64-bit hosts, 10 MiB on 32-bit hosts.
This is address space that is reserved, not committed.
Definition at line 51 of file MapperJITLinkMemoryManager.h.
Referenced by llvm::orc::createColocatingInProcessMemoryManager().
| void llvm::orc::MapperJITLinkMemoryManager::denySlabGrowth | ( | ) |
Restrict each JITDylib to a single reservation ("slab").
Once a JITDylib's slab is full, further allocations for it fail rather than silently spilling into another, possibly out-of-range, slab.
Definition at line 84 of file MapperJITLinkMemoryManager.cpp.
References llvm::createStringError(), and llvm::jitlink::JITLinkDylib::getName().
|
overridevirtual |
Called when a registered JITDylib is destroyed (see jitlink::JITLinkDylib::notifyOnDestruction).
Frees its pool so a new JITDylib at the same (reused) address doesn't inherit stale state.
Reimplemented from llvm::jitlink::JITLinkMemoryManager.
Definition at line 79 of file MapperJITLinkMemoryManager.cpp.
|
inline |
The reservation granularity passed to the constructor: each slab reserved from the executor address space is a multiple of this.
Definition at line 60 of file MapperJITLinkMemoryManager.h.
| void llvm::orc::MapperJITLinkMemoryManager::setSlabPolicy | ( | SlabGrowthPolicy | Policy | ) |
Set a custom slab-growth policy. See SlabGrowthPolicy above.
Definition at line 101 of file MapperJITLinkMemoryManager.cpp.