Struct ExecutableAnonymousMemoryMap

Source
pub struct ExecutableAnonymousMemoryMap { /* private fields */ }
Expand description

Represents an executable memory map that can be used to generate program code into.

Implementations§

Source§

impl ExecutableAnonymousMemoryMap

Source

pub fn new( length: usize, allocate_in_first_2Gb: bool, ignore_mlock_failure: bool, ) -> Result<Self, ExecutableAnonymousMemoryMapCreationError>

Create a new instance.

length is rounded up to the nearest power of two, and is floored at the smallest page size (4Kb).

On Linux, allocate_in_first_2Gb should ideally be true.

On Linux, there are historic bugs in mlock which may require ignore_mlock_failure to be true.

Memory is created using an anonymous, shared mmap with no access rights (not even read) which is then locked (mlock’d).

Source

pub fn instruction_stream( &mut self, instruction_stream_hints: &InstructionStreamHints, ) -> InstructionStream<'_>

Get an assembler to this anonymous map.

Trait Implementations§

Source§

impl Debug for ExecutableAnonymousMemoryMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for ExecutableAnonymousMemoryMap

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.