pub struct Span { /* private fields */ }Expand description
A region of executable memory returned by JitAllocator::alloc.
This is a plain handle: copying or
dropping it does nothing to the allocation. Release it explicitly with
JitAllocator::release, or let the allocator free it on reset or drop.
Implementations§
Source§impl Span
impl Span
Sourcepub const fn rx(&self) -> *const u8
pub const fn rx(&self) -> *const u8
Returns a pointer having Read & Execute permissions (references executable memory).
This pointer is never NULL if the allocation succeeded, it points to an executable memory.
Sourcepub const fn rw(&self) -> *mut u8
pub const fn rw(&self) -> *mut u8
Returns a pointer having Read & Write permissions (references writable memory).
Depending on the type of the allocation strategy this could either be:
- the same address as returned by
rx()if the allocator uses RWX mapping (pages have all of Read, Write, and Execute permissions) or MAP_JIT, which requires changing JIT memory protection manually. - a valid pointer, but not the same as
rx- this would be valid if dual mapping is used. - NULL pointer, in case that the allocation strategy doesn’t use RWX, MAP_JIT, or dual mapping. In this case only JitAllocator can copy new code into the executable memory referenced by Span.
pub const fn size(&self) -> usize
Sourcepub const fn block(&self) -> *mut u8
pub const fn block(&self) -> *mut u8
Returns the allocator block this span lives in, as an opaque pointer.
pub const fn is_icache_clean(&self) -> bool
pub const fn is_directly_writeable(&self) -> bool
Trait Implementations§
impl Copy for Span
impl Eq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations§
impl !Send for Span
impl !Sync for Span
impl Forget for Span
impl Freeze for Span
impl Move for Span
impl RefUnwindSafe for Span
impl Unpin for Span
impl UnsafeUnpin for Span
impl UnwindSafe for Span
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more