pub struct GlobalJitAlloc;
Available on crate feature
global_jit_alloc
only.Expand description
The default, global JIT allocator.
When the default_jit_alloc
feature is enabled, this is currently implemented as a ZST
deffering to a static jit_allocator2::JitAllocator
behind a std::sync::Mutex
(or a
spin::Mutex
under no_std
).
When the default_jit_alloc
feature is not enabled, defers to a JitAlloc
implementation
provided by a downstream crate using the global_jit_alloc
macro.
Trait Implementations§
Source§impl Clone for GlobalJitAlloc
impl Clone for GlobalJitAlloc
Source§fn clone(&self) -> GlobalJitAlloc
fn clone(&self) -> GlobalJitAlloc
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 GlobalJitAlloc
impl Default for GlobalJitAlloc
Source§fn default() -> GlobalJitAlloc
fn default() -> GlobalJitAlloc
Returns the “default value” for a type. Read more
Source§impl JitAlloc for GlobalJitAlloc
impl JitAlloc for GlobalJitAlloc
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 moreimpl Copy for GlobalJitAlloc
Auto Trait Implementations§
impl Freeze for GlobalJitAlloc
impl RefUnwindSafe for GlobalJitAlloc
impl Send for GlobalJitAlloc
impl Sync for GlobalJitAlloc
impl Unpin for GlobalJitAlloc
impl UnwindSafe for GlobalJitAlloc
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