#[repr(C)]
pub struct VMRuntimeLimits { pub stack_limit: UnsafeCell<usize>, pub fuel_consumed: UnsafeCell<i64>, pub epoch_deadline: UnsafeCell<u64>, pub last_wasm_exit_fp: UnsafeCell<usize>, pub last_wasm_exit_pc: UnsafeCell<usize>, pub last_wasm_entry_sp: UnsafeCell<usize>, }
Expand description

Structure used to control interrupting wasm code.

Fields§

§stack_limit: UnsafeCell<usize>

Current stack limit of the wasm module.

For more information see crates/cranelift/src/lib.rs.

§fuel_consumed: UnsafeCell<i64>

Indicator of how much fuel has been consumed and is remaining to WebAssembly.

This field is typically negative and increments towards positive. Upon turning positive a wasm trap will be generated. This field is only modified if wasm is configured to consume fuel.

§epoch_deadline: UnsafeCell<u64>

Deadline epoch for interruption: if epoch-based interruption is enabled and the global (per engine) epoch counter is observed to reach or exceed this value, the guest code will yield if running asynchronously.

§last_wasm_exit_fp: UnsafeCell<usize>

The value of the frame pointer register when we last called from Wasm to the host.

Maintained by our Wasm-to-host trampoline, and cleared just before calling into Wasm in catch_traps.

This member is 0 when Wasm is actively running and has not called out to the host.

Used to find the start of a a contiguous sequence of Wasm frames when walking the stack.

§last_wasm_exit_pc: UnsafeCell<usize>

The last Wasm program counter before we called from Wasm to the host.

Maintained by our Wasm-to-host trampoline, and cleared just before calling into Wasm in catch_traps.

This member is 0 when Wasm is actively running and has not called out to the host.

Used when walking a contiguous sequence of Wasm frames.

§last_wasm_entry_sp: UnsafeCell<usize>

The last host stack pointer before we called into Wasm from the host.

Maintained by our host-to-Wasm trampoline, and cleared just before calling into Wasm in catch_traps.

This member is 0 when Wasm is actively running and has not called out to the host.

When a host function is wrapped into a wasmtime::Func, and is then called from the host, then this member has the sentinal value of -1 as usize, meaning that this contiguous sequence of Wasm frames is the empty sequence, and it is not safe to dereference the last_wasm_exit_fp.

Used to find the end of a contiguous sequence of Wasm frames when walking the stack.

Trait Implementations§

source§

impl Debug for VMRuntimeLimits

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for VMRuntimeLimits

source§

fn default() -> VMRuntimeLimits

Returns the “default value” for a type. Read more
source§

impl Send for VMRuntimeLimits

source§

impl Sync for VMRuntimeLimits

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V