mirror of
https://github.com/fluencelabs/marine.git
synced 2024-12-12 14:55:32 +00:00
remove redundant Ctx argument
This commit is contained in:
parent
4e3eda717c
commit
fa4b06c52f
@ -21,7 +21,7 @@ use crate::vm::{config::Config, errors::FrankError, service::FrankService};
|
|||||||
use sha2::{digest::generic_array::GenericArray, digest::FixedOutput};
|
use sha2::{digest::generic_array::GenericArray, digest::FixedOutput};
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use wasmer_runtime::{func, Ctx};
|
use wasmer_runtime::func;
|
||||||
use wasmer_runtime_core::import::{ImportObject, Namespace};
|
use wasmer_runtime_core::import::{ImportObject, Namespace};
|
||||||
|
|
||||||
pub struct Frank {
|
pub struct Frank {
|
||||||
@ -49,15 +49,13 @@ impl Frank {
|
|||||||
let allocate = module_abi.allocate.clone().unwrap();
|
let allocate = module_abi.allocate.clone().unwrap();
|
||||||
namespace.insert(
|
namespace.insert(
|
||||||
config.allocate_fn_name.clone(),
|
config.allocate_fn_name.clone(),
|
||||||
func!(move |_ctx: &mut Ctx, size: i32| -> i32 {
|
func!(move |size: i32| -> i32 { allocate.call(size).expect("allocate failed") }),
|
||||||
allocate.call(size).expect("allocate failed")
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let invoke = module_abi.invoke.clone().unwrap();
|
let invoke = module_abi.invoke.clone().unwrap();
|
||||||
namespace.insert(
|
namespace.insert(
|
||||||
config.invoke_fn_name.clone(),
|
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")
|
invoke.call(offset, size).expect("invoke failed")
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -65,7 +63,7 @@ impl Frank {
|
|||||||
let deallocate = module_abi.deallocate.clone().unwrap();
|
let deallocate = module_abi.deallocate.clone().unwrap();
|
||||||
namespace.insert(
|
namespace.insert(
|
||||||
config.deallocate_fn_name.clone(),
|
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");
|
deallocate.call(ptr, size).expect("deallocate failed");
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -73,7 +71,7 @@ impl Frank {
|
|||||||
let store = module_abi.store.clone().unwrap();
|
let store = module_abi.store.clone().unwrap();
|
||||||
namespace.insert(
|
namespace.insert(
|
||||||
config.store_fn_name.clone(),
|
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")
|
store.call(offset, value).expect("store failed")
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -81,9 +79,7 @@ impl Frank {
|
|||||||
let load = module_abi.load.clone().unwrap();
|
let load = module_abi.load.clone().unwrap();
|
||||||
namespace.insert(
|
namespace.insert(
|
||||||
config.load_fn_name.clone(),
|
config.load_fn_name.clone(),
|
||||||
func!(move |_ctx: &mut Ctx, offset: i32| -> i32 {
|
func!(move |offset: i32| -> i32 { load.call(offset).expect("load failed") }),
|
||||||
load.call(offset).expect("load failed")
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user