fix attempt

This commit is contained in:
NikVolf 2018-02-05 15:27:32 +03:00
parent 0345b7c9c8
commit 67a542927a

View File

@ -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,