diff --git a/crates/core/src/abi.rs b/crates/core/src/abi.rs index 234209440..d5e70fdf5 100644 --- a/crates/core/src/abi.rs +++ b/crates/core/src/abi.rs @@ -1235,6 +1235,28 @@ impl<'a, B: Bindgen> Generator<'a, B> { }, } + // Free things + if sig.indirect_params { + // self.emit(&Instruction::GetArg { nth: 0 }); + // let ElementInfo { size, align } = self + // .bindgen + // .sizes() + // .record(func.params.iter().map(|t| &t.1)); + // self.emit(&Instruction::GuestDeallocate { size, align }); + } else { + let mut offset = 0; + for (_, ty) in func.params.iter() { + let types = flat_types(self.resolve, ty, Some(max_flat_params)) + .expect(&format!("direct parameter load failed to produce types during generation of fn call (func name: '{}')", func.name)); + for _ in 0..types.len() { + self.emit(&Instruction::GetArg { nth: offset }); + offset += 1; + } + + self.deallocate(ty, Deallocate::Lists); + } + } + // Build and emit the appropriate return match (variant, async_flat_results) { // Async guest imports always return a i32 status code