Struct casper_execution_engine::shared::opcode_costs::OpcodeCosts
source · pub struct OpcodeCosts {Show 16 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,
}Expand description
Definition of a cost table for Wasm opcodes.
This is taken (partially) from parity-ethereum.
Fields§
§bit: u32Bit operations multiplier.
add: u32Arithmetic add operations multiplier.
mul: u32Mul operations multiplier.
div: u32Div operations multiplier.
load: u32Memory load operation multiplier.
store: u32Memory store operation multiplier.
op_const: u32Const operation multiplier.
local: u32Local operations multiplier.
global: u32Global operations multiplier.
integer_comparison: u32Integer operations multiplier.
conversion: u32Conversion operations multiplier.
unreachable: u32Unreachable operation multiplier.
nop: u32Nop operation multiplier.
current_memory: u32Get current memory operation multiplier.
grow_memory: u32Grow memory cost, per page (64kb)
control_flow: ControlFlowCostsControl flow operations multiplier.
Trait Implementations§
source§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
impl Distribution<OpcodeCosts> for Standard
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§fn eq(&self, other: &OpcodeCosts) -> bool
fn eq(&self, other: &OpcodeCosts) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Rules for OpcodeCosts
impl Rules for OpcodeCosts
source§fn instruction_cost(&self, instruction: &Instruction) -> Option<u32>
fn instruction_cost(&self, instruction: &Instruction) -> Option<u32>
Returns the cost for the passed
instruction. Read moresource§fn memory_grow_cost(&self) -> Option<MemoryGrowCost>
fn memory_grow_cost(&self) -> Option<MemoryGrowCost>
Returns the costs for growing the memory using the
memory.grow instruction. Read moresource§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.impl Copy for OpcodeCosts
impl Eq for OpcodeCosts
impl StructuralPartialEq for OpcodeCosts
Auto Trait Implementations§
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn 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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§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.