pub struct ExecutableMemory { /* private fields */ }Expand description
Executable memory for JIT-compiled code
Implementations§
Source§impl ExecutableMemory
impl ExecutableMemory
pub fn allocate_writable(size: usize) -> Result<Self, RasError>
pub fn make_executable(&mut self) -> Result<(), RasError>
pub fn allocate(size: usize) -> Result<Self, RasError>
pub fn write_code(&mut self, code: &[u8]) -> Result<(), RasError>
pub fn code_start(&self) -> *const u8
Sourcepub unsafe fn entry_fn<F: Sized>(&self) -> F
pub unsafe fn entry_fn<F: Sized>(&self) -> F
Interprets the first byte of this region as the entry address for a function pointer.
This is not a pointer-to-pointer: the mapping begins with machine code, not a stored
address. Do not use *const F to the entry and then dereference; that would load
instruction bytes as a pointer.
§Safety
The caller must ensure F matches the ABI and signature of the generated code, and that
this ExecutableMemory outlives every call through F.
Trait Implementations§
Source§impl Drop for ExecutableMemory
impl Drop for ExecutableMemory
Auto Trait Implementations§
impl Freeze for ExecutableMemory
impl RefUnwindSafe for ExecutableMemory
impl !Send for ExecutableMemory
impl !Sync for ExecutableMemory
impl Unpin for ExecutableMemory
impl UnsafeUnpin for ExecutableMemory
impl UnwindSafe for ExecutableMemory
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