[][src]Struct cranelift_codegen::binemit::MemoryCodeSink

pub struct MemoryCodeSink<'a> {
    pub info: CodeInfo,
    // some fields omitted
}

A CodeSink that writes binary machine code directly into memory.

A MemoryCodeSink object should be used when emitting a Cranelift IR function into executable memory. It writes machine code directly to a raw pointer without any bounds checking, so make sure to allocate enough memory for the whole function. The number of bytes required is returned by the Context::compile() function.

Any relocations in the function are forwarded to the RelocSink trait object.

Note that MemoryCodeSink writes multi-byte values in the native byte order of the host. This is not the right thing to do for cross compilation.

Fields

info: CodeInfo

Information about the generated code and read-only data.

Methods

impl<'a> MemoryCodeSink<'a>[src]

pub unsafe fn new(
    data: *mut u8,
    relocs: &'a mut dyn RelocSink,
    traps: &'a mut dyn TrapSink,
    stackmaps: &'a mut dyn StackmapSink
) -> Self
[src]

Create a new memory code sink that writes a function to the memory pointed to by data.

Safety

This function is unsafe since MemoryCodeSink does not perform bounds checking on the memory buffer, and it can't guarantee that the data pointer is valid.

Trait Implementations

impl<'a> CodeSink for MemoryCodeSink<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for MemoryCodeSink<'a>

impl<'a> !Send for MemoryCodeSink<'a>

impl<'a> !Sync for MemoryCodeSink<'a>

impl<'a> Unpin for MemoryCodeSink<'a>

impl<'a> !UnwindSafe for MemoryCodeSink<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.