diff --git a/wit_fce/src/instance/wit_function.rs b/wit_fce/src/instance/wit_function.rs index 502afc28..5f5d6d7b 100644 --- a/wit_fce/src/instance/wit_function.rs +++ b/wit_fce/src/instance/wit_function.rs @@ -71,7 +71,6 @@ impl WITFunction { let func_type = wit_module.as_ref().get_func_signature(&func_name)?; let inputs = func_type.0.clone(); let outputs = func_type.1.clone(); - println!("from_import: {:?}", inputs); let inner = WITFunctionInner::Import { wit_module, diff --git a/wit_fce/src/instance/wit_instance.rs b/wit_fce/src/instance/wit_instance.rs index 86d586af..f0f9a453 100644 --- a/wit_fce/src/instance/wit_instance.rs +++ b/wit_fce/src/instance/wit_instance.rs @@ -46,9 +46,7 @@ impl WITInstance { modules: &HashMap>, ) -> Result { let mut exports = Self::extract_exports(&wasmer_instance, interfaces)?; - println!("exports count {}", exports.len()); let imports = Self::extract_imports(modules, interfaces, exports.len())?; - println!("imports count {}", imports.len()); let memories = Self::extract_memories(&wasmer_instance); exports.extend(imports); diff --git a/wit_fce/src/instance/wit_module.rs b/wit_fce/src/instance/wit_module.rs index bf37096d..2179163e 100644 --- a/wit_fce/src/instance/wit_module.rs +++ b/wit_fce/src/instance/wit_module.rs @@ -170,8 +170,6 @@ impl WITModule { &interfaces.types[i.adapter_function_type as usize] { for export_function_name in export_function_names.iter() { - println!("export func name {}", export_function_name); - // TODO: handle errors let interpreter: WITInterpreter = adapter_instructions.try_into().unwrap(); wit_callable_exports.insert( @@ -257,17 +255,19 @@ impl WITModule { let wit_instance = wit_instance.clone(); let inner_import = Box::new(move |_: &mut Ctx, inputs: &[Value]| -> Vec { - println!("calling from import with {:?}", inputs); - - let tt = wit_instance.clone(); + // copy here to because otherwise wit_instance will be consumed by the closure + let wit_instance_callable = wit_instance.clone(); let converted_inputs = inputs.iter().map(wval_to_ival).collect::>(); - //let mut wit_instance_copy = Arc::make_mut(tt).unwrap(); unsafe { - let r = interpreter - .run(&converted_inputs, Arc::make_mut(&mut tt.assume_init())); - println!("import interpreter result is {:?}", r); + // error here will be propagated by the special error instruction + let _ = interpreter.run( + &converted_inputs, + Arc::make_mut(&mut wit_instance_callable.assume_init()), + ); } + // wit import functions should only change the stack state - + // the result will be returned by an export function vec![] });