#[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

Formats the value using the given formatter. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.