Collect the returned [DataValue]s into a [Vec]. The size of `u128` used here must match [Trampoline::SLOT_SIZE].
(&self, signature: &ir::Signature)
| 524 | /// Collect the returned [DataValue]s into a [Vec]. The size of `u128` used here must match |
| 525 | /// [Trampoline::SLOT_SIZE]. |
| 526 | pub fn collect_returns(&self, signature: &ir::Signature) -> Vec<DataValue> { |
| 527 | assert!(self.0.len() >= signature.returns.len()); |
| 528 | let mut returns = Vec::with_capacity(signature.returns.len()); |
| 529 | |
| 530 | // Extract the returned values from this vector. |
| 531 | for (slot, param) in self.0.iter().zip(&signature.returns) { |
| 532 | let value = unsafe { DataValue::read_value_from(slot, param.value_type) }; |
| 533 | returns.push(value); |
| 534 | } |
| 535 | |
| 536 | returns |
| 537 | } |
| 538 | } |
| 539 | |
| 540 | /// Build the Cranelift IR for moving the memory-allocated [DataValue]s to their correct location |