Struct sc_executor_wasmtime::DeterministicStackLimit [−][src]
Expand description
Knobs for deterministic stack height limiting.
The WebAssembly standard defines a call/value stack but it doesn’t say anything about its size except that it has to be finite. The implementations are free to choose their own notion of limit: some may count the number of calls or values, others would rely on the host machine stack and trap on reaching a guard page.
This obviously is a source of non-determinism during execution. This feature can be used to instrument the code so that it will count the depth of execution in some deterministic way (the machine stack limit should be so high that the deterministic limit always triggers first).
The deterministic stack height limiting feature allows to instrument the code so that it will count the number of items that may be on the stack. This counting will only act as an rough estimate of the actual stack limit in wasmtime. This is because wasmtime measures it’s stack usage in bytes.
The actual number of bytes consumed by a function is not trivial to compute without going through
full compilation. Therefore, it’s expected that native_stack_max
is grealy overestimated and
thus never reached in practice. The stack overflow check introduced by the instrumentation and
that relies on the logical item count should be reached first.
See here for more details of the instrumentation
Fields
logical_max: u32
A number of logical “values” that can be pushed on the wasm stack. A trap will be triggered if exceeded.
A logical value is a local, an argument or a value pushed on operand stack.
native_stack_max: u32
The maximum number of bytes for stack used by wasmtime JITed code.
It’s not specified how much bytes will be consumed by a stack frame for a given wasm function after translation into machine code. It is also not quite trivial.
Therefore, this number should be choosen conservatively. It must be so large so that it can
fit the logical_max
logical values on the stack, according to the current
instrumentation algorithm.
This value cannot be 0.
Auto Trait Implementations
impl RefUnwindSafe for DeterministicStackLimit
impl Send for DeterministicStackLimit
impl Sync for DeterministicStackLimit
impl Unpin for DeterministicStackLimit
impl UnwindSafe for DeterministicStackLimit
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
The counterpart to unchecked_from
.
pub fn vzip(self) -> V