Constructs an [ABISig] using Winch's ABI.
(ty: &WasmFuncType)
| 76 | |
| 77 | /// Constructs an [ABISig] using Winch's ABI. |
| 78 | pub(crate) fn wasm_sig<A: ABI>(ty: &WasmFuncType) -> Result<ABISig> { |
| 79 | // 6 is used semi-arbitrarily here, we can modify as we see fit. |
| 80 | let mut params: SmallVec<[WasmValType; 6]> = SmallVec::new(); |
| 81 | params.extend_from_slice(&vmctx_types::<A>()); |
| 82 | params.extend_from_slice(ty.params()); |
| 83 | |
| 84 | A::sig_from(¶ms, ty.results(), &CallingConvention::Default) |
| 85 | } |
| 86 | |
| 87 | /// Returns the callee and caller [VMContext] types. |
| 88 | pub(crate) fn vmctx_types<A: ABI>() -> [WasmValType; 2] { |