pub struct GasSimulator { /* private fields */ }Expand description
Single-pass pipeline gas simulator. O(1) per instruction, stack-allocated.
Implementations§
Source§impl GasSimulator
impl GasSimulator
pub fn new() -> Self
Sourcepub fn feed_direct(
&mut self,
cycles: u8,
decode_slots: u8,
src1: u8,
src2: u8,
dst: u8,
)
pub fn feed_direct( &mut self, cycles: u8, decode_slots: u8, src1: u8, src2: u8, dst: u8, )
Fast path: feed an instruction using direct register indices instead of
bitmasks. Avoids the shift+OR bitmask construction and trailing_zeros
extraction loop. For typical 2-source, 1-dest instructions.
src1/src2 are source register indices (0..12, or 0xFF for “none”).
dst is destination register index (0..12, or 0xFF for “none”).
Sourcepub fn flush_and_get_cost(&self) -> u32
pub fn flush_and_get_cost(&self) -> u32
Return block gas cost: max(max_done - 3, 1).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GasSimulator
impl RefUnwindSafe for GasSimulator
impl Send for GasSimulator
impl Sync for GasSimulator
impl Unpin for GasSimulator
impl UnsafeUnpin for GasSimulator
impl UnwindSafe for GasSimulator
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