-For frozen structs and enums, Swift has a complicated lowering process where the struct or enum type's layout are recursively flattened to a sequence of primitives. If this sequence is length 4 or less, the values of this type are split into the elements of this sequence for parameter passing instead of passing the struct as a whole. Structs and enums that cannot be broken down in this way are passed by-reference to their specified frozen layout. When a frozen struct or enum with a valid primitive sequence of 4 elements or less is returned from a function, it is returned if it were a structure of the elements of the primitive sequence. Due to high implementation cost in the RyuJIT, in particular in the `UnmanagedCallersOnly` scenario, we should implement this first pass of lowering in the projection layer. The only types allowed for `CallConvSwift` calling convention in method or function pointer parameters are primitives, our special Swift register types, and pointer types. In return types, we will also allow structure types to support returning the primitive type sequences correctly. For reference, this lowering pass is done in the Swift compiler when lowering from Swift IL to LLVM IR. This design decision reinforces our direction of having the Runtime layer of Swift interop support similar features as the LLVM IR representation of Swift.
0 commit comments