pub struct OpcodeCosts {Show 17 fields
pub bit: u32,
pub add: u32,
pub mul: u32,
pub div: u32,
pub load: u32,
pub store: u32,
pub op_const: u32,
pub local: u32,
pub global: u32,
pub integer_comparison: u32,
pub conversion: u32,
pub unreachable: u32,
pub nop: u32,
pub current_memory: u32,
pub grow_memory: u32,
pub control_flow: ControlFlowCosts,
pub sign: u32,
}
Available on crate feature
std
only.Expand description
Definition of a cost table for Wasm opcodes.
This is taken (partially) from parity-ethereum.
Fields§
§bit: u32
Bit operations multiplier.
add: u32
Arithmetic add operations multiplier.
mul: u32
Mul operations multiplier.
div: u32
Div operations multiplier.
load: u32
Memory load operation multiplier.
store: u32
Memory store operation multiplier.
op_const: u32
Const operation multiplier.
local: u32
Local operations multiplier.
global: u32
Global operations multiplier.
integer_comparison: u32
Integer operations multiplier.
conversion: u32
Conversion operations multiplier.
unreachable: u32
Unreachable operation multiplier.
nop: u32
Nop operation multiplier.
current_memory: u32
Get current memory operation multiplier.
grow_memory: u32
Grow memory cost, per page (64kb)
control_flow: ControlFlowCosts
Control flow operations multiplier.
sign: u32
Sign ext operations costs
Trait Implementations§
Source§impl Add for OpcodeCosts
impl Add for OpcodeCosts
Source§type Output = OpcodeCosts
type Output = OpcodeCosts
The resulting type after applying the
+
operator.Source§fn add(self, rhs: OpcodeCosts) -> OpcodeCosts
fn add(self, rhs: OpcodeCosts) -> OpcodeCosts
Performs the
+
operation. Read moreSource§impl Clone for OpcodeCosts
impl Clone for OpcodeCosts
Source§fn clone(&self) -> OpcodeCosts
fn clone(&self) -> OpcodeCosts
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl DataSize for OpcodeCosts
impl DataSize for OpcodeCosts
Source§const IS_DYNAMIC: bool = false
const IS_DYNAMIC: bool = false
If
true
, the type has a heap size that can vary at runtime, depending on the actual value.Source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
The amount of space a value of the type always occupies. If
IS_DYNAMIC
is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.Source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Estimates the size of heap memory taken up by this value. Read more
Source§impl Debug for OpcodeCosts
impl Debug for OpcodeCosts
Source§impl Default for OpcodeCosts
impl Default for OpcodeCosts
Source§impl<'de> Deserialize<'de> for OpcodeCosts
impl<'de> Deserialize<'de> for OpcodeCosts
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Distribution<OpcodeCosts> for Standard
Available on crate feature testing
only.
impl Distribution<OpcodeCosts> for Standard
Available on crate feature
testing
only.Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> OpcodeCosts
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> OpcodeCosts
Generate a random value of
T
, using rng
as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
Create an iterator that generates random values of
T
, using rng
as
the source of randomness. Read moreSource§impl FromBytes for OpcodeCosts
impl FromBytes for OpcodeCosts
Source§impl PartialEq for OpcodeCosts
impl PartialEq for OpcodeCosts
Source§impl Serialize for OpcodeCosts
impl Serialize for OpcodeCosts
Source§impl ToBytes for OpcodeCosts
impl ToBytes for OpcodeCosts
Source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Returns the length of the
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.Source§impl Zero for OpcodeCosts
impl Zero for OpcodeCosts
impl Copy for OpcodeCosts
impl Eq for OpcodeCosts
impl StructuralPartialEq for OpcodeCosts
Auto Trait Implementations§
impl Freeze for OpcodeCosts
impl RefUnwindSafe for OpcodeCosts
impl Send for OpcodeCosts
impl Sync for OpcodeCosts
impl Unpin for OpcodeCosts
impl UnwindSafe for OpcodeCosts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more