Struct wasmer_runtime_core_fl::trampoline_x64::TrampolineBufferBuilder [−][src]
pub struct TrampolineBufferBuilder { /* fields omitted */ }
Expand description
Trampoline Buffer Builder.
Implementations
Creates a new empty TrampolineBufferBuilder
.
pub fn add_context_trampoline(
&mut self,
target: *const CallTarget,
context: *const CallContext
) -> usize
pub fn add_context_trampoline(
&mut self,
target: *const CallTarget,
context: *const CallContext
) -> usize
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
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
Adds context RSP state preserving trampoline to the buffer.
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.
Inserts this trampoline to the global trampoline buffer.
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
.
Consumes the builder and builds the trampoline buffer.