Struct sc_executor_wasmtime::Semantics [−][src]
pub struct Semantics { pub fast_instance_reuse: bool, pub deterministic_stack_limit: Option<DeterministicStackLimit>, pub canonicalize_nans: bool, }
Fields
fast_instance_reuse: bool
Enabling this will lead to some optimization shenanigans that make calling WasmInstance
extermely fast.
Primarily this is achieved by not recreating the instance for each call and performing a
bare minimum clean up: reapplying the data segments and restoring the values for global
variables. The vast majority of the linear memory is not restored, meaning that effects
of previous executions on the same WasmInstance
can be observed there.
This is not a problem for a standard substrate runtime execution because it’s up to the runtime itself to make sure that it doesn’t involve any non-determinism.
Since this feature depends on instrumentation, it can be set only if runtime is
instantiated using the runtime blob, e.g. using create_runtime
.
deterministic_stack_limit: Option<DeterministicStackLimit>
Specifiying Some
will enable deterministic stack height. That is, all executor invocations
will reach stack overflow at the exactly same point across different wasmtime versions and
architectures.
This is achieved by a combination of running an instrumentation pass on input code and configuring wasmtime accordingly.
Since this feature depends on instrumentation, it can be set only if runtime is
instantiated using the runtime blob, e.g. using create_runtime
.
canonicalize_nans: bool
Controls whether wasmtime should compile floating point in a way that doesn’t allow for non-determinism.
By default, the wasm spec allows some local non-determinism wrt. certain floating point operations. Specifically, those operations that are not defined to operate on bits (e.g. fneg) can produce NaN values. The exact bit pattern for those is not specified and may depend on the particular machine that executes wasmtime generated JITed machine code. That is a source of non-deterministic values.
The classical runtime environment for Substrate allowed it and punted this on the runtime developers. For PVFs, we want to ensure that execution is deterministic though. Therefore, for PVF execution this flag is meant to be turned on.
Auto Trait Implementations
impl RefUnwindSafe for Semantics
impl UnwindSafe for Semantics
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