Struct wasmtime_runtime::AsyncWasmCallState
source · pub struct AsyncWasmCallState { /* private fields */ }
Expand description
Opaque state used to persist the state of the CallThreadState
activations associated with a fiber stack that’s used as part of an
async wasm call.
Implementations§
source§impl AsyncWasmCallState
impl AsyncWasmCallState
sourcepub fn new() -> AsyncWasmCallState
pub fn new() -> AsyncWasmCallState
Creates new state that initially starts as null.
sourcepub unsafe fn push(self) -> PreviousAsyncWasmCallState
pub unsafe fn push(self) -> PreviousAsyncWasmCallState
Pushes the saved state of this wasm’s call onto the current thread’s state.
This will iterate over the linked list of states stored within
self
and push them sequentially onto the current thread’s
activation list.
The returned PreviousAsyncWasmCallState
captures the state of this
thread just before this operation, and it must have its restore
method called to restore the state when the async wasm is suspended
from.
§Unsafety
Must be carefully coordinated with
PreviousAsyncWasmCallState::restore
and fiber switches to ensure
that this doesn’t push stale data and the data is popped
appropriately.
sourcepub fn assert_null(&self)
pub fn assert_null(&self)
Performs a runtime check that this state is indeed null.
sourcepub fn assert_current_state_not_in_range(range: Range<usize>)
pub fn assert_current_state_not_in_range(range: Range<usize>)
Asserts that the current CallThreadState pointer, if present, is not
in the range
specified.
This is used when exiting a future in Wasmtime to assert that the current CallThreadState pointer does not point within the stack we’re leaving (e.g. allocated for a fiber).