From 282c86eff2f0d7a4e01f08f85062b377f82b5c2d Mon Sep 17 00:00:00 2001 From: Able Date: Fri, 12 Nov 2021 16:01:59 -0600 Subject: [PATCH] h --- src/main.rs | 3 +++ wasm/test.wat | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/main.rs b/src/main.rs index c3e5197..8c631d7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,7 @@ impl HostFunctions { fn check_signature(&self, index: usize, signature: &Signature) -> bool { let (params, ret_ty): (&[ValueType], Option) = match index.into() { SysCall::KILL => (&[ValueType::I32, ValueType::I32], Some(ValueType::I32)), + SysCall::EMPTY => (&[], None), _ => return false, }; signature.params() == params && signature.return_type() == ret_ty @@ -33,6 +34,7 @@ impl Externals for HostFunctions { Ok(Some(RuntimeValue::I32(result as i32))) } + SysCall::EMPTY => Ok(None), // SysCall::CONSOLE_RESET => {} // SysCall::CONSOLE_IN => {} // SysCall::CONSOLE_OUT => {} @@ -46,6 +48,7 @@ impl ModuleImportResolver for HostFunctions { fn resolve_func(&self, field_name: &str, signature: &Signature) -> Result { let index = match field_name { "add" => SysCall::KILL as usize, + "empty" => SysCall::EMPTY as usize, _ => { return Err(Error::Instantiation(format!( "Export {} not found", diff --git a/wasm/test.wat b/wasm/test.wat index e12d5d5..77f65c4 100644 --- a/wasm/test.wat +++ b/wasm/test.wat @@ -1,6 +1,8 @@ (module (import "host" "add" (func $add (param i32 i32)(result i32))) + (; (import "host" "empty" (func $empty)) ;) (func (export "main") (result i32) + (; (call $empty) ;) (call $add (i32.const 123) (i32.const 456)) ) )