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

Method make_arguments

cranelift/filetests/src/function_runner.rs:499–517  ·  view source on GitHub ↗

Build the arguments vector for passing the [DataValue]s into the [Trampoline]. The size of `u128` used here must match [Trampoline::SLOT_SIZE].

(arguments: &[DataValue], signature: &ir::Signature)

Source from the content-addressed store, hash-verified

497 /// Build the arguments vector for passing the [DataValue]s into the [Trampoline]. The size of
498 /// `u128` used here must match [Trampoline::SLOT_SIZE].
499 pub fn make_arguments(arguments: &[DataValue], signature: &ir::Signature) -> Self {
500 assert_eq!(arguments.len(), signature.params.len());
501 let mut values_vec = vec![0; max(signature.params.len(), signature.returns.len())];
502
503 // Store the argument values into `values_vec`.
504 for ((arg, slot), param) in arguments.iter().zip(&mut values_vec).zip(&signature.params) {
505 assert!(
506 arg.ty() == param.value_type || arg.is_vector(),
507 "argument type mismatch: {} != {}",
508 arg.ty(),
509 param.value_type
510 );
511 unsafe {
512 arg.write_value_to(slot);
513 }
514 }
515
516 Self(values_vec)
517 }
518
519 /// Return a pointer to the underlying memory for passing to the trampoline.
520 pub fn as_mut_ptr(&mut self) -> *mut u128 {

Callers

nothing calls this directly

Calls 2

write_value_toMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected