[][src]Struct wasmer_runtime_core_fl::trampoline_x64::TrampolineBufferBuilder

pub struct TrampolineBufferBuilder { /* fields omitted */ }

Trampoline Buffer Builder.

Implementations

impl TrampolineBufferBuilder[src]

pub fn new() -> TrampolineBufferBuilder[src]

Creates a new empty TrampolineBufferBuilder.

pub fn add_context_trampoline(
    &mut self,
    target: *const CallTarget,
    context: *const CallContext
) -> usize
[src]

Adds a context trampoline.

This generates a transparent trampoline function that forwards any call to target with unmodified params/returns. When called from the trampoline, target will have access to the context specified here through get_context().

Note that since rax is overwritten internally, variadic functions are not supported as target.

pub fn add_context_rsp_state_preserving_trampoline(
    &mut self,
    target: unsafe extern "C" fn(_: &mut Ctx, _: *const CallContext, _: *const u64),
    context: *const CallContext
) -> usize
[src]

Adds context RSP state preserving trampoline to the buffer.

pub fn add_callinfo_trampoline(
    &mut self,
    target: unsafe extern "C" fn(_: *const CallContext, _: *const u64) -> u64,
    context: *const CallContext,
    params: &[Type],
    _returns: &[Type]
) -> usize
[src]

Adds a callinfo trampoline.

This generates a trampoline function that collects num_params parameters into an array and passes the array into target as the second argument when called. The first argument of target is the context specified here.

Note that non-integer parameters/variadic functions are not supported.

pub fn insert_global(self) -> Option<NonNull<u8>>[src]

Inserts this trampoline to the global trampoline buffer.

pub unsafe fn remove_global(ptr: NonNull<u8>)[src]

Removes the trampoline pointed to by ptr from the global trampoline buffer. Panics if ptr does not point to any trampoline.

Safety

Calling this function invalidates the trampoline ptr points to and recycles its memory. You should ensure that ptr isn't used after calling remove_global.

pub fn code(&self) -> &[u8][src]

Gets the current (non-executable) code in this builder.

pub fn build(self) -> TrampolineBuffer[src]

Consumes the builder and builds the trampoline buffer.

Auto Trait Implementations

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> Same<T> for T

type Output = T

Should always be Self

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.