
AsmJit Project
Machine Code Generation for C++
A simple implementation of memory manager that uses asmjit::VirtMem
functions to manage virtual memory for JIT compiled code.
Implementation notes:
kFlagUseMultiplePools
flag to be set.release()
and shrink()
. nullptr
)explicitnoexcept¶Creates a JitAllocator
instance.
Destroys the JitAllocator
instance and release all blocks held.
ResetPolicy::kSoft
)noexcept¶Free all allocated memory - makes all pointers returned by alloc()
invalid.
reset()
when the allocator is still in use. Returns allocator options, see Flags
.
Tests whether the allocator has the given option
set.
Returns a base block size (a minimum size of block that the allocator would allocate).
Returns granularity of the allocator.
Returns pattern that is used to fill unused memory if kFlagUseFillPattern
is set.
Allocates a new memory block of the requested size
.
When the function is successful it stores two pointers in rxPtrOut
and rwPtrOut
. The pointers will be different only if kOptionUseDualMapping
was used to setup the allocator (in that case the rxPtrOut
would point to a Read+Execute region and rwPtrOut
would point to a Read+Write region of the same memory-mapped block.
Releases a memory block returned by alloc()
.
Frees extra memory allocated with rxPtr
by shrinking it to the given newSize
.
Queries information about an allocated memory block that contains the given rxPtr
.
The function returns kErrorOk
when rxPtr
is matched and fills rxPtrOut
, rwPtrOut
, and sizeOut
output arguments. The returned rxPtrOut
and rwPtrOut
pointers point to the beginning of the block, and sizeOut
describes the total amount of bytes this allocation uses - sizeOut
will always be aligned to the allocation granularity, so for example if an allocation was 1 byte and the size granularity is 64, the returned sizeOut
will be 64 bytes, because that's what the allocator sees.
Returns JIT allocator statistics.
Allocator implementation (private).