Skip to content
22 changes: 22 additions & 0 deletions crates/core/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading