From d8b83aa2d6efb65a6bbe32793da81aaa00290702 Mon Sep 17 00:00:00 2001 From: Tomasz Andrzejak Date: Wed, 20 May 2026 08:33:43 +0200 Subject: [PATCH] fix: async lifted exports with direct results Avoid lifting the raw core return value for async lifted exports without a retptr. The core return is async progress information, while the component result is delivered through task.return. Additionaly params is now using &sig.results which makes AsyncTaskReturn match the actual canonical ABI core signature: [], [i32], [ptr] etc. --- crates/core/src/abi.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/crates/core/src/abi.rs b/crates/core/src/abi.rs index 0c4635419..73238fc93 100644 --- a/crates/core/src/abi.rs +++ b/crates/core/src/abi.rs @@ -1165,10 +1165,11 @@ impl<'a, B: Bindgen> Generator<'a, B> { amt: usize::from(func.result.is_some()), }); } - } else { - // With no return pointer in use we can simply lift the - // result(s) of the function from the result of the core - // wasm function. + } else if !async_ { + // With no return pointer in use for a synchronous call, we can simply lift the + // result(s) of the function from the result of the core wasm function. For async + // calls, the component result is delivered via `task.return` and core result is + // async progress. if let Some(ty) = &func.result { self.lift(ty) } @@ -1178,11 +1179,7 @@ impl<'a, B: Bindgen> Generator<'a, B> { if async_ { self.emit(&Instruction::AsyncTaskReturn { name: &func.name, - params: if func.result.is_some() { - &[WasmType::Pointer] - } else { - &[] - }, + params: &sig.results, }); } else { self.emit(&Instruction::Return {