From fa4b06c52f92eb9d8c0e60065b6ae2da8449aac7 Mon Sep 17 00:00:00 2001 From: vms Date: Sun, 3 May 2020 19:29:33 +0300 Subject: [PATCH] remove redundant Ctx argument --- src/vm/frank.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/vm/frank.rs b/src/vm/frank.rs index 12623930..7e47bd16 100644 --- a/src/vm/frank.rs +++ b/src/vm/frank.rs @@ -21,7 +21,7 @@ use crate::vm::{config::Config, errors::FrankError, service::FrankService}; use sha2::{digest::generic_array::GenericArray, digest::FixedOutput}; use std::collections::hash_map::Entry; use std::collections::HashMap; -use wasmer_runtime::{func, Ctx}; +use wasmer_runtime::func; use wasmer_runtime_core::import::{ImportObject, Namespace}; pub struct Frank { @@ -49,15 +49,13 @@ impl Frank { let allocate = module_abi.allocate.clone().unwrap(); namespace.insert( config.allocate_fn_name.clone(), - func!(move |_ctx: &mut Ctx, size: i32| -> i32 { - allocate.call(size).expect("allocate failed") - }), + func!(move |size: i32| -> i32 { allocate.call(size).expect("allocate failed") }), ); let invoke = module_abi.invoke.clone().unwrap(); namespace.insert( config.invoke_fn_name.clone(), - func!(move |_ctx: &mut Ctx, offset: i32, size: i32| -> i32 { + func!(move |offset: i32, size: i32| -> i32 { invoke.call(offset, size).expect("invoke failed") }), ); @@ -65,7 +63,7 @@ impl Frank { let deallocate = module_abi.deallocate.clone().unwrap(); namespace.insert( config.deallocate_fn_name.clone(), - func!(move |_ctx: &mut Ctx, ptr: i32, size: i32| { + func!(move |ptr: i32, size: i32| { deallocate.call(ptr, size).expect("deallocate failed"); }), ); @@ -73,7 +71,7 @@ impl Frank { let store = module_abi.store.clone().unwrap(); namespace.insert( config.store_fn_name.clone(), - func!(move |_ctx: &mut Ctx, offset: i32, value: i32| { + func!(move |offset: i32, value: i32| { store.call(offset, value).expect("store failed") }), ); @@ -81,9 +79,7 @@ impl Frank { let load = module_abi.load.clone().unwrap(); namespace.insert( config.load_fn_name.clone(), - func!(move |_ctx: &mut Ctx, offset: i32| -> i32 { - load.call(offset).expect("load failed") - }), + func!(move |offset: i32| -> i32 { load.call(offset).expect("load failed") }), ); namespace