For a variety of [practical][Implementation Limits] reasons, we need to limit
the total number of flattened parameters and results, falling back to storing
everything in linear memory. The number of flattened results is currently
limited to 1 due to various parts of the toolchain (notably the C ABI) not yet
being able to express [multi-value] returns. Hopefully this limitation is
temporary and can be lifted before the Component Model is fully standardized.
If I understand correctly, the only limitation is that C ABI doesn't support multi-value returns. However, it doesn't affect function parameters since complex function parameters are simply flattened into more arguments. For example, a: (i8, i8) is flattened into a.0: i8, a.1: i8.
Suggestion: Increase the flattening limit (MAX_FLAT_RESULTS) to at least 2 for parameters but not return values.
Pros: This will save quite a bit of memory roundtrips for many types, especially strings.
Cons: It will require the code to produce two slightly different representations for the same type, depending on if it is parameter or return value.
From the current specification:
If I understand correctly, the only limitation is that C ABI doesn't support multi-value returns. However, it doesn't affect function parameters since complex function parameters are simply flattened into more arguments. For example,
a: (i8, i8)
is flattened intoa.0: i8, a.1: i8
.Suggestion: Increase the flattening limit (MAX_FLAT_RESULTS) to at least 2 for parameters but not return values.
Pros: This will save quite a bit of memory roundtrips for many types, especially strings.
Cons: It will require the code to produce two slightly different representations for the same type, depending on if it is parameter or return value.