Skip to main content

Trampoline

Enum Trampoline 

Source
pub enum Trampoline {
Show 52 variants LowerImport { index: LoweredIndex, lower_ty: TypeFuncIndex, options: OptionsIndex, }, Transcoder { op: Transcode, from: RuntimeMemoryIndex, from64: bool, to: RuntimeMemoryIndex, to64: bool, }, ResourceNew { instance: RuntimeComponentInstanceIndex, ty: TypeResourceTableIndex, }, ResourceRep { instance: RuntimeComponentInstanceIndex, ty: TypeResourceTableIndex, }, ResourceDrop { instance: RuntimeComponentInstanceIndex, ty: TypeResourceTableIndex, }, BackpressureInc { instance: RuntimeComponentInstanceIndex, }, BackpressureDec { instance: RuntimeComponentInstanceIndex, }, TaskReturn { instance: RuntimeComponentInstanceIndex, results: TypeTupleIndex, options: OptionsIndex, }, TaskCancel { instance: RuntimeComponentInstanceIndex, }, WaitableSetNew { instance: RuntimeComponentInstanceIndex, }, WaitableSetWait { instance: RuntimeComponentInstanceIndex, options: OptionsIndex, }, WaitableSetPoll { instance: RuntimeComponentInstanceIndex, options: OptionsIndex, }, WaitableSetDrop { instance: RuntimeComponentInstanceIndex, }, WaitableJoin { instance: RuntimeComponentInstanceIndex, }, SubtaskDrop { instance: RuntimeComponentInstanceIndex, }, SubtaskCancel { instance: RuntimeComponentInstanceIndex, async_: bool, }, StreamNew { instance: RuntimeComponentInstanceIndex, ty: TypeStreamTableIndex, }, StreamRead { instance: RuntimeComponentInstanceIndex, ty: TypeStreamTableIndex, options: OptionsIndex, }, StreamWrite { instance: RuntimeComponentInstanceIndex, ty: TypeStreamTableIndex, options: OptionsIndex, }, StreamCancelRead { instance: RuntimeComponentInstanceIndex, ty: TypeStreamTableIndex, async_: bool, }, StreamCancelWrite { instance: RuntimeComponentInstanceIndex, ty: TypeStreamTableIndex, async_: bool, }, StreamDropReadable { instance: RuntimeComponentInstanceIndex, ty: TypeStreamTableIndex, }, StreamDropWritable { instance: RuntimeComponentInstanceIndex, ty: TypeStreamTableIndex, }, FutureNew { instance: RuntimeComponentInstanceIndex, ty: TypeFutureTableIndex, }, FutureRead { instance: RuntimeComponentInstanceIndex, ty: TypeFutureTableIndex, options: OptionsIndex, }, FutureWrite { instance: RuntimeComponentInstanceIndex, ty: TypeFutureTableIndex, options: OptionsIndex, }, FutureCancelRead { instance: RuntimeComponentInstanceIndex, ty: TypeFutureTableIndex, async_: bool, }, FutureCancelWrite { instance: RuntimeComponentInstanceIndex, ty: TypeFutureTableIndex, async_: bool, }, FutureDropReadable { instance: RuntimeComponentInstanceIndex, ty: TypeFutureTableIndex, }, FutureDropWritable { instance: RuntimeComponentInstanceIndex, ty: TypeFutureTableIndex, }, ErrorContextNew { instance: RuntimeComponentInstanceIndex, ty: TypeComponentLocalErrorContextTableIndex, options: OptionsIndex, }, ErrorContextDebugMessage { instance: RuntimeComponentInstanceIndex, ty: TypeComponentLocalErrorContextTableIndex, options: OptionsIndex, }, ErrorContextDrop { instance: RuntimeComponentInstanceIndex, ty: TypeComponentLocalErrorContextTableIndex, }, ResourceTransferOwn, ResourceTransferBorrow, PrepareCall { memory: Option<RuntimeMemoryIndex>, }, StartCall { callback: Option<RuntimeCallbackIndex>, post_return: Option<RuntimePostReturnIndex>, }, FutureTransfer, StreamTransfer, ErrorContextTransfer, Trap(Trap), EnterSyncCall, ExitSyncCall, ThreadIndex { instance: RuntimeComponentInstanceIndex, }, ThreadNewIndirect { instance: RuntimeComponentInstanceIndex, start_func_ty_idx: ModuleInternedTypeIndex, start_func_table_idx: RuntimeTableIndex, }, ThreadResumeLater { instance: RuntimeComponentInstanceIndex, }, ThreadSuspend { instance: RuntimeComponentInstanceIndex, }, ThreadYield { instance: RuntimeComponentInstanceIndex, }, ThreadSuspendThenResume { instance: RuntimeComponentInstanceIndex, }, ThreadYieldThenResume { instance: RuntimeComponentInstanceIndex, }, ThreadSuspendThenPromote { instance: RuntimeComponentInstanceIndex, }, ThreadYieldThenPromote { instance: RuntimeComponentInstanceIndex, },
}
Expand description

A list of all possible trampolines that may be required to compile a component completely.

These trampolines are used often as core wasm definitions and require Cranelift support to generate these functions. Each trampoline serves a different purpose for implementing bits and pieces of the component model.

All trampolines have a core wasm function signature associated with them which is stored in the Component::trampolines array.

Note that this type does not implement Serialize or Deserialize and that’s intentional as this isn’t stored in the final compilation artifact.

Variants§

§

LowerImport

Description of a lowered import used in conjunction with GlobalInitializer::LowerImport.

Fields

§index: LoweredIndex

The runtime lowering state that this trampoline will access.

§lower_ty: TypeFuncIndex

The type of the function that is being lowered, as perceived by the component doing the lowering.

§options: OptionsIndex

The canonical ABI options used when lowering this function specified in the original component.

§

Transcoder

Information about a string transcoding function required by an adapter module.

A transcoder is used when strings are passed between adapter modules, optionally changing string encodings at the same time. The transcoder is implemented in a few different layers:

  • Each generated adapter module has some glue around invoking the transcoder represented by this item. This involves bounds-checks and handling realloc for example.
  • Each transcoder gets a cranelift-generated trampoline which has the appropriate signature for the adapter module in question. Existence of this initializer indicates that this should be compiled by Cranelift.
  • The cranelift-generated trampoline will invoke a “transcoder libcall” which is implemented natively in Rust that has a signature independent of memory64 configuration options for example.

Fields

§op: Transcode

The transcoding operation being performed.

§from: RuntimeMemoryIndex

The linear memory that the string is being read from.

§from64: bool

Whether or not the source linear memory is 64-bit or not.

§to: RuntimeMemoryIndex

The linear memory that the string is being written to.

§to64: bool

Whether or not the destination linear memory is 64-bit or not.

§

ResourceNew

A resource.new intrinsic which will inject a new resource into the table specified.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeResourceTableIndex

The type of the resource.

§

ResourceRep

Same as ResourceNew, but for the resource.rep intrinsic.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeResourceTableIndex

The type of the resource.

§

ResourceDrop

Same as ResourceNew, but for the resource.drop intrinsic.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeResourceTableIndex

The type of the resource.

§

BackpressureInc

A backpressure.inc intrinsic.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§

BackpressureDec

A backpressure.dec intrinsic.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§

TaskReturn

A task.return intrinsic, which returns a result to the caller of a lifted export function. This allows the callee to continue executing after returning a result.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§results: TypeTupleIndex

Tuple representing the result types this intrinsic accepts.

§options: OptionsIndex

The canonical ABI options specified for this intrinsic.

§

TaskCancel

A task.cancel intrinsic, which acknowledges a CANCELLED event delivered to a guest task previously created by a call to an async export.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§

WaitableSetNew

A waitable-set.new intrinsic.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§

WaitableSetWait

A waitable-set.wait intrinsic, which waits for at least one outstanding async task/stream/future to make progress, returning the first such event.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§options: OptionsIndex

Configuration options for this intrinsic call.

§

WaitableSetPoll

A waitable-set.poll intrinsic, which checks whether any outstanding async task/stream/future has made progress. Unlike task.wait, this does not block and may return nothing if no such event has occurred.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§options: OptionsIndex

Configuration options for this intrinsic call.

§

WaitableSetDrop

A waitable-set.drop intrinsic.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§

WaitableJoin

A waitable.join intrinsic.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§

SubtaskDrop

A subtask.drop intrinsic to drop a specified task which has completed.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§

SubtaskCancel

A subtask.cancel intrinsic to drop an in-progress task.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§async_: bool

If false, block until cancellation completes rather than return BLOCKED.

§

StreamNew

A stream.new intrinsic to create a new stream handle of the specified type.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeStreamTableIndex

The table index for the specific stream type and caller instance.

§

StreamRead

A stream.read intrinsic to read from a stream of the specified type.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeStreamTableIndex

The table index for the specific stream type and caller instance.

§options: OptionsIndex

Any options (e.g. string encoding) to use when storing values to memory.

§

StreamWrite

A stream.write intrinsic to write to a stream of the specified type.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeStreamTableIndex

The table index for the specific stream type and caller instance.

§options: OptionsIndex

Any options (e.g. string encoding) to use when storing values to memory.

§

StreamCancelRead

A stream.cancel-read intrinsic to cancel an in-progress read from a stream of the specified type.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeStreamTableIndex

The table index for the specific stream type and caller instance.

§async_: bool

If false, block until cancellation completes rather than return BLOCKED.

§

StreamCancelWrite

A stream.cancel-write intrinsic to cancel an in-progress write from a stream of the specified type.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeStreamTableIndex

The table index for the specific stream type and caller instance.

§async_: bool

If false, block until cancellation completes rather than return BLOCKED.

§

StreamDropReadable

A stream.drop-readable intrinsic to drop the readable end of a stream of the specified type.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeStreamTableIndex

The table index for the specific stream type and caller instance.

§

StreamDropWritable

A stream.drop-writable intrinsic to drop the writable end of a stream of the specified type.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeStreamTableIndex

The table index for the specific stream type and caller instance.

§

FutureNew

A future.new intrinsic to create a new future handle of the specified type.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeFutureTableIndex

The table index for the specific future type and caller instance.

§

FutureRead

A future.read intrinsic to read from a future of the specified type.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeFutureTableIndex

The table index for the specific future type and caller instance.

§options: OptionsIndex

Any options (e.g. string encoding) to use when storing values to memory.

§

FutureWrite

A future.write intrinsic to write to a future of the specified type.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeFutureTableIndex

The table index for the specific future type and caller instance.

§options: OptionsIndex

Any options (e.g. string encoding) to use when storing values to memory.

§

FutureCancelRead

A future.cancel-read intrinsic to cancel an in-progress read from a future of the specified type.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeFutureTableIndex

The table index for the specific future type and caller instance.

§async_: bool

If false, block until cancellation completes rather than return BLOCKED.

§

FutureCancelWrite

A future.cancel-write intrinsic to cancel an in-progress write from a future of the specified type.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeFutureTableIndex

The table index for the specific future type and caller instance.

§async_: bool

If false, block until cancellation completes rather than return BLOCKED.

§

FutureDropReadable

A future.drop-readable intrinsic to drop the readable end of a future of the specified type.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeFutureTableIndex

The table index for the specific future type and caller instance.

§

FutureDropWritable

A future.drop-writable intrinsic to drop the writable end of a future of the specified type.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeFutureTableIndex

The table index for the specific future type and caller instance.

§

ErrorContextNew

A error-context.new intrinsic to create a new error-context with a specified debug message.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeComponentLocalErrorContextTableIndex

The table index for the error-context type in the caller instance.

§options: OptionsIndex

String encoding, memory, etc. to use when loading debug message.

§

ErrorContextDebugMessage

A error-context.debug-message intrinsic to get the debug message for a specified error-context.

Note that the debug message might not necessarily match what was passed to error.new.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeComponentLocalErrorContextTableIndex

The table index for the error-context type in the caller instance.

§options: OptionsIndex

String encoding, memory, etc. to use when storing debug message.

§

ErrorContextDrop

A error-context.drop intrinsic to drop a specified error-context.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§ty: TypeComponentLocalErrorContextTableIndex

The table index for the error-context type in the caller instance.

§

ResourceTransferOwn

An intrinsic used by FACT-generated modules which will transfer an owned resource from one table to another. Used in component-to-component adapter trampolines.

§

ResourceTransferBorrow

Same as ResourceTransferOwn but for borrows.

§

PrepareCall

An intrinsic used by FACT-generated modules to prepare a call involving an async-lowered import and/or an async-lifted export.

Fields

§memory: Option<RuntimeMemoryIndex>

The memory used to verify that the memory specified for the task.return that is called at runtime matches the one specified in the lifted export.

§

StartCall

An intrinsic used by FACT-generated modules to start a call previously set up with PrepareCall.

This is used for calls where something async is involved, for example an async function type, an async lift, or an async lower.

Note that PrepareCall and StartCall could theoretically be combined into a single intrinsic, but we separate them to allow the FACT-generated module to optionally call the callee directly without an intermediate host stack frame.

Fields

§callback: Option<RuntimeCallbackIndex>

The callee’s callback, if any.

§post_return: Option<RuntimePostReturnIndex>

The callee’s post-return function, if any.

§

FutureTransfer

An intrinisic used by FACT-generated modules to (partially or entirely) transfer ownership of a future.

Transferring a future can either mean giving away the readable end while retaining the writable end or only the former, depending on the ownership status of the future.

§

StreamTransfer

An intrinisic used by FACT-generated modules to (partially or entirely) transfer ownership of a stream.

Transferring a stream can either mean giving away the readable end while retaining the writable end or only the former, depending on the ownership status of the stream.

§

ErrorContextTransfer

An intrinisic used by FACT-generated modules to (partially or entirely) transfer ownership of an error-context.

Unlike futures, streams, and resource handles, error-context handles are reference counted, meaning that sharing the handle with another component does not invalidate the handle in the original component.

§

Trap(Trap)

An intrinsic used by FACT-generated modules to trap with the specified code.

§

EnterSyncCall

An intrinsic used by FACT-generated modules to push a task onto the stack for a sync-to-sync, guest-to-guest call.

§

ExitSyncCall

An intrinsic used by FACT-generated modules to pop the task previously pushed by EnterSyncCall.

§

ThreadIndex

Intrinsic used to implement the thread.index component model builtin.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§

ThreadNewIndirect

Intrinsic used to implement the thread.new-indirect component model builtin.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§start_func_ty_idx: ModuleInternedTypeIndex

The core function type that the thread’s start function must have, as declared by the thread.new-indirect built-in.

§start_func_table_idx: RuntimeTableIndex

The index of the table that stores the start function.

§

ThreadResumeLater

Intrinsic used to implement the thread.resume-later component model builtin.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§

ThreadSuspend

Intrinsic used to implement the thread.suspend component model builtin.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§

ThreadYield

A thread.yield intrinsic, which yields control to the host so that other tasks are able to make progress, if any.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§

ThreadSuspendThenResume

Intrinsic used to implement the thread.suspend-then-resume component model builtin.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§

ThreadYieldThenResume

Intrinsic used to implement the thread.yield-then-resume component model builtin.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§

ThreadSuspendThenPromote

Intrinsic used to implement the thread.suspend-then-promote component model builtin.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

§

ThreadYieldThenPromote

Intrinsic used to implement the thread.yield-then-promote component model builtin.

Fields

§instance: RuntimeComponentInstanceIndex

The specific component instance which is calling the intrinsic.

Implementations§

Source§

impl Trampoline

Source

pub fn symbol_name(&self) -> String

Returns the name to use for the symbol of this trampoline in the final compiled artifact

Trait Implementations§

Source§

impl Debug for Trampoline

Source§

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

Formats the value using the given formatter. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.