MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / collect_returns

Method collect_returns

cranelift/filetests/src/function_runner.rs:526–537  ·  view source on GitHub ↗

Collect the returned [DataValue]s into a [Vec]. The size of `u128` used here must match [Trampoline::SLOT_SIZE].

(&self, signature: &ir::Signature)

Source from the content-addressed store, hash-verified

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

Callers 1

callMethod · 0.80

Calls 3

lenMethod · 0.45
iterMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected