Stream: git-wasmtime

Topic: wasmtime / issue #9509 Cranelift: Correctly handle abi ca...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 24 2024 at 15:42):

bjorn3 opened issue #9509:

Feature

When lowering a C or Rust type in a clif ir function signature, sometimes it is necessary to split it into multiple clif ir level parameters. For example #[repr(C)] struct F32Array { field0: [f32; 4] } would be split into f32, f32, f32, f32 on arm64. According to the ABI document for pretty much every architecture if at least one of these parts doesn't fit into an argument register anymore, the entire value has to be passed on the stack. Currently there is no way to tell Cranelift to handle this behavior.

Benefit

Required for https://github.com/rust-lang/rustc_codegen_cranelift/issues/1525.

Implementation

@cfallin suggested a couple of options of which the option they preferred is:

put an abstraction in CLIF for "these values are allocated as a unit"; kind of a lightweight aggregate type, only in the signature and only used by the ABI code, so e.g. the group wouldn't otherwise be a first-class value

I also think this is the best option.

Alternatives

The alternatives @cfallin suggested are:


Last updated: Nov 22 2024 at 17:03 UTC