pub struct ThreadJitAlloc(/* private fields */);
Available on crate features
std
and default_jit_alloc
only.Expand description
Marker type providing access to a thread-local JIT allocator.
Unlike GlobalJitAlloc
, this allocator is neither Send
nor Sync
.
Trait Implementations§
Source§impl Clone for ThreadJitAlloc
impl Clone for ThreadJitAlloc
Source§fn clone(&self) -> ThreadJitAlloc
fn clone(&self) -> ThreadJitAlloc
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Default for ThreadJitAlloc
impl Default for ThreadJitAlloc
Source§fn default() -> ThreadJitAlloc
fn default() -> ThreadJitAlloc
Returns the “default value” for a type. Read more
Source§impl JitAlloc for ThreadJitAlloc
impl JitAlloc for ThreadJitAlloc
Source§fn alloc(&self, size: usize) -> Result<(*const u8, *mut u8), JitAllocError>
fn alloc(&self, size: usize) -> Result<(*const u8, *mut u8), JitAllocError>
Allocates
size
bytes in the executable memory region.
Returns two pointers. One points to Read-Execute mapping and another to Read-Write mapping.
All code writes must go to the Read-Write mapping.Source§unsafe fn release(&self, rx_ptr: *const u8) -> Result<(), JitAllocError>
unsafe fn release(&self, rx_ptr: *const u8) -> Result<(), JitAllocError>
Releases the memory allocated by
alloc
. Read moreSource§unsafe fn flush_instruction_cache(&self, rx_ptr: *const u8, size: usize)
unsafe fn flush_instruction_cache(&self, rx_ptr: *const u8, size: usize)
Flushes the instruction cache for (at least) the given slice of executable memory. Should be
called after the JIT memory is ready to be executed. Read more
Source§unsafe fn protect_jit_memory(
&self,
_ptr: *const u8,
_size: usize,
access: ProtectJitAccess,
)
unsafe fn protect_jit_memory( &self, _ptr: *const u8, _size: usize, access: ProtectJitAccess, )
On hardened architectures with
MAP_JIT
-like memory flags, set the access for the current
thread. Read moreAuto Trait Implementations§
impl Freeze for ThreadJitAlloc
impl RefUnwindSafe for ThreadJitAlloc
impl !Send for ThreadJitAlloc
impl !Sync for ThreadJitAlloc
impl Unpin for ThreadJitAlloc
impl UnwindSafe for ThreadJitAlloc
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