pub struct CodeMemory { /* private fields */ }
Expand description
Mappings to regions of memory storing the executable JIT code.
Implementations§
Source§impl CodeMemory
impl CodeMemory
Sourcepub fn resize(self, size: usize) -> Result<Self>
pub fn resize(self, size: usize) -> Result<Self>
Ensure this CodeMemory is at least of the requested size.
This will invalidate any data previously written into the mapping if the mapping needs to be resized.
Sourcepub unsafe fn writer(&mut self) -> CodeMemoryWriter<'_>
pub unsafe fn writer(&mut self) -> CodeMemoryWriter<'_>
Write to this code memory from the beginning of the mapping.
§Safety
At the time this method is called, there should remain no dangling readable/executable
references to this CodeMemory
, for the original code memory that those references point
to are invalidated as soon as this method is invoked.
Sourcepub unsafe fn publish(&mut self) -> Result<(), CompileError>
pub unsafe fn publish(&mut self) -> Result<(), CompileError>
Publish the specified number of bytes as executable code.
§Safety
Calling this requires that no mutable references to the code memory remain.
Sourcepub unsafe fn executable_address(&self, offset: usize) -> *const u8
pub unsafe fn executable_address(&self, offset: usize) -> *const u8
Remap the offset into an absolute address within a read-execute mapping.
Offset must not exceed isize::MAX
.
Sourcepub unsafe fn writable_address(&self, offset: usize) -> *mut u8
pub unsafe fn writable_address(&self, offset: usize) -> *mut u8
Remap the offset into an absolute address within a read-write mapping.
Offset must not exceed isize::MAX
.