diff --git a/wasmer-it/src/interpreter/instructions/lilo/utils.rs b/wasmer-it/src/interpreter/instructions/lilo/utils.rs index 0065aeb..7ac8fce 100644 --- a/wasmer-it/src/interpreter/instructions/lilo/utils.rs +++ b/wasmer-it/src/interpreter/instructions/lilo/utils.rs @@ -23,6 +23,7 @@ where Instance: wasm::structures::Instance, { let closure = move |size: usize, ty: usize| { + log::trace!("call allocate closure 1: {} {}", size, ty); let index = FunctionIndex::new(ALLOCATE_FUNC_INDEX as usize); let local_or_import = instance @@ -31,6 +32,8 @@ where function_index: ALLOCATE_FUNC_INDEX, })?; + log::trace!("call allocate closure 2"); + let inputs = vec![IValue::I32(size as _), IValue::I32(ty as _)]; // TODO: we could check it only once on the module startup or memorize check result crate::interpreter::instructions::check_function_signature( @@ -40,14 +43,20 @@ where ) .map_err(|_| LiLoError::AllocateFuncIncompatibleSignature)?; + log::trace!("call allocate closure 3: {:?}", inputs); + let outcome = local_or_import .call(&inputs) .map_err(|_| LiLoError::AllocateCallFailed)?; + log::trace!("call allocate closure 4: {:?}", outcome); + if outcome.len() != 1 { return Err(LiLoError::AllocateFuncIncompatibleOutput); } + log::trace!("call allocate closure 5"); + match outcome[0] { IValue::I32(offset) => Ok(offset as _), _ => Err(LiLoError::AllocateFuncIncompatibleOutput),