From 67a542927aae8f6dc74d0d7355e2bbcdb3037fb4 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Mon, 5 Feb 2018 15:27:32 +0300 Subject: [PATCH] fix attempt --- src/gas.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gas.rs b/src/gas.rs index 5f3e9bc..fcac023 100644 --- a/src/gas.rs +++ b/src/gas.rs @@ -41,16 +41,15 @@ fn add_grow_counter(module: elements::Module, rules: &rules::Set, gas_func: u32) let mut b = builder::from_module(module); b.push_function( builder::function() - .signature().params().i32().i32().build().with_return_type(Some(elements::ValueType::I32)).build() + .signature().params().i32().build().with_return_type(Some(elements::ValueType::I32)).build() .body() .with_opcodes(elements::Opcodes::new(vec![ + GetLocal(0), GetLocal(0), I32Const(rules.grow_cost() as i32), I32Mul, - TeeLocal(1), // todo: there should be strong guarantee that it does not return anything on stack? Call(gas_func), - GetLocal(1), GrowMemory(0), GetLocal(0), End, @@ -241,12 +240,11 @@ mod tests { ); assert_eq!( &vec![ + GetLocal(0), GetLocal(0), I32Const(10000), I32Mul, - TeeLocal(1), Call(0), - GetLocal(1), GrowMemory(0), GetLocal(0), End,